- About Us
Have you ever wished you had access to your Linux distribution's online package repositories when you didn't have access to the Internet, or when your access was slow and unreliable? The recently released APTonCD utility allows users of Debian-based distributions to create backup CDs and DVDs of as many Debian packages as they can download. Used in conjunction with the apt-mirror utility, APTonCD can back up an entire package repository, spanning several CDs or DVDs.
APTonCD is in the repositories of Ubuntu Feisty and Debian testing and unstable, but if it's not available for your distribution, you can download it from SourceForge.net.
By default, APTonCD is configured to help you make CDs of whatever packages are in your APT cache at the moment; you select which packages from the cache are to be included on the CD. Your APT cache works something like your Web browser's history cache. When you install new packages with apt-get or Synaptic, the downloaded package files reside in your cache until you clean it with the command apt-get clean.
The trick to using APTonCD is to have the packages you want in your cache. One way to do this is simply to install the packages with the command
apt-get install package-name. If a package you're interested in backing up to CD is already installed on your system, you can use apt-get's
-d option to download the package file and add it to your cache without installing it:
apt-get -d install package-name
Alternately, perhaps you need to put a particular package in the cache, along with all its dependencies that are not usually included in your distribution. You can use
apt-get autoremove package-name to uninstall the package and remove all of the dependencies that were automatically downloaded when you installed it. Then, using the install command again will restore all these packages, and the package files will once again reside in your cache. The following command will perform both steps of this operation without prompting you to confirm each one:
apt-get -y autoremove package-name && apt-get -y install package-name
Once your cache is arranged as you need it, run APTonCD. From here, the process of making a CD is practically self-explanatory. Click Create APTonCD. Click Options, select a medium (CD or DVD), and a name for the .iso file, and you're ready. After you click OK, APTonCD will build the .iso file or files. If you're running the GNOME desktop and have Nautilus CD-burning support installed, APTonCD will offer to burn the .iso for you.
Creating a CD or DVD of an entire repository is trickier.
First, you must download all the packages from the repository. Apt-mirror offers a convenient way to accomplish this difficult task; it continuously downloads as many as 20 packages at once until it has copied an entire repository to the hard disk.
To get started, install the package apt-mirror, which is available in the current Debian stable, and has been in Ubuntu since version 6.10 (Edgy Eft). If it isn't available for your distribution, the apt-mirror Web site has installation instructions.
Edit the configuration file, /etc/apt/mirror.list, as root. The file is divided into two sections, the first containing default options that can in almost all cases be left alone (read them over to see whether you need to alter them), and the second listing Debian package repositories, in the same style as /etc/apt/sources.list:
deb http://repository.address distribution-version section1 section2 ... sectionN
For example, a line that includes Ubuntu Feisty's main and restricted repositories would read:
deb http://archive.ubuntu.com/ubuntu feisty main restricted
When apt-mirror is run, it will download all the repositories listed to /var/spool/apt-mirror. Whether you choose to list one or all of your distribution's repositories is up to you. In any case, it's easy to copy lines or whole sections from /etc/apt/sources.list and add them to mirror.list, perhaps commenting out what you don't need with judicious use of the # operator.
Run the command
apt-mirror as root. (You'll probably want to run a
sudo su command first, since you must run more commands as root once apt-mirror is finished.) Be warned: large repositories, such as Ubuntu main, may take hours to download, and apt-mirror gives little in the way of progress indication.
Since it makes an exact copy of your distribution's repositories, apt-mirror disperses the packages through a complicated directory structure. You'll want to move all the downloaded packages into the directory of your APT cache, so that they will be automatically imported into APTonCD. To do that, run these commands, as root:
cd /var/spool/apt-mirror # move to the directory containing the mirror
find mirror/ -iname *.deb | xargs mv -t /var/cache/apt/archives # find package files; move each one into cache directory
Finally, run APTonCD as before (it isn't necessary to run it as root), and all the packages that you configured apt-mirror to download will show up.
The payoff, of course, is being able to install packages from your CD or DVD with apt-get or Synaptic. To do this, you must add the CD to your APT sources -- and APTonCD can do that too. Simply insert the disc you burned, open APTonCD, and click the Restore tab. Click Add..., and when prompted, click OK. This method will allow you to add several discs in succession, if necessary.
Now you can apt-get install to your heart's content to install packages, whether you are online or off.