Monday, May 03, 2010

Transfer your Ubuntu application packages to a clean install

Transfer your packages to a clean install
5/01/2010 by Tyler James

With all the new installs of Ubuntu and clean upgrades going on right now, I thought I'd point out a few great ways to package up the apps you have currently and prepare them for a clean Ubuntu install. This can be useful if you're installing the same applications on a number of computers, or simply know exactly all of the programs you need and want to preserve this for a clean install. There's two great ways to do this, one which works well on computers with an internet connection, and one which works great when you don't have a connection.

Method #1
The first method works off of a little command line utility called Dpkg-Repack, which can be used to repackage any apps installed from apt into a deb, which can then be installed cleanly anywhere. With a little terminal-fu, this can be used to package up everything you've installed from the Software Center or apt into a giant deb.

We do this with three simple commands:

* sudo apt-get install dpkg-repack fakeroot
* mkdir ~/dpkg-repack; cd ~/dpkg-repack
* fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`

This installs the program along with fakeroot, which is used to allow selecting without conflicts of permissions. Then the second command creates a directory to store the deb in, and then lastly the third command which will take some time to complete will package up the installed applications into the big huge deb. Theres now a directory in the home folder with the deb.

Now, to reinstall this whole set of applications, we move the whole thing over to a usb drive and copy it over to the new computer or new install, and run:

sudo dpkg -i *.deb
This will install everything packaged up, even without an internet connection!

Method #2
The second way of doing this doesn't create a large package, but rather a small list of apps that can be used to direct your computer to what to reinstall. This requires no installation of anything to actually run the command, but does require an internet connection. Now, this creates a list of everything, even standard system stuff, so don't get freaked out if theres stuff you've never seen on it before. Any overlap with standard stuff works itself out, it won't reinstall or duplicate things. The really nice thing about this method is that you can manually add or subtract stuff from the list.

To do this, run this command:

* sudo dpkg --get-selections > installedsoftware

Then, all you have to do is copy that folder over to the home folder of the next computer and/or after the clean install, and then run:

* sudo dpkg --set-selections < installedsoftware

Remember, this second method requires an internet connection.


Blog Archive