How can I install a package on Debian without internet (without using apt-get)? I want to download it on USB and install from USB using terminal.


Check out the apt-offline package. It goes like:

  1. Generate a signature file on the Disconnected Debian box at home:

    apt-offline set /tmp/apt-offline.sig
  2. Download data based on the signature file generated earlier

    apt-offline get C:\apt-offline.sig --threads 5
  3. Once you're back upon the home Debian machine, you feed the data from the removable medium to apt-offline:

    apt-offline install /media/USB/apt-offline.zip


The path for USB is in /media, so you will have to search there what's the path. Once you have it you can excecute:

sudo dpkg -i /path/to/your/usb/device/DEB_PACKAGE

Or simply this if you are in the same USB folder as the package:

sudo dpkg -i DEB_PACKAGE

For example if the package file is called a_debian_package_2.0.deb then you should do

sudo dpkg -i a_debian_package_2.0.deb

If dpkg reports an error due to dependency problems, you will have to install those dependencies in the same way before your package.

You can read more about this on this AskUbuntu answer.


It isn't very well set up for a lack of internet, in some of the BSDs you can do a "make fetchlist" which will give you a list of files (and urls?) you need to download to install something.

Aptitude may do this too, but in Synaptic you can select things you want to install, and it will also include needed dependencies automatically. Then do File -> Generate Package Download Script and it will output a script that calls wget for each file. The corresponding item is File -> Add downloaded packages which prompts for a directory where the files are, then installs them correctly just as if you were online.

You need to somehow get the lists of files (apt-get update) and install Synaptic, after that it's pretty easy. You make your download scripts in Synaptic and put them on something like a USB stick, take that to an online machine (needs to have wget) and do the downloads, then bring the USB stick back and let Synaptic do the installs. You can sort of do dpkg -i but it's messy because it won't get the order right. You can fix with apt-get -f install (nothing).

If you really have to you can bootstrap manually by going someplace like https://packages.debian.org/stable/ and downloading manually but it's a pain to know what to get. Synaptic and aptitude are just packages like any others but Synaptic in particular requires that you get xorg up and running.

One thing to bear in mind is is that this isn't like Windows. If you have a connected machine similar to what you want to install on at home, you can take a hard drive (or SD card) to the connected one, install Debian onto it, bring it home and plug it in and it will boot up. Video devices, mice, keyboards, etc can be different but it should boot to a command line and you can work from there. They need to be the same architecture (x86 vs arm, etc).


You need to point your /etc/apt/sources.list to the USB drive with the downloaded material. You may find a couple of commented out lines that used to point at your install CD at the head of the file to guide you.

  • Thank you! It's a bit more complicated because I am new to linux. But it is very interesting. Oct 1 '16 at 19:06
  • This is assuming that the filesystem on this drive contains a repository. This question is worded in a way that appears to refer to an individual package.
    – Spooler
    Oct 1 '16 at 19:08

You need to download the .deb files relevant to your package (plus any dependencies it might demand) and walk them over to that machine with a flash drive (or network share - whatever works).

You can install .deb files directly using dpkg. For example dpkg -i packagefoo.deb will install that package. However, dpkg will not crawl through its dependencies (as there is no repository to walk through). So you'll need to install those in the same way.

Alternatively, there are methods to mirror Debian repositories (as well as others) to a local server on your network, and then use that serer as your repository that endpoint machines refer to. This can also be helpful in other ways, as it can allow you to create repositories of software you typically use that might not be in common repos, and to stage updates for deployment (via testing and production repositories).

A squid caching proxy is one of the simplest ways to do this.


On Linux Mint 20.2 (USB mounted automatically via udisks - AFAIK most of modern Linux distros work that way) I know the following works:

sudo setfacl -m u:_apt:x /media/$(id -nu)
sudo apt install "/media/$(id -nu)/USB stick/some_path/*.deb"


If sudo dpkg -i list_of_files is used, then there can be an issue with pre-dependencies (require debs to be processed in certain order). sudo apt install list_of_files will take case of that. But sudo apt uses _apt user (not root) so _apt user should have access to the deb files. On my system, when I insert USB, it is mounted under /media/myusername and access to myself for /media/myusername is given by ACL, and I can add _apt to ACL too: sudo setfacl -m u:_apt:x /media/myusername.

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.