Hail Ubuntu!
Its been a long time since i blogged! Now i just could not stop myself from posting this.
In this blog I am trying explain how to back up your updates on Ubuntu. Its a known fact that the install CD of Ubuntu is very skeletal. One needs to connect to the net for every complete (by this i mean the programmers' choice of packages)installation. In this blog let me tell some not so unknown method to back up the updates.
Let me add a note here! WARNING : Using this method you can only backup those packages that you have downloaded and installed!! Hell!! you cant backup something you don't have right! ;)
The CD created using the procedure mentioned below can be used as a repository to install the packages in any other machine using Synaptic or apt-cdrom.
I referred the contents in https://help.ubuntu.com/community/AptMoveHowto while writing this blog. I am not putting in anything new!! Its just an attempt to make the content reachable to everyone.
I am going to make use of the same example here too!! I definitely works with a full featured installation.
There are two steps involved in the process of creating the repository CD.
1 : Creating the GPG key for the CD,
2 : Creating the CD from the downloaded packages.
Creating the GPG key
(I am going to update this section with some much simpler procedure, once i am sure it works out!)
Using GnuPG
This will lead to a selection screen with the following options
The default choice (1) is preferred, since the others cannot be used for encryption.
A keysize of 2048 (which is the default) is also a good choice.
Most people make their keys valid until infinity, which is the default option. If you do this don't forget to revoke the key when you no longer use it (see later). Hit Y and proceed.
Make sure that the name on the key matches the name in your passport, or other government issued photo-identification! You can add extra e-mail addresses to the key later.
Type O to create your key.
You will be asked for your passphrase twice. Usually, a short sentence or phrase that isn't easy to guess can be used.
IMPORTANT - Forgetting your passphrase will result in your key being useless. Remember this passphrase carefully, there is no way to recover it when it's lost. After you type your passphrase twice, the key will be generated. Please follow the instructions on the screen till you reach a screen similiar to the one below.
The key-id is D8FC66D2 (yours will be different).
Tip: It's probably a good idea to set this key as default in your .bashrc, so that applications using GPG can automatically use your key. Do this by entering the line below in your ~/.bashrc. Please note that will be sourced only during your next session, unless you source it manually.
Now restart the gpg-agent and source your .bashrc again:
Revocation Certificate
A revocation certificate must be generated to revoke your public key if your private key has been compromised in any way. You can create a revocation certificate by doing
Creating the repository CD
U will need to install the apt-move package
sudo aptitude install apt-move
now you have to change the setting in /etc/apt-move.conf to allow retention of files in the
/var/cache/apt/archives/ folder.
Find the line
COPYONLY=no
and change it to
COPYONLY=yes
Select the packages that should be added to the CD.
To add only the packages that were downloaded and install , we shall clean the /var/cache/apt/archives/
folder off the old packages.
sudo aptitude autoclean
Now run apt-move to create the archive structure
WARNING : Make sure you have enough disk space!!
/mirrors/debian is root owned. Becoming root makes the steps easier. Avoids typing a lot of sudo :)
sudo -s
All 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 dapper update
Because 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/debian
apt-ftparchive packages pool/main/ \
| gzip -9c > dists/dapper/main/binary-i386/Packages.gz
apt-ftparchive packages pool/restricted/ \
| gzip -9c > dists/dapper/restricted/binary-i386/Packages.gz
APT::FTPArchive::Release {Next, run the following commands:
Origin "APT-Move";
Label "APT-Move";
Suite "dapper";
Codename "dapper";
Architectures "i386";
Components "main restricted";
Description "Ubuntu Updates CD";
};
rm dists/dapper/Release
apt-ftparchive -c ~/myapt.conf release dists/dapper/ > Release
mv Release dists/dapper/
Next make a Release.gpg, to make it you must already have your GPG Key (explained earliet) set and ready to sign.gpg -bao dists/dapper/Release.gpg dists/dapper/Releaserm -rf .apt-move
Delete unwanted .apt-move directory
You can identify the CD by making a .disk directory and making an info file in it. (Suggested for first timers)
mkdir .disk
echo Ubuntu-Updates `date +%Y-%m-%d` > .disk/info
Then put the public keys in it.
gpg --export -a> public.key to be replaced with the name that you use in your PGP.
And thats the end of the task. exit the root account.
exit
Time to burn the CD :)
You could make an iso by following command:mkisofs -r -A "Ubuntu Updates `date +%Y%m%d`" -o ubuntu-updates.iso \Before 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:
/mirrors/debian
apt-key add /cdrom/public.key
Use this 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
Hope you folks can get this thing working without hassle!!!
Cheers
Akshay
Lin-Aks
BMSCE
No comments:
Post a Comment