I have a friend who has got a computer that is not connected to the Internet. Is there any way to install software offline easily?


24 Answers 24


Check out Keryx; it's an offline repository manager.

How does it work? It lets you download updates and new programs (with dependencies) to your flash drive.

Its interface is similar to synaptic, but it works from a pendrive (it doesn't need installation). Unfortunately, the GUI needs wxwidgets, which don't come preinstalled on Ubuntu (they're cross-platform and installable from here and Ubuntu repository here). It can only install software in a Ubuntu system, but you can download the updates or new packages in any Linux, Windows or OS X.

Here you can find a tutorial.

Another detailed step-by-step tutorial is in this answer.

Launchpad also hosts downloadable files.

A screenshot:


  • 18
    keryx is no longer under development, if you are trying this on a newer version of Ubuntu, use the portable version to save yourself from the trouble of dependencies.
    – Alex R
    Commented Dec 6, 2012 at 10:54
  • 1
    I do still use keryx without problems, although it clearly needs further development and improvements.
    – carnendil
    Commented Sep 27, 2013 at 22:44
  • 2
    How do I use it?
    – carnendil
    Commented Feb 24, 2016 at 4:41
  • 4
    I've just released a new version of Keryx (0.92.5), which may resolve some concerns. The compiled version should hold dependencies such as wxWidgets and allow you to run on Windows with no problems. Commented Jun 21, 2017 at 14:36
  • 1
    Keryx does not works out-of-the-box on Ubuntu 20.04.6 LTS nor Ubuntu 22.04. I have opened questions on how to make it work for each system. Help is appreciated to discover how to make Keryx work on newer systems. Or, if you are reading this in the future, check there if you still want to use Keryx. Commented May 25, 2023 at 13:45

A quick hack is to copy all the packages you downloaded for your install to his machine. Detailed instructions can be found in this answer:

The .deb files are stored in /var/cache/apt/archives, then in the other computer launch Synaptic and select File -> Add Package Downloaded and search the folder were you put the files and open it, accept all (or install from terminal using the command sudo dpkg -i DEB_PACKAGE_NAME).


This assumes that your package manager is not setup to delete the packages straight after install. It also assumes that you are running the same version of Ubuntu (10.10, 12.04, etc) and architecture version (32b or 64b).

A DVD repository

If you want the latest bug fixes and security patches available then have a look at this tutorial:

... which covers creating your own DVD repository.

  • 2
    If you can't run sudo apt-get update this will not work very well, still a good time saver when setting up a new system :) Commented Apr 30, 2013 at 1:54
  • Agreed, just upgraded two computers to 13.10 from 13.04. The first one had to download ~1.8Gb, copying the content of /var/cache/apt/archives to the second one made it only download ~250Mb. Still, you need a connection to run the install.
    – Maxime R.
    Commented Nov 2, 2013 at 18:16
  • apt-get update is not needed if you copy /var/lib/apt/lists - this directory contains the repository information that is downloaded by apt-get update.
    – ignis
    Commented Mar 19, 2014 at 21:21
  • I copied my .deb over to my usb from /var/cache/apt/archives . On the other computer I merely opened the usb drive and double clicked the .deb which launched the Ubuntu GUI Software Updater. Easy pezy.
    – Jacksonkr
    Commented Apr 20, 2016 at 3:30
  • @jr0cket:Is there any way to avoid the packages in this folder /var/cache/apt/archives which already (inbuilt) comes when Debian is installed?.The reason why I'm asking this is 4.8 GB is way too large for my usb drive which is 4 GB.
    – justin
    Commented Apr 25, 2016 at 9:07

A USB repository

If you have a decent sized USB stick - assuming around 4-8Gb (or external hard drive) you can set up a custom copy of the Ubuntu repository and configure that as a local repository as covered in AptGet/Offline/Repository on help.ubuntu.com.

To get the actual package files (the .deb files), I suggest using apt-mirror.

The apt-mirror package will help you create a custom mirror which should be smaller than the 30Gb of the full repository. Install the package:

sudo apt-get install apt-mirror

and edit its configuration file

gksudo gedit /etc/apt-mirror/mirror.list

or since Ubuntu 14.04

gksudo gedit /etc/apt/mirror.list

Only include the repository sections you want. Here is a simple example that copies the binary .deb files from all 4 sections (main, restricted, universe and multiverse) as well as the latest bug fixes.

# apt-mirror configuration file
## The default configuration options (uncomment and change to override)
set base_path    /tmp/ubuntumirror

## Repositories to copy from - 

## use a mirror so you don't overload the main server!!!

# Lucid binaries - no source files
deb http://archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse

## Clean up older .deb files no longer in the archive
clean http://archive.ubuntu.com/ubuntu

It is guesstimated that you will need around 15Gb of space for all 4 sections, without the source.

I have put the path for all the .deb files to be /tmp, make sure you have enough space so your hard drive does not fill up (if your hard drive does fill up and your computer freezes, /tmp should be cleared with a reboot).

If you just want the main files, remove the restricted, universe and multiverse names from the configuration file.

If you are using a different architecture (you have 64bit, but your friend has 32 bit) then add the following at the start of the mirror.list configuration file:

set defaultarch i386

Once you have the apt-mirror configuration you want, run apt-mirror and go do something fun or life changing as it will take hours or days to get the repository (depending on your connection and the Ubuntu mirror you are using).

Once you have the .deb files, copy the files to your USB memory stick (or external hard drive) and set up the local repository as per the article mentioned previously.

Test it works before taking it to your friend!


Step 1: Get the download URLs in a file :

Execute the following command replacing package-names with required ones, separating by a space.

apt-get -y install --print-uris package-name | cut -d\' -f2 | grep http:// > apturls

Step 2: Copy this file (apturls) to a machine which has high-speed Internet access, and execute the following command to download the packages:

wget -i path-to-apturls-file 

Step 3: Now get those downloaded packages to your machine, and install them using :

cd path-to-the-downloaded-packages-directory

sudo dpkg -i *.deb


  • 3
    Does --print-uris print even dependencies that are already installed in the system?
    – yuric
    Commented Sep 25, 2015 at 21:18

Use apt-get with the --print-uris option to do it and add -qq so it would be quiet.

Use sed to remove extra characters added to some filenames (something like 3%2a) and to get the url, filename and md5sum of files. Use wget to download the files. Use md5sum to check if the files are downloaded properly.

You may use this to create a shell script for Linux or Mac OS (replace .cmd in the commands to .sh and do chmod a+x <filename> to add permission to execute the script) or a Windows Command batch file, and an MD5Sum file to make sure the files are downloaded correctly.


Create script:

sudo apt-get <<<apt-get command and options>>> --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > script.cmd


sudo apt-get install anjuta --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > install-anjuta.cmd
sudo apt-get upgrade --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > upgrade.cmd
sudo apt-get dist-upgrade --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > dist-upgrade.cmd

Create md5sum file:

sudo apt-get <<<apt-get command and options>>> --print-uris -qq | sed -n -e "s/_[0-9]%[0-9a-f][0-9a-f]/_/" -e "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/\4  .\/\2/p" > md5sum.txt


sudo apt-get install anjuta --print-uris -qq | sed -n -e "s/_[0-9]%[0-9a-f][0-9a-f]/_/" -e "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/\4  .\/\2/p" > md5sum.txt
sudo apt-get upgrade --print-uris -qq | sed -n -e "s/_[0-9]%[0-9a-f][0-9a-f]/_/" -e "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/\4  .\/\2/p" > md5sum.txt
sudo apt-get dist-upgrade --print-uris -qq | sed -n -e "s/_[0-9]%[0-9a-f][0-9a-f]/_/" -e "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/\4  .\/\2/p" > md5sum.txt

You need md5sum for Windows if you're using that operating system to download files.

Create script to download repository listings:

sudo apt-get update --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) :/wget -c \1 -O \2.bz2/p" > update.cmd

Checking MD5 Sums

You may add these to the ends of scripts to check md5sum:


md5sum --quiet -c md5sum.txt

Windows (uses older md5sum, does not support --quiet):

md5sum -c md5sum.txt

To add automatically to script:

echo -e "md5sum -c md5sum.txt\npause" >> script.cmd

Installing List Files (Update Command)

Run these commands to the target computer.

You need to use bunzip2 to extract the repository list files:

bunzip2 *.bz2

Then copy to listing folder (current folder only contains list files):

sudo cp * /var/lib/apt/lists/

Above combined (current folder may contain other files):

for listfile in `ls *.bz2`; do bunzip2 $listfile; sudo cp ${listfile%.bz2} /var/lib/apt/lists/; done

Faster Downloads

If you want to make downloading the files faster, try using Axel.

Replace wget -c ... -O ... with axel ... -o ....

Folder Hierarchy (Downloading files using Windows)

I usually create a folder like this:

  • apt-get/
    • bin/
      • msys-1.0.dll
      • msys-intl-8.dll
      • wget.exe
      • msys-iconv-2.dll
      • md5sum.exe
      • libeay32.dll
      • libintl3.dll
      • libssl32.dll
      • libiconv2.dll
    • update/
      • update.cmd
      • md5sum.txt
    • install/
      • install-foo.cmd
      • install-bar.cmd
      • upgrade.cmd
      • md5sum.txt

Then change wget in the lines above to ..\\bin\\wget.exe, md5sum to ..\\bin\\md5sum.exe, etc.

This will separate the *.deb files and list files into different folders.

Updating your system

  1. Boot to target computer that uses Ubuntu
  2. Create a script for update
  3. Boot to a computer with an internet connection
  4. Run update.sh (for Linux or Mac OS) or update.cmd (Windows)
  5. Go back to target computer
  6. Install list files
  7. Create a script for upgrade/dist-upgrade (add md5sum commands to end)
  8. Go back to computer with internet connection
  9. Run upgrade.sh/dist-upgrade.sh (Linux or Mac OS) or upgrade.cmd/dist-upgrade.cmd (Windows)
  10. Go back to target computer
  11. Copy *.deb files to cache: sudo cp *.deb /var/cache/apt/archives/
  12. Run: sudo apt-get upgrade or sudo apt-get dist-upgrade

Download Executables for Windows

Wget for Windows: http://gnuwin32.sourceforge.net/packages/wget.htm

md5sum for Windows: http://gnuwin32.sourceforge.net/packages/coreutils.htm or http://www.etree.org/cgi-bin/counter.cgi/software/md5sum.exe

You may also use the ones from MinGW, which are what I use. You only need wget.exe, md5sum.exe and the necessary shared libraries. Check the section "Folder Hierarchy".


  • I'm not entirely sure if everything above commands will work, since I haven't used them for a month now. Especially the update command, which I haven't tested today some parts of it.
  • To easily see the results of the commands, add a "pause" line in the end of the scripts, if using Windows.
  • I recommend to create shell scripts to update, upgrade and install packages if you're using these commands often.
  • 4
    Can you create a simple gui for this :)
    – Tachyons
    Commented Jul 22, 2012 at 3:32
  • 1
    using windows for this seems very weird...
    – Alex R
    Commented Dec 6, 2012 at 11:50
  • 2
    It's also applicable to Linux (which is actually better because you don't need to install md5sum and wget). The Windows part is for those who don't have a Linux computer with internet connection, so you could use it in an internet cafe or a friend's computer that only has Windows. Commented Dec 10, 2012 at 1:32
  • 1
    -qq option appears to suppress all the output from apt-get update. I suppose you don't really want this option.
    – Ruslan
    Commented Jun 25, 2018 at 14:59

You need to get a PC with Internet connection first, where you can download required .deb files. Once you have downloaded all the files, You can now create a CD/DVD rom or ISO file which can you use to install the software you have downloaded in your offline PC.

Start with a clean install or VM.
sudo apt-get install aptoncd

Install the packages you want on one PC
sudo apt-get install gbrainy

Run aptoncd
enter image description here
Click Create
enter image description here
Click Burn and set options then Apply
enter image description here
Burn it or save it
enter image description here

Note that aptoncd only backs up things in the current apt-cache.
This is why we started with a clean VM/new install and did all of this in one run.

  • sooo, are you saying if i make a vm and install all the apps i want, then run this program, take the cd/dvd to the offline pc. and it would install all the apps on it?
    – Alex
    Commented May 1, 2012 at 22:51
  • 2
    As long as you use the same base system media, yes. If you're deploying an office, and you want a quick and simple way to add something, then this becomes very helpful. If you use create-meta package, yes Commented May 1, 2012 at 22:56
  • Restoring from image requires hal to be installed, but it is deprecated and no longer supported as far as i understand. Commented May 23, 2017 at 21:06
  • There's a build for vivid code.launchpad.net/~ubuntu-branches/ubuntu/vivid/hal/vivid Commented May 23, 2017 at 22:28

Offline Repository

How to create an offline repository is described here: you just have to download the appropriate files from archive.ubuntu.com; alternatively, you could use apt-medium.

EDIT: Another approach based on a local archive of *.deb files is described in different blog entries (see here and here). Sarath Chandra summarizes as follows:

  1. Make a dir accessible (at least by root)

    sudo mkdir /var/my-local-repo
  2. Copy all the deb files to this directory.

  3. Make the directory as a gzip:

    sudo bash -c 'dpkg-scanpackages /var/my-local-repo /dev/null | gzip -c9 > /var/my-local-repo/Packages.gz'


    sudo dpkg-scanpackages /var/my-local-repo /dev/null | gzip -c9 > /var/my-local-repo/Packages.gz
  4. Add the local repo to sources

    echo "deb file:/var/my-local-repo ./" > /tmp/my-local.list
    sudo mv /tmp/my-local.list /etc/apt/sources.list.d/my-local.list
    sudo apt-get update

You can use CubeGet. It is a portable package manager that lets you download packages on another internet connected computer (Linux or Windows), and install them back to your original Linux computer, offline.

What CubeGet does is that it creates a Project, that will contain the computer's list of repositories, list of installed packages, and the computer's distribution details (lsb_release). Then using that project, it can be opened on other internet connected computer (Windows also) using CubeGet, search and download for new repositories, package updates and specific package.

  • is it .deb or .exe?
    – user204653
    Commented Dec 15, 2013 at 3:53
  • 2
    There is no .deb file because it is standalone, portable and can be executed without installing (just run cube-normal file). Cube.exe is also included for windows users.
    – Camicri
    Commented Dec 18, 2013 at 4:10
  • 1
    More people need to know about this. I love you.
    – howderek
    Commented Jun 24, 2015 at 19:19
  • I am getting error while running this application on win 7 Ultimate 32 bit. Image : i.sstatic.net/XW3wt.jpg error message: Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: cube.exe Problem Signature 02: Problem Signature 03: 54bd0258 Problem Signature 04: glib-sharp Problem Signature 05: Problem Signature 06: 517edc4c Problem Signature 07: 1b4 Problem Signature 08: 17 Problem Signature 09: System.DllNotFoundException OS Version: 6.1.7600. Locale ID: 16393
    – Sandeep
    Commented Jun 6, 2016 at 8:11
  • Cube ( launchpad.net/cube-server ) don't list project on windows.
    – titusfx
    Commented Jun 17, 2018 at 16:46

In synaptic you can select the packages you want to install and under the first menu there is an option to generate a script which you can take to another machine and run there. This script will "wget" (i.e. "download") all the packages you specified that you wanted (and their dependencies) which you run on a computer that does have internet access.

Once run you'll have all the package files needed by the disconnected computer. Carry them on a CD/USB stick and install them by sudo dpkg -i *.deb.

  • its a nice trick but 2 computers to do the process ? hmmmm
    – Suhaib
    Commented Oct 2, 2012 at 14:23
  • @Suhaib - not sure how you would download the packages you need in any measure without 'two computers'... you need an 'online' machine to get the packages that you will somehow send to your offline machine (even if it is a VM or a Docker Container running on a different host OS, or a bunch of manual curl/wget copies onto some external media...
    – Cinderhaze
    Commented May 20, 2019 at 13:54

You can use apt-offline or apt-offline-gui.
Pre-requistes: A friend's system with Internet connection. apt-offline installed in both your systems.

The Offline installation is achieved in 3 simple steps.

Step 1:
Generate a signature file on the Disconnected Debian box at home
apt-offline set /tmp/apt-offline.sig
The above command will generate all information required from apt about updating its database.

Step 2:
Download data based on the signature file generated earlier
apt-offline get C:\apt-offline.sig --threads 5
The above command will download data as mentioned in the signature file. To speed up downloads (that can be from multiple apt repositories), in this example we spawn 5 download threads.
Once completed, you could just copy the data (an archive file, if you used the --bundle option) back to the removable medium and copy it back onto your offline host.

Step 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
This will update the APT database on your disconnected machine seamlessly.

Apt-offline can be even used in Windows systems. In my opinion, apt-offline is the best option for Offline installation.


  • Two observations: First, generating a signature for an already-installed or a ready-to-install package "fails" in the sense that the .sig file is empty. That's a little disconcerting but apparently normal. Second, apt and apt-offline work correctly only if /var/lib/apt/lists has been properly seeded. This is a fair amount of work if the target and host machines have different architectures.
    – Urhixidur
    Commented Jul 30, 2014 at 13:26
  • Do both source and target PC need to have the same version of Ubuntu? Commented Jul 21, 2015 at 16:32
  • 2
    How to install apt-offline to offline machine?
    – Sami
    Commented May 9, 2019 at 6:25
  • apt-offline was removed from being seeded on the live CD for Xubuntu and Ubuntu Studio in October 2019 and won't be available in the Ubuntu 20.04 LTS package archive. Commented Dec 8, 2019 at 21:12
  • 1
    @Sami I did this by searching for the package on https://packages.ubuntu.com/, transferring the .deb file to the offline computer, and trying to install with sudo dpkg -i apt-offline.deb. It then gives errors because it depends on other packages, so install those first in the same manner. Commented Mar 24, 2020 at 12:35

There are several good, effective answers listed above. However, this is the mechanism I personally use -- apt-ftparchive. I'm documenting it here, in case I need it again in the future. Perhaps it might be useful to you.

Creating the Archive Snapshot

  • Create an instance of Ubuntu that closely mimics the target environment
    • For example, an Ubuntu 12.04 64-bit instance in Amazon
  • Start with a clean package environment
    • sudo apt-get clean
  • Update the package lists
    • sudo apt-get update
  • Download all package updates available
    • sudo apt-get dist-upgrade --download-only
  • Download all relevant packages and dependencies
    • sudo apt-get install --download-only byobu run-one bikeshed dotdee powernap
  • Install the apt-ftparchive utility
    • sudo apt-get install apt-utils
  • Create the package manifest
    • (cd /var/cache/apt/archives/ && sudo apt-ftparchive packages . ) | sudo tee /var/cache/apt/archives/Packages
  • Create an archive of the packages
    • sudo tar cvf snapshot.tar -C /var/cache/apt archives/

Using the Archive Snapshot on the Offline Target System

  • Through some mechanism, you will need to get the snapshot.tar from the source to the target system. Perhaps on a USB stick, or otherwise.
  • Extract the archive on the target system (in this case, in /home/ubuntu)
    • tar xvf snapshot.tar
  • Add the local, offline source to /etc/apt/sources.list
    • echo "deb file:/home/ubuntu/archives /" | sudo tee -a /etc/apt/sources.list
  • Update the package list
    • sudo apt-get update
  • Install the packages as desired
    • sudo apt-get install byobu run-one bikeshed dotdee powernap
  • this procedure works flawlessly and is my favourite from all, but do you have a suggestion how to work around following scenario: you create this offline repository in ubuntu 12.04.1 but then ubuntu gets upgraded to 12.04.2 and this offline repository no longer works - you have to create another one for 12.04.2 (due to some changes in packaged libraries). Is there any solution how to create tar archive that will work for both 12.04.1 and 12.04.2? Commented Nov 2, 2021 at 8:11

For offline installation you will need the packages. If you are using a Debian system

  • Get the package file with the .deb file extension and use dpkg -i package_name to install it
  • Get the source tarball with the .tar.gz or .tar.bz2 file extension, then extract and install them with:

    tar -zxvf your_pack.tar.gz` or tar `-jxvf your_pack.tar.bz2
    sudo make install
    make clean        (optional, and may prevent uninstallation)

You may have problems with dependencies. You need to install all those first for a successful offline installation.


After browsing the answers on here: How can I install software or packages without Internet (offline)? , I found this code by Arnel A. Borja the most useful.

sudo apt-get install PACKAGE --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > install.sh

Anyway, here are some instructions for complete newbies. I hope that you will find them useful.

Complete download instructions for others new to Ubuntu 15.10+:

  1. Open the Terminal (shortcut CTRL + ALT +T)
  2. Navigate to the folder that you would like the package to be downloaded to by using the command:

    (Example: cd Desktop)
    Tip: You can also use the dir command to list the folders.

  3. In the code above the instructions, replace PACKAGE with the package that you wish to download.
  4. Copy and paste the modified code (shortcut CTRL + SHIFT + V) and press Enter

    Example code to download Synaptic Package Manager:
    sudo apt-get install synaptic --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > install.sh

    Example code to download VLC player:
    sudo apt-get install vlc --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > install.sh

  5. If asked, type in the root password and press Enter. (Do not panic if the characters for the password do not show. It's just a security measures.)
  6. The "install.sh" file should be now generated. All dependencies that are needed are included within the script.
  7. Now we need to run the script with this command:
    sh install.sh
  8. Wait for the files to be downloaded
  9. Afterwards, you can either use this command to install all the packages within the folder:

    sudo dpkg -i *.deb

    Or you could use a program like Synaptics to install the packages. (Synaptics: File - Add downloaded packages)
    Alternatively, you can also just double click the files. That will open the Ubuntu Software Center. Once software center is loaded, press the install button. Repeat this until all the files in the folder are installed.

  • Obs for readers: the question mentioned on the 1st paragraph is a recursion to the same question this answer was posted into.
    – Ricardo
    Commented Apr 28, 2020 at 21:11

For a system that will always be kept offline, it is usually best to use one of the robust offline package management methods presented in some of the other answers. This because they facilitate keeping already-installed packages up to date, rather than merely installing a handful of packages one time.

However, for isolated cases where you just want to quickly install packages on a system that doesn't have an Internet connection (and you have the ability to download them on another machine and bring them over), you can do so. The main complication is determining what you need, since a package often has other packages it depends on, and which must therefore be installed before, or at the same time as, the package is installed.

This answer is motivated by the duplicate question g++ in Ubuntu 14.04, and uses the case of needing to install g++ as its core example.

I emphasize that this method should not be used long-term as an alternative to something that at least facilitates automatically determining and installing needed security updates. Never connecting to a network reduces the potential for an attack considerably, but some security bugs can be exploited via data from any source.

While this method may look complex, it usually only takes a few minutes. For packages with a large number of dependencies, it may take longer. For installing metapackages that pull in a very large number of dependencies (e.g., ubuntu-desktop on a minimal system), it can take much longer to download all the necessary .deb files and this method is unlikely to be suitable.

Determining Needed Dependencies

You can simulate the installation to determine which other packages are needed to satisfy the package's dependencies. Passing the -s flag to apt-get (before you specify any action) does this.

apt-get -s install g++

I've omitted sudo, since this is just a simulation, so root privileges aren't needed.

If you actually want to install all the most common tools for building packages, rather than just g++, you might prefer:

apt-get -s install build-essential

The output (for g++) will look something like this:

NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  g++-4.8 libstdc++-4.8-dev
Suggested packages:
  g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg
The following NEW packages will be installed:
  g++ g++-4.8 libstdc++-4.8-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Inst libstdc++-4.8-dev (4.8.2-19ubuntu1 Ubuntu:14.04/trusty [amd64])
Inst g++-4.8 (4.8.2-19ubuntu1 Ubuntu:14.04/trusty [amd64])
Inst g++ (4:4.8.2-1ubuntu6 Ubuntu:14.04/trusty [amd64])
Conf libstdc++-4.8-dev (4.8.2-19ubuntu1 Ubuntu:14.04/trusty [amd64])
Conf g++-4.8 (4.8.2-19ubuntu1 Ubuntu:14.04/trusty [amd64])
Conf g++ (4:4.8.2-1ubuntu6 Ubuntu:14.04/trusty [amd64])

This says that to install g++ on my system, I need packages g++, g++-4.8, and libstdc++-4.8-dev.

Going by the results of a simulation is usually better than simply looking up a package's dependencies (or assuming that what you need is the same as the above), because:

  1. You may already have some dependencies installed.
  2. The dependencies (i.e., the other packages that a package needs to install or work) themselves may have dependencies that you don't already have installed.

Getting the Packages

Once you know what packages you need, you can download them. I suggest using Launchpad for this, because the downloads are SSL-encrypted, which helps prevent file corruption.

  • This is not just a safeguard against deliberate manipulation by a malicious party; it also helps prevent accidental file corruption, which is a far more common problem for downloaded files.
  • There's one kind it doesn't prevent: when a file downloads only partially but you think it finished.
  • Installing a package normally with apt-get or the Software Center doesn't require HTTPS because its hash is verified against a digitally signed list of hashes. If you end up putting these packages in your package cache and using apt-get to install them, that will happen.
  • But if you end up having to install the manually downloaded packages with dpkg -i, that won't be done.

You can search for a package by typing its name under Packages at https://launchpad.net/ubuntu and clicking "Find a Package." For example, searching for g++-4.8 brings you to the gcc-4.8 source package page.

Then scroll down to the codename of your Ubuntu release. You're running 14.04, so that's Trusty Tahr. Codenames for all Ubuntu releases are listed on the releases wiki page. Click the rightward-pointing triangle to view package downloads for it.

screenshot showing the rightward facing triangle with which one expands a release to see downloads for it

For some packages you may be able to expand lists of downloads from more than one pocket. You may see:

  • release, the version of a package shipped with an Ubuntu release (or available at the time of release);
  • security, security updates shipped after release;
  • updates, any updates shipped after release;
  • proposed, updates that are available to be installed, but are still in testing and not recommended for general use;
  • backports, software originating in a later Ubuntu release and rebuilt for an earlier release.

For example, here's what's available for Firefox in 14.04:

Launchpad screenshot showing expandable selections of package downloads for multiple pockets in the same release

Generally you'll want packages in security or updates if they exist, and otherwise packages in release.

Once you expand the list of packages, find the .deb file for your architecture. The debs are named name_version_architecture.deb. The most common architectures are:

  • 64-bit PC/Mac (called amd64, for both Intel and AMD processors)
  • 32-bit PC/Mac (called i386, also for both)

For example, to get the g++-4.8 package for the 64-bit version of Ubuntu, you might download g++-4.8_4.8.4-1ubuntu15_amd64.deb.

Installing the Packages

If the packages you retrieved are the same versions that apt-get's install action would've automatically retrieved and installed (if your system were network-connected), then you can put the packages in /var/cache/apt/archives and simply run that command:

sudo apt-get install g++

If this system was never connected to the Internet, then this will probably be the case when all the packages you retrieved were from the release pocket. Regardless of whether or not the system was ever connected to the Internet, this will also almost always be the case if no packages in any other pockets were shown on Launchpad. (Essentially the only situation it won't is if you installed an alpha or beta system and never updated it.)

In the specific case of installing g++, I would use apt-get.

In cases where that doesn't work or you expect it won't, install the packages by putting them in an otherwise empty folder and running:

sudo dpkg -Ri /path/to/folder

Or you can name the packages individually. This example supposes the packages are in the current directory (i.e., that you've cded to the directory containing them):

sudo dpkg -i package1.deb package2.deb ...

Unless the number of packages being installed is very small and you know the precise order in which they need to be installed for dependencies to be satisfied, it's considerably more efficient to use those methods than to manually install each package individually.


Yes. You can download the DVD iso, burn it on a DVD, and install the software from the DVD. See here CDs and DVDs can be given as source to package managers in the same way as online archives.


The first thing you could do before an offline package installation is update the repository/repositories that you need. You should for sure like an updated the Main repository (for free and officially supported software).

The applications which you are looking to install might be in some other repositories like the Universe (free but no official support), or the Restricted (non-free, officially supported), or the Multiverse (non-free, no official support) repository. So you might want one or more of these too.

So the first step in the process is to build an updated offline repository; then generate the "to-download" list and download them, and finally the insatllation. Here's how it's done: source

  1. Enter the url: http://archive.ubuntu.com/ubuntu/dists/suiteCodename where suiteCodename should be appropriately substituded say precise for Ubuntu 12.04 (Precise Pangolin) [or utopic for Ubuntu 14.10 (Utopic Unicorn)] so that you'd now be in http://archive.ubuntu.com/ubuntu/dists/precise/ or any other specific to the suite you have.

  2. Download the files Release, Release.gpg, and the Contents-????.gz file for your architecture (i.e Contents-i386.gz , assuming you architecture is i386). Save these three files in a directory/folder named after your suiteCodename (precise for Precise Pangolin).

  3. Next you'll have to do the following for each of the repositories (among Main, Universe, Restricted, Multiverse) you want.

    a. go to the target repository directory eg. main and then to the architecture directory eg. binary-i386 so that you'd be in http://archive.ubuntu.com/ubuntu/dists/suiteCodename/repositoryName/binary-????/

    b. download the contents Packages.bz2, Packages.gz, Release and save them in a directory named after the repositoryName eg. main and place this directory in the previously created suiteCodename directory.

    c. repeat a. and b. for each of the repositories you want.

  4. Finally you should have a structure something like this:

     ├── Contents-i386.gz
     ├── main
     │   └── binary-i386
     │       ├── Packages.bz2
     │       ├── Packages.gz
     │       └── Release.txt
     ├── Release.gpg
     ├── Release.txt
     └── universe
         └── binary-i386
             ├── Packages.bz2
             ├── Packages.gz
             └── Release.txt

    (assuming your suiteCodename = precise, architecture is i386, and you need main and universe repositories)

  5. Next, after having the updated repositories downloaded, you'd place the downloaded files arranged in a proper structure (as shown above) in a directory of the target offline computer. Save the directory structure precise in a folder named offlineRepository/dists/precise in your user home (~/offlineRepository/dists/precise) or anywhere else (/home/offlineRepository/dists/precise using sudo previleges in a terminal or with Nautilus file manager started with gksu nautilus; also make sure you have the right permissions for the copied structure). Your offline repository information would then be ready for use.

  6. Add the local repository in your sources list. With Ubuntu Software Centre, go to Edit -> Software Sources ... -> Other Software -> Add... and then in the field for APT line, add: deb file:///home/offlineRepository precise main universe and click Add Source. Be sure you modify the line as to your directory/file structure and suite. Then reload the packages or run sudo apt-get update in a terminal. snap1

  7. Now with updated (and probably newly added repositories too), you can dump the list of urls for the packages and dependencies.

    I borrow the following line of code from one of the previous askUbuntu post:

    sudo apt-get install packageName --print-uris | grep -o '\'http.*\' | tr "\'" " " > /tmp/package-list.txt

    eg. to install Synaptic Package Manager:

    sudo apt-get install synaptic --print-uris | grep -o '\'http.*\' | tr "\'" " " > /tmp/package-list.txt

    (You can also generate update lists in a similar way.)

    The generated list can be used to download the package and the entire dependencies on an online computer. Create a script to download or use the list for batch download in some download managers. (Also note the text file generated uses Unix/Linux line ending, and which you might want to change to Windows.) There used to be an easier way for this when Synaptic Package Manager was a default application in Ubuntu.

  8. Finally in the target system, you can install the packages with dpkg or using any other way.

Getting the updated package database including the security updates

The following structure, in addition to above explanation, should give you the idea:

└── dists
    ├── precise
    │   ├── Contents-i386.gz
    │   ├── main
    │   │   └── binary-i386
    │   │       ├── Packages.bz2
    │   │       ├── Packages.gz
    │   │       └── Release.txt
    │   ├── Release.gpg
    │   ├── Release.txt
    │   └── universe
    │       └── binary-i386
    │           ├── Packages.bz2
    │           ├── Packages.gz
    │           └── Release.txt
    ├── precise-security
    │   ├── Contents-i386.gz
    │   ├── main
    │   │   └── binary-i386
    │   │       ├── Packages.bz2
    │   │       ├── Packages.gz
    │   │       └── Release
    │   ├── Release
    │   ├── Release.gpg
    │   └── universe
    │       └── binary-i386
    │           ├── Packages.bz2
    │           ├── Packages.gz
    │           └── Release
    └── precise-updates
        ├── Contents-i386.gz
        ├── main
        │   └── binary-i386
        │       ├── Packages.bz2
        │       ├── Packages.gz
        │       └── Release
        ├── Release
        ├── Release.gpg
        └── universe
            └── binary-i386
                ├── Packages.bz2
                ├── Packages.gz
                └── Release

I have a small python script that can be run on Windows that parses the ubuntu package web site to find the dependency tree and download all needed packages + doing checksum verification.

This might obviously download more than needed, but was the simplest solution for me.


All downloaded packages can then be installed with dpkg -i E pkg\*. It avoids reinstallation of packages that are already installed.


usage: ubuntu-deps.py [-h] [-a ARCH] [-r RELEASE] [-m MIRROR] [-f FALLBACK] [-d DIRECTORY] dep [dep ...]

Download ubuntu dependencies

positional arguments:
  dep                                  The main/top package

optional arguments:
  -h, --help                           show this help message and exit
  -a ARCH, --arch ARCH                 The architecture to use (default: amd64)
  -r RELEASE, --release RELEASE        Ubuntu release (default: trusty)
  -m MIRROR, --mirror MIRROR           Mirror to use for download (default: http://no.archive.ubuntu.com/)
  -f FALLBACK, --fallback FALLBACK     Mirror to use when main mirror is not found (default:
  -d DIRECTORY, --directory DIRECTORY  Target directory (default: pkg)

This question is a bit old so an answer at this time may be redundant, but perhaps you could also try using dpkg-offline. Install bzr, then:

bzr branch lp:dpkg-offline

there's a tutorial and a readme file included in there.

Assuming you want to install git on an Ubuntu 14.04 amd64 system, even if your system is e.g. 12.04 i386, you can:

  • download the ubuntu-14.04-desktop-amd64.iso image
  • Run dpkg-offline ubuntu-14.04-desktop-amd64.iso git
  • You'll obtain a tar.gz which you can transport to the target system, it will contain the seed package (git) and all its dependencies. It also includes a helper script to add a local repository, so you can use apt-get to install your packages.

dpkg-offline will work with any Ubuntu desktop version from 10.04 onwards (I haven't tested with older versions but they should also work), and with any Ubuntu server version from 12.10 onwards. It should also work with amd64, i386 and armhf images regardless of the host architecture. Again, I haven't tested with arm64 or powerpc/ppc64el but they may also work.

Disclaimer: I wrote dpkg-offline.

  • This is great, however I think it's overkill to download the whole distro to use the script, wish it could work by only specifing the required packages and target distro Commented Jun 12, 2017 at 18:54
  • Really cool solution
    – Hao
    Commented Jun 2, 2022 at 7:00

This is not a fully detailed answer, but at a high level you could:

  1. get the desired .deb pkgs (and create a list of them) (include packages they depend on that are not already installed)
  2. create an apt archive that contains them
  3. copy the apt archive to a CD or USB
  4. insert the CD or USB into the target system
  5. configure apt on the target system to include the CD or USB apt archive as a source
  6. install the packages from your list with apt-get install (list of pkgs)

I suggest to customize Live CDs and install them.

You also can download the files on http://packages.ubuntu.com/filename, but then you have to pay attention to the dependencies, too.

  • (Originally this was an answer to a slightly different question which became merged with that one.)
    – Jakob
    Commented Jul 11, 2012 at 20:35
  • Time killing job
    – totti
    Commented May 22, 2013 at 8:40

Another possibility is to use remastersys. This tool allows you to make an iso image from your own system and after creating a bootable usb stick via unetbootin you can install a customized system to as many computers you want.

  • But how to update them afterwards? Commented Jul 22, 2012 at 3:23

I have a couple of simple suggestions. You can go to the library. Look in the computer section for the operating system that you want, some of the books have DVD's inside of them. Also, if you want the most up to date operating system, I would reccomend this website where you can purchase a DVD for a nominal fee. www.ubuntu.com/download/desktop.


Some packages are installed on the install usb-stick. I uninstalled network-manager and want to install it again.

Thus I got the stick I installed the operating system from (Lubuntu 17.10). It was /dev/sdb

Mount the stick at a path (/tmp/mnt in my case)

mkdir /tmp/mnt
sudo mount /dev/sdb1 /tmp/mnt

Then, I edit /etc/apt/sources.list to only contain

deb file:///tmp/mnt/ main universe

Then, I do

sudo apt-get update

And I can install network-manager.

Note: This might not be the answer to the question above but to the question I had when looking up this one.

  • 1
    You should probably back up sources.list and then restore it as well. Commented Nov 17, 2017 at 8:43

Connect your smartphone by USB cable and use it as an internet modem to install everything you needed

I was in the situation when the Wi-Fi module was not working on laptop. I tried some solutions, failed and then miraculously realized that there is a much easier solution available almost to anybody. You just need USB cable and a smartphone. It works both for Android and IOS. In Anroid you can see in notifications that smartphone is connected to the laptop. Tap on notification and switch to modem mode. It works on Ubuntu out of the box and allows you to easily get internet connection and install what you need

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .