In order to take the backup of all the packages I installed in my Ubuntu system, I wanted to make a portable DVD that I can use as a repository having all the packages I downloaded. After reinstalling Ubuntu, I should only insert that CD-ROM and issue the command :
sudo apt-cdrom add
This will automatically install all the packages from the CD-ROM Repository into the system and the best part – It will take care of all the dependencies by itself !! [:)]. But if you try to manually burn all the packages right from where they are stored /var/cache/apt/archives into the removable media, then when you’re reinstalling those packages , it will push you into the dependencies hell, where you will be irritated to death !
So after much googling, I was able to find out the proper way of making a Repository CD in Ubuntu. So here it goes :
1) The first thing you have to do is to become root, because all the below steps will require you to have root privileges.
To become root for this session, issue the following command :
sudo -s -H
2) Next step is to install the package apt-move. It is available in the Universe Repository. Since you’re root already, you won’t have to use sudo anymore. If you are connected to internet, run :
install apt-get apt-move
3) Now change the setting in the configuration file of apt-move located in /etc/apt-move.conf . Open it and look for COPYONLY=no and make it to COPYONLY=yes. You can change more settings in the file as you want it, but in most cases, that won’t be necessary. This change was important because if you miss to do so, then while creating the CD-Repo , it will delete all the packages from /var/cache/apt/archives. And that is not you want. NOTE : Making the above changes will require you to have root privileges. You can use vim or nano from the shell itself.
4) Now this is the time to select all the packages you want to put into your own RepoCD.By default, if you don’t do anything, all the packages inside the folder /var/cache/apt/archives will be archived. But if you want to exclude some of them, then simply delete them from the folder /var/cache/apt/archives . Don’t worry, you can safely delete them. Its just a cache of all the packages. They’re not important anymore as their binaries have already been integrated with your system.