eng*_*ent 10 package-management apt
我知道说到Red Hat发行版,我可以用下面的命令下载一个包的副本,然后单独安装。
yumdownloader package_name
yum install package_name
Run Code Online (Sandbox Code Playgroud)
在 Ubuntu 中是否有完全等效的单独执行这两个操作,或者以下命令是否同时执行这两个操作?
apt-get install package_name
Run Code Online (Sandbox Code Playgroud)
只需将-d(或--download) 选项添加到任何apt-get命令即可。这种方法简单而有效。
例如:
$ sudo apt-get dist-upgrade -d
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-3.19.0-39 linux-headers-3.19.0-39-generic linux-image-3.19.0-39-generic linux-image-extra-3.19.0-39-generic
linux-signed-image-3.19.0-39-generic
The following packages will be upgraded:
keepassx linux-headers-generic linux-libc-dev linux-signed-generic linux-signed-image-generic
5 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 67,0 MB of archives.
After this operation, 289 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://nl.archive.ubuntu.com/ubuntu/ vivid-updates/main linux-image-3.19.0-39-generic amd64 3.19.0-39.44 [16,9 MB]
[...]
Fetched 67,0 MB in 4s (13,5 MB/s)
Download complete and in download only mode
Run Code Online (Sandbox Code Playgroud)
稍后离线时,您可以运行sudo apt-get dist-upgrade以完成安装。(注意需要获得 0 B/67,0 MB 的档案。)
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-3.19.0-39 linux-headers-3.19.0-39-generic linux-image-3.19.0-39-generic linux-image-extra-3.19.0-39-generic
linux-signed-image-3.19.0-39-generic
The following packages will be upgraded:
keepassx linux-headers-generic linux-libc-dev linux-signed-generic linux-signed-image-generic
5 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/67,0 MB of archives.
After this operation, 289 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Run Code Online (Sandbox Code Playgroud)
它也适用于install或 其他命令:
$ sudo apt-get install -d libpcap-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libpcap0.8-dev
The following NEW packages will be installed:
libpcap-dev libpcap0.8-dev
0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
Need to get 214 kB of archives.
After this operation, 749 kB of additional disk space will be used.
Do you want to continue? [J/n]
Get:1 http://nl.archive.ubuntu.com/ubuntu/ vivid/main libpcap0.8-dev amd64 1.6.2-2 [210 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu/ vivid/main libpcap-dev all 1.6.2-2 [3448 B]
Fetched 214 kB in 0s (1776 kB/s)
Download complete and in download only mode
Run Code Online (Sandbox Code Playgroud)
清除缓存(存储在 中/var/cache/apt/archives):
sudo apt-get clean
Run Code Online (Sandbox Code Playgroud)
使用download的功能apt-get。
来自man apt-get:
download
download will download the given binary package into the current directory.
Run Code Online (Sandbox Code Playgroud)
例如:
apt-get download chromium-browser
Run Code Online (Sandbox Code Playgroud)
将debchrome浏览器的文件下载到当前目录。请注意,这不会下载包的任何依赖项,因此如果您尝试通过以下方式安装.deb:
sudo dpkg -i path/to/downloaded/deb/file
Run Code Online (Sandbox Code Playgroud)
你会得到依赖错误。
apt-get install packageName做这两个(下载+安装)工作。下载的包将在/var/cache/apt/archives文件夹中
| 归档时间: |
|
| 查看次数: |
10018 次 |
| 最近记录: |