In this post i am going to explain how to backup all installed programs in your debian based distro like ubuntu.This can be done by using special utility dpkg-repack,dpkg-repack creates a .deb file out of a Debian package that has already been installed on your system.
If any changes have been made to the package while it was unpacked (ie,conffiles files in /etc modified), the new package will inherit the changes. (There are exceptions to this, including changes to configura‐tion files that are not conffiles, including those managed by ucf).
This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system, but no longer available elsewhere.
This utility is very usefull in context when your friend wants to install new softwares in his debian based distro,and fortunately you are having all those applications already installed on your ubuntu box.In these cases you can simply make use of this utility.
Following are the list of commands which does it all for you:
STEP-1:But first you have to install ‘dpkg-repack’ on your system.
sudo apt-get install dpkg-repack fakeroot
this will install dpkg-repack on your system.
use of fakeroot command emulate the given command as to be having the root previlages,but it doesn’t having the root previlages in pactice.
STEP-2:Now, but before using this utility you need to purge all the uninstalled program packages using following command this is usefull because if there are some uninstalled packages on your system then dpkg-repack will not able to backup the packages and it will terminate.
so fire the following command this will simply list you all the packages uninstalled from your system,
dpkg – -get-selections | grep deinstall
STEP-3:Now purge all the packages listed by entering the above command,
sudo apt-get purge `dpkg – -get-selections | grep deinstall | cut -f1`
The above command will simply purge all the uninstalled packages from your system.
STEP-4:Now create a directory of any name in your home directory.
Now, cd into this directory.
STEP-5:Now fire the below command to backup all the packages installed on your system.
fakeroot -u dpkg-repack `dpkg – -get-selections | grep install | cut -f1`
Now,this command will simply creates .deb files of all packages installed on your system in your current directory,for more details on this utility check man dpkg-repack.
STEP-6:Now it will take few minutes or even few hours depending on amount of packages installed on your system.But at the end the directory will contain all the .deb files installed on your system.
Now,you can take these all .deb files on CD/DVD and then make use of it by simply firing the following command.
sudo dpkg -i *.deb
this will install all the pakages in your .deb files on your ubuntu system.
NOTE:There might be some dependancy problem could arise while installing all the packages on the new system.But overall this utility or method is very usefull and simple to do the job.
Thank you for reading this post……