1

From the man pages of 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.

So what is the difference between the following commands:

apt-get download apache2

apt-get install --download-only apache2

And why the first one gives the following error:

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)
3

Although I didn't manage to figure out the error, the difference in the commands seems to mainly be the following:

apt-get download apache2

will download just the .deb in the current wd

So after the download, running dpkg -i <filename>.deb will most likely fail due to missing dependencies

apt-get install --download-only apache2

will download the respective .deb and its dependencies under /var/cache/apt/archives/ where package caching is done;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.