Random thoughts of a warped mind…

February 17, 2011

How to sync installed packages on Ubuntu

Filed under: All,Linux — Srinivas @ 17:26

Heres one common scenario you may have come across… Lets say you build a Ubuntu dev machine to test something and are satisfied with it and now want to build a prod box with the same packages without having to do it by hand. If you used a Virtual image, then great but what if you did’nt?

On the dev machine, generate the list of packages that were installed:

dpkg –get-selections > /tmp/installed-software.txt

Copy over installed-software.txt to the target machine and:

dpkg –set-selections < installed-software.txt

Make sure you have dselect installed – if you dont “apt-get install dselect” first. Then:


Now within dselect , go ahead and Update package list to install all the packages from the source text file and let apt do its magic.

(This of course assumes you installed all the packages on the source machine from the online repositories, make sure to ensure you apt sources.list on target machine is set to be same as the source).

But what if you used fedora/centos or a redhat derivative? Simple – “rpm -qa > /tmp/rpmlist.txt” to generate the rpm list on source side. Then use yum or rpm on the target box to install the same set of packages on it.


If your “source” box was at Amazon EC2 and your target box is a newly spun instance at Rackspace, DO NOT blindly try to sync package lists. The package list generated from a Ubuntu box at EC2 will contain several EC2 specific package entries. Using this list (unfiltered) on a Rackspace Ubuntu instance will pretty much make your Rackspace instance unbootable!!! (I cant recall the exact package names but I do not understand why EC2 specific packages were available on Rackspaces Ubuntu repository… TODO: Add more info on this when I find time to do this).

Powered by WordPress