Today I got a new VPS… well great but now I need to install a bunch of new packages and libraries and helper apps. how do I remember it all? did I have python 2.6 or 2.7? not to mention which boost libs did I install? well here.s a couple of ways to deal with this issue of whats on my installed package list.
Using dkpg and apt-get
dpkg –get-selections > selections.txt
Scp / email / copy to USB or copy it bit by bit, whatever floats your boat. Move to new machine.
dpkg –set-selections < selections.txt
voilà it should be ok. but there’s a lot of clutter, like libraries and dependencies that were needed on old machine and might not be needed again. so how to find a cleaned up list? or alteast one that shows the automated installed? there’s always aptitude its simpler in syntax and better imho
aptitude search '~i'
which gives you aresult of all your packages like :
i udev – /dev/ and hotplug management daemon
i A unattended-upgrades – automatic installation of security upgrades
i upstart – event-based init daemon
i A usbutils – Linux USB utilities
i util-linux – Miscellaneous system utilities
i vim – Vi IMproved – enhanced vi editor
i vim-common – Vi IMproved – Common files
i vim-runtime – Vi IMproved – Runtime files
i wget – retrieves files from the web
This of course scrolls all the packages past your view very quickly and can be …. hard on those of us that cant read 10000 words per minute. You can always output the results to a text file, note in my example I’m using the date command to insert current date and time into the file name, you can run this with a cron job to have a snapshot of your packages at a given time.
aptitude search '~i' > installed_packages_$(date +%F_%R).txt
Or if you just want a temp text file you can output to less or vim the same way.
aptitude search '~i' | less aptitude search '~i' | vim
and if you want you can even grep / search / parse it on the fly like so
aptitude search '~i' | grep -i "X11"
i A libxpm4 – X11 pixmap library
i A libxrandr2 – X11 RandR extension library
i A libxss1 – X11 Screen Saver extension library
i A libxt6 – X11 toolkit intrinsics library
i A libxtst6 – X11 Testing — Record extension library
i A libxv1 – X11 Video extension library
i A libxxf86dga1 – X11 Direct Graphics Access extension libra
i A libxxf86vm1 – X11 XFree86 video mode extension library
i A tk – Toolkit for Tcl and X11 (default version)
i A tk8.6 – Tk toolkit for Tcl and X11 v8.6 – windowin
i A x11-common – X Window System (X.Org) infrastructure
i A x11-utils – X11 utilities
questions? comments? don’t hesitate to ask!