The problem
Many a time I have re-installed my system from scratch or created a new system, but get sick of continually installing the same packages over and over. Its annoying when 2 or 3 months down the line you want to use a program you used to have (or have on another system) only to find its not yet installed. Sure, an apt-get install only takes a few minutes for a single piece of software, but that’s a few minutes a geek like me could better spend doing something productive.

The solution
Thankfully Debian Linux (and thus by extension, Ubuntu and any other Debian variant) have made life easy in these situations. You can easily list every installed application on your system

# sudo dpkg --get-selections

That will show you everything apt-get has installed for you at this moment in time. But it doesnt stop there, we can use some cool tricks to allow us to backup our system software for an easy re-install later, or perhaps so we can mirror our installed software to other systems.

# sudo dpkg --get-selections | grep -vi kernel > /etc/installed.conf

This piped command creates a file in /etc called ‘installed.conf’ which contains all software installed on your system currently, excluding kernel related packages. The reason we exclude kernel related packages is that if you use this list to mirror your installed applications on another system, we dont want your kernel, kernel modules or other kernel specific items being overwritten or messed around on the other system.

Now lets say you are on a fresh install of Debian, Ubunutu etc and have a installed.conf you want to use to restore (or do a fresh install) of your software. Stick installed.conf into /etc and then its pretty damn easy:

# sudo dpkg --set-selections < /etc/installed.conf
# sudo dselect

Select the 'i' option in dselect to install your packages and the system will do the rest for you

Hope you found this post useful!

Share this post

6 Comments

  1. en

    Thanks and God bless you!

    April 23, 2014 Reply to this comment
  2. Catalin

    Bookmarked! :)

    Thanks!

    January 20, 2013 Reply to this comment
  3. Jim Thomas

    Handy, thanks! A few things…
    1) The sources.list on your new install should be the same as the old install if you expect this to work
    2) You should be sure to run
    # sudo dselect update
    on the new machine to ensure that the package list is up to date
    3) Change the last command to skip having to use the dselect menu
    # sudo apt-get dselect-upgrade

    June 21, 2012 Reply to this comment
    • Jim Thomas

      I meant ‘If you expect this to work perfectly’ it will work with varying degrees of success if they do not match.

      June 21, 2012 Reply to this comment
  4. Excellent , Thanks a lot :)

    December 19, 2010 Reply to this comment
  5. Useful post, thanks !

    December 18, 2010 Reply to this comment

Leave a Reply