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?
Asked
Active
Viewed 2.1e+01k times
128
-
6This can be moved to SuperUser, right? – kumarharsh Feb 13 '15 at 07:28
-
2Or to [AskUbuntu](https://askubuntu.com), where it has since been [asked](https://askubuntu.com/questions/47865/how-do-i-use-apt-get-to-only-download-packages) and [answered](http://askubuntu.com/a/47877/20358). – jpaugh Jan 26 '17 at 15:13
-
For Debian start https://packages.debian.org/stable/ Drill down. Very near (way down) the page for the package is a list of architectures you can download. Click to download. – Elliptical view Jun 23 '20 at 23:23
3 Answers
136
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

Zombo
- 1
- 62
- 391
- 407

Marcus Borkenhagen
- 6,536
- 1
- 30
- 33
-
4Does this work if the package is already up-to-date on the system which `apt-get -d` is executed on? – Peter Mortensen Jul 25 '14 at 13:49
-
@PeterMortensen, nope it does not. But in this case you could use dpkg-repack (apt-get install dpkg-repack + man should be easy enough) - although this is quite far-fetched in relation to the original question. Alternatively there is always http://packages.debian.org/ – Marcus Borkenhagen Jul 26 '14 at 12:29
126
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.

Dirk Eddelbuettel
- 360,940
- 56
- 644
- 725
-
OK, believe I read that in the man but I write:sudo apt-get install -d
– Manuel de Leon Dec 11 '10 at 23:22 -
11
-
70This will download package to current working directory: `aptitude download
`. It avoids problems faced by `apt-get` when the package is already installed – biocyberman Mar 04 '14 at 19:53 -
8@biocyberman: Could you please post that as a separate answer? It's simpler than any of the other suggested answers, but it's easy to miss since it's just a comment. – Brooks Moses May 22 '14 at 23:38
-
If you're into wrappers, look into `wajig` which I have been using for years. It has a download command too (and wraps `aptitude`). – Dirk Eddelbuettel May 23 '14 at 01:26
-
1
-
1
-
6More recent distros can also do `apt download
` (similar to biocyberman's answer but I think `apt` is now more common than `aptitude`). – Dan R Aug 22 '17 at 05:28 -
Suggestions: Perhaps add `apt download
` to the answer and add the information that it's downloaded to `/var/cache/apt/archives/` – DarkTrick Nov 30 '20 at 09:05 -
@DarkTrick. Sure. But my _ten year old_ answer already started by saying that there is more than one way to skin this cat... – Dirk Eddelbuettel Nov 30 '20 at 14:44
53
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

knocte
- 16,941
- 11
- 79
- 125

Alfonso Vila
- 539
- 3
- 2
-
11If you're running as a non-root user you can do something like: mkdir -p /tmp/archives/partial && apt-get -d -o dir::cache=/tmp -o Debug::NoLocking=1 install package – May 22 '12 at 16:56
-
+1 for mentioning -o option. Was searching for this information for almost an hour now. – Hashken Jul 21 '12 at 04:26
-
3On 12.04, when I ran: ``apt-get -d -o=dir::cache=/tmp/pkg rabbitmq-server E: Invalid operation rabbitmq-server`` It should be : ``$ apt-get download -o=dir::cache=/tmp/pkg rabbitmq-server Get:1 Downloading rabbitmq-server 2.7.1-0ubuntu4 [2,745 kB] 13% [1 rabbitmq-server 361 kB/2,745 kB 13%]`` – HVNSweeting Jun 25 '13 at 03:47
-
5This doesn't appear to download anything if the package is already up-to-date on the system. – Sparhawk Sep 06 '15 at 23:50
-
1you need to include the "install" command in the request. Thus "apt-get install -d -o=dir::cache=/tmp packagename" – Paul Chernoch Dec 09 '16 at 17:17
-
I need the -o option, without the system does not download the packages. – Scorpion Jan 25 '20 at 10:57