4

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?

3 Answers 3

4

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

1

One thing both answers above fail to mention are those applications which come from non-standard PPA's - I had run across a backup / reinstall script which is

backup:

dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys

Restore

sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

I can't claim any credit for this, and yes it does have the same version problems as mentioned in the comments above, but if what you are looking for is a clean backup / reinstall this might be of help.

Original posting for this script

Also note that I have changed the rsync script slightly for my own use

1

on the old system, run

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

to put every installed application into a folder as deb packages that can be installed on the target machine with

sudo dpkg -i *.deb

the best part is, it installs them all at once so you don't have to worry about dependencies.

2
  • One thing I'll point out here is that this will pull the .debs for your particular system. If you change from 32 to 64 bit, or from 12.04 to 14.04 you may encounter errors when trying to install all these .debs
    – Mitch
    Jul 1, 2014 at 13:27
  • I believe it will still install, then when he updates the packages it reinstalls the proper ones for his particular system. Either way, it's faster than manually installing packages from a list...
    – sbergeron
    Jul 1, 2014 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .