How to make your own package CD for offline use

June 26, 2005
If you can't use the DVD images for some reason or want to help a friend with low internet bandwidth, here's a quick'n'dirty way to make your own transportable package CD:
  1. Download all needed packages.
  2. Put them all in one directory.
  3. Open a terminal window, cd to the directory.
  4. Enter the following command :
    $ dpkg-scanpackages . /dev/null | gzip > Packages.gz
  5. Burn the directory on CD.
You can later add the CD as a package source with the command:
$ sudo apt-cdrom add
The 'add' option is used to add a new disc to the source list. It will unmount the CDROM device, prompt for a disk to be inserted and then proceed to scan it and copy the index files. If the disk does not have a proper disk directory structure, you will be prompted for a descriptive title. APT uses a CDROM ID to track which disc is currently in the drive and maintains a database of these IDs in /var/lib/apt/cdroms.list .
Note: This tip is specific to Ubuntu Linux but can be used for other debian based distros too.


  • It would be intersting an how to do the some thing via usb-pen. Maybe just replacing the last line with something like:
    $ sudo apt-sdb add

  • Simon

    thats a good guess, but apt-cdrom is a prebuilt software program and if you typed anything other than 'cdrom' you would get back an "unknown command" message

  • H4LFL1NG

    I just started using CentOS4 distro as my second linux experience(suse9). And I just fond your site via and you have helped me out so much with this article and many others on your site. Awesome job. :P

  • Kamalakar Agashe

    Could you please tell me how to make gpg key for this kind of CD?