Ubuntu – How to retain installed software between Ubuntu installations / Tools for software inventory

aptsoftware installationsystem-installation

Is there a good way to manage / keep track of the installed software on Ubuntu machine?

Through the years, we keep improving our system, install all kinds of useful tools to make ourselves more "at home" in our own system. Then comes the day, when one has to get a new laptop, install new version of Ubuntu, copy all files and set up the new system. And then spend days, weeks or even months installing again all the applications that were formely installed.

In this process, it would be very helpful to get all the former applications carried over.

What are the best ways to accomplish this? Surely apt maintains db of all installed packages, but how does one get all these packages easily re-installed in the newly installed system?

Best Answer

dpkg --get-selections > YourFile.txt will put all of your current packages' names into a text file for you.

Then, on the new machine put the YourFile.txt somewhere (I'll use the desktop for example's sake) and do:

sudo apt-get update
sudo apt-get install aptitude
dpkg --set-selections < ~/Desktop/YourFile.txt
sudo apt-get dselect-upgrade
sudo aptitude install $(cat ~/Desktop/YourFile.txt | awk '{print $1}')

EDIT with a note: This will reinstall ALL of your installed packages. So if you're using (for example) xubuntu 12.04 now, but your new machine will be kubuntu 14.04 you'll run into a number of problems with your desktop managers, and in this case you'll probably want to edit the YourFile.txt to get rid of some of those things

Related Question