apt-get 进入下载模式

apt-get 进入下载模式

man页面apt-get

-d, --download-only
           Download only; package files are only retrieved, not unpacked or installed. Configuration Item: APT::Get::Download-Only.

download
          download will download the given binary package into the current directory.

那么以下命令有什么区别:

apt-get download apache2

apt-get install --download-only apache2

为什么第一个会出现以下错误:

Get:1 http://gr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.2 [95,1 kB]
Fetched 95,1 kB in 1s (102 kB/s)                        
W: Download is performed unsandboxed as root as file '/home/pkaramol/Desktop/apache2_2.4.29-1ubuntu4.2_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

答案1

虽然我没能找出错误,但命令的差异似乎主要如下:

apt-get download apache2

将仅下载.deb当前 wd 中的

所以下载后运行dpkg -i <filename>.deb很可能会因为缺少依赖而失败

apt-get install --download-only apache2

将下载相应的.deb 它的依赖项在/var/cache/apt/archives/包缓存完成的位置下;

相关内容