Step 1: Install the apt-move packageApt-move is a tool for creating a debian package repository file structure out of packages that have been downloaded to /var/cache/apt/archives. Installed packages are downloded there by apt for installation. Apt-move will create this local repository in /mirrors/debian, by default.
sudo apt-get install apt-move(Or just use synaptic) You need to enable the universe repository. See AddingRepositoriesHowto
I change the setting in /etc/apt-move.conf from
COPYONLY=noto
COPYONLY=yesSo that apt-move doesn't delete file from your /var/cache/apt/archives/.
Step 2: Select the packages you want to put on the cdIn this example, we only want to put freshly downloaded packages. We don't want to put old packages or packages that exist in Ubuntu CD.
First, we clean up the /var/cache/apt/archives from old packages.
sudo apt-get autocleanNext, we delete packages that exists in the Ubuntu CD. Put your Ubuntu CD on CD-ROM Drive, mount it (if it not automatically mounted) then run the following:
for f in `find /media/cdrom/pool/ -name '*.deb' -printf %f\\n`do if [ -f /var/cache/apt/archives/$f ]; then sudo rm -v /var/cache/apt/archives/$f fidoneStep 3: Run apt move to create the archive structureMake sure you have enough disk space first.
Because /mirrors/debian is root owned we must become root to make the steps easier.
sudo -sAll the following command run as root. First we clean-up previous mirrors (if exists) then we run apt-move.
rm -rf /mirrors/debianapt-move -d breezy updateBecause ubuntu repository structure, not all packages are inserted into the Packages.gz file by apt-move. We must remake Packages.gz with the help of apt-ftparchive.
cd /mirrors/debianapt-ftparchive packages pool/main/ \ | gzip -9c > dists/breezy/main/binary-i386/Packages.gzapt-ftparchive packages pool/restricted/ \ | gzip -9c > dists/breezy/restricted/binary-i386/Packages.gzWe must also remake Release file, to do this we must make an apt configuration file named ~/myapt.conf it contents is like this
APT::FTPArchive::Release {Origin "APT-Move";Label "APT-Move";Suite "breezy";Codename "breezy";Architectures "i386";Components "main restricted";Description "Ubuntu Updates CD";};Next, run the following commands:
rm dists/breezy/Releaseapt-ftparchive -c ~/myapt.conf release dists/breezy/ > Releasemv Release dists/breezy/ReleaseThen we need to make Release.gpg, to make it you must already have your GPGKey set and ready to sign.
gpg -bao dists/breezy/Release.gpg dists/breezy/ReleaseNext, we delete unwanted .apt-move directory
rm -rf .apt-moveYou can identify the cd by making a .disk directory and making an info file in it.
mkdir .diskecho Ubuntu-Updates `date +%Y-%m-%d` > .disk/infoThen we need to put our public keys in it.
gpg --export -a "Your Name" > public.keyOffcourse change Your Name with the name that you use in your PGP.
Thats' all
exit
Step 4: Burn the cdCopy the contents of what is contained in /mirrors/debian to a cd.
For example you could make an iso by following command:
mkisofs -r -A "Ubuntu Updates `date +%Y%m%d`" -o ubuntu-updates.iso \ /mirrors/debianBefore you could use the CD, you need to add our GPG key to apt GPG keys. Put the CD on CD-ROM Drive, mount it (if it not automatically mounted) then run the following:
apt-key add /cdrom/public.keyThen you could use the CD like any other Ubuntu CD. On a non-networked ubuntu machine, you can run synaptic, insert the cd and go into Synaptic -> Edit -> Add Cdrom and it will add the contents of the cd to your repositories.
You can also do it from the command-line with
sudo apt-cdrom add