Recently I needed to setup three almost identical web boxes. First of all I installed all three boxes with a base install of Ubuntu 10.04 server. I then installed all the required packages on one box and started looking for a way to replicate the installed packages on the other boxes.
I had a Google around and did not manage to find a way to do it so I decided to come up with a method by myself.
On the box where you have all your installed packages do
dpkg --list | grep "^ii" | cut -f3 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' > installedOnSystem01
if you check the outputted file it should look something like this
adduser apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apg apt apt-utils aptitude base-files base-passwd bash bash-completion ...
once you know the file is ok, copy it to your second system using your preferred method for example scp
scp installedOnSystem01 [email protected]:
then on the second system run the apt-get command in simulation mode
sudo apt-get -s install `cat installedOnSystem01`
this should give you output like this
... 0 upgraded, 30 newly installed, 0 to remove and 6 not upgraded. ...
if this looks ok remove the `-s` and run the command again to install your packages.
That’s it job done, the systems should now have the same installed packages. If anyone has any questions or can offer a way to shorten the process please leave a comment.