Debian without internet

Q I am new to Linux and am currently learning the basics using a Debian-based system, but have problems installing new programs. I do not have internet access at home, but use the computers at the local public library (which run on a Windows system) and use a memory stick to transfer data to my computer. I have tried installing Linux programs I have downloaded, using the package manager, but this doesn't seem to work. I also have the same problem when trying to install programs from DVDs. I have looked through the books on Linux, but cannot find anything to help. Could you possibly tell me how to proceed to install a program saved on memory stick or from a DVD?

A Debian's dpkg package manager, which is the low-level program behind graphical managers like Synaptic, is able to install directly from package files. To do this, use the following command from a terminal

sudo dpkg --install somepackage-1.2.3.deb

If you are using Ubuntu or one of its derivatives, or

su
dpkg --install somepackage-1.2.3.deb

for any other Debian-based distro. It is possible to install several packages at once, either by giving all their names on the command line or by passing the name of the directory containing them, as in

sudo dpkg --install --recursive /media/usbstick

However, you still need to know which files to download, so there is another option. Run Synaptic, mark the packages you wish to install and use the File > Generate Package Download Script menu item. This creates a shell script to download the files you need. Although you cannot use this script directly on most Windows computers, you can copy and paste the URLs from the file into your download software and put the downloaded files on your USB stick. Then plug it back into your home computer, run Synaptic and select the File > Add Downloaded Packages menu item, go to the directory containing the files you downloaded, click Open and Synaptic will install them for you. Updating the lists of available programs is a little more tricky, but possible. Look in /etc/apt/sources.list and you will see a line like this for each source

deb http://gb.archive.ubuntu.com/ubuntu/ gutsy main restricted

Using this example, browse to http://gb.archive.ubuntu.com/ubuntu/dists/gutsyand go into the Main and Restricted directories. In each of those you will find a binary-i386 directory; download the Packages.bz2 and Release files in there and save them using the full path with each / changed to a _, as in:

gb.archive.ubuntu.com_ubuntu_dists_gutsy_binary-i386_Packages.bz2

Copy each of these to your USB stick. Take it home and copy all the files into /var/lib/apt/lists/, as root, and unpack the .bz2 files. It is easiest to do this from a terminal with

cd /var/lib/apt/lists/
sudo cp /media/usbstick/*.bz2 .
sudo bunzip2 *.bz2

Now fire up Synaptic and it should have all the latest versions available. It's a bit of a fiddle, but the system was really designed for use with an internet connection.

Back to the list