The following instructions demonstrate how to manually download packages and their dependencies for an offline machine (using another machine connected to the internet).

Generating a package install list

On the machine that you wish to install a package (or set of packages) or perform an upgrade on, complete the following steps.

With Synaptic

Within synaptic check the desired packages to be installed or select Edit > Mark all upgrades to perform an upgrade and select File > Generate package download script. Save the file as /tmp/apt-get-list

If the machine you are going to use to download packages runs Microsoft Windows, go to step 2.

If the other machine you are downloading packages on is unix or linux with wget installed (this includes ubuntu and other major distributions of linux), save the file onto a portable device such as a USB thumb drive, floppy, CD-ROM, Network Share, etc and run it on the other machine as shown below; when finished go to step 4.

# substitute the right path and filename here.
mkdir -p ~/deb_files && cd ~/deb_files && sh /path/to/download-script

With apt-get

If you do not have synaptic installed, you can use apt-get.

# this step is complete optional and requires you to have a connection to the internet
# use it if you wish to upgrade or get the latest packages.
sudo apt-get update

# If you wish to install a set of packages
apt-get install --print-uris package_name_1 package_name_2 package_name_etc | tee /tmp/apt-get-list

# Or if you wish to upgrade all packages
apt-get upgrade --print-uris package_name | tee /tmp/apt-get-list

Generating a URI list

In the previous step, we saved the package list as /tmp/apt-get-list, if you saved it differently, substitute the right path and filename here.

perl -nle 'print $1 if /\W?(ftp|http.*?)\W?(?:\s|\z)/' < /tmp/apt-get-list > uri_list

Now you can copy this file uri_list to the other machine using a memory stick, network, floppy, etc.

Downloading packages on another machine

We use wget here to download files here, your operating system and setup might not have wget in which case you could use something like curl, lynx, lwp-download, etc.

Downloading packages on a unix-like machine with wget

Most popular unix-like operating systems provide wget, these include linux, unix, cygwin, etc. If you don't have wget installed, install it before running this command. Please consult your Operating System manual, Systems Administrator or Support Channel if you require assistance.

mkdir -p ~/deb_files && cd ~/deb_files
while read uri; do wget "$uri"; done < /path/to/uri_list

Downloading packages on Microsoft Windows with wget

If you don't have wget installed, you can get a binary executable here gnuwin32

Open up a command prompt by navigating to Start -> Run then typing cmd.exe and clicking Ok. Note the path to the uri_list file, you must get it right for the following commands to work. You can drag the uri_list file in Windows Explorer into your Command Prompt window to get the complete and correct path.

REM substitute the right path and filenames here
mkdir deb_files && cd deb_files
for /f %g in (\path\to\uri_list) do (wget %g)

Now copy the deb_files folder back to your machine, but be sure to verify that the files have actually been downloaded first.

Installing the packages

After you have copied the deb_files folder back to your machine, you can install them this way

# substitute the right path names here
cd /path/to/deb_files/ && sudo dpkg -i *.deb

OfflinePackageDownload (last edited 2009-12-18 20:35:06 by 77-21-62-108-dynip)