How do I download a package from apt-get without installing it?

DebianApt Get

Debian Problem Overview


I have a computer without a NIC, and I want to install some programs in it via USB memory, but how can I download a program from apt-get without installing it?

Debian Solutions


Solution 1 - Debian

Try

apt-get -d install <packages>

It is documented in man apt-get.

Just for clarification; the downloaded packages are located in the apt package cache at

/var/cache/apt/archives

Solution 2 - Debian

There are a least these apt-get extension packages that can help:

apt-offline - offline apt package manager
apt-zip - Update a non-networked computer using apt and removable media

This is specifically for the case of wanting to download where you have network access but to install on another machine where you do not.

Otherwise, the --download-only option to apt-get is your friend:

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

Solution 3 - Debian

Don't forget the option "-o", which lets you download anywhere you want, although you have to create "archives", "lock" and "partial" first (the command prints what's needed).

apt-get install -d -o=dir::cache=/tmp whateveryouwant

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionManuel de LeonView Question on Stackoverflow
Solution 1 - DebianMarcus BorkenhagenView Answer on Stackoverflow
Solution 2 - DebianDirk EddelbuettelView Answer on Stackoverflow
Solution 3 - DebianAlfonso VilaView Answer on Stackoverflow