Howto Reinstall all of currently installed packages in fresh Ubuntu install

Sponsored Link
People sometimes have to do a reinstall of their Ubuntu system for various reasons (been playing/experimenting with configuration/drivers/other packages or just because something is badly broken) but remembering all the extra packages you have installed can be a chore -- but here is the simple solution:
On your old system (assuming it is still working), start up Synaptic and go:

File-Save Markings and choose a file name along with a location (like a USB drive) that you can use when you have installed your new system and make sure you have checked “save full state, not just changes” option click on Save.

Screenshot-Save changes

This file contains a list of all your currently installed packages, and when you have installed and booted up your new system (and configured your repositories to the best for your location ) then start up Synaptic and go

File-Read Markings and point it at your saved file, and after that has completed then select Apply to kick off the download & installation of all of those packages you had installed previously!

There are also apt-get command line functions that achieve the same outcome, so those who don't have/use Synaptic can still do this.

You will still have to do any special configuration changes that you had on the old system, but at least all of the packages are now in the new system.

This is also very handy for moving to new hardware/duplicating setups etc.

Be aware that doing this between different Ubuntu versions may cause complications because some packages may not be in a later version or have different names.

Note:- Don't forget to backup your sources before you reinstall.

sudo cp /etc/apt/sources.list ~/sources.list.backup

Otherwise if you have added any PPAs or other sources, this tip won't work.

Full Credit Goes here

Sponsored Link

You may also like...

25 Responses

  1. David J says:

    Oh man, this is awesome! Thanks for posting this. Very helpful as I’m installing Super Ubuntu on top of Intrepid tomorrow night and I want to be sure I get everything I had before.

    Thanks again!

  2. Gabor says:

    Very good tip, this has bothered me a few times before. Thanks!

  3. krsfer says:

    Seems like you have to click “Save full state, not only changes” check-box in Synaptic’s Save changes dialog-box.

  4. cnu says:

    Thanks a lot !!!
    But, it would be great if all the packages can be taken a backup with proper dependency checks.

  5. Nyarnon says:

    This is one of those simple but pretty perls that made me add this RSS to my Google reader.

  6. t0m5k1 says:

    worked a treat thnx

  7. Jerad says:

    You should really specify in the how-to that you have to check the “Save full state, not only changes” box when you save the current package list. I just tried this trick to copy my downloaded packages to a second computer and it didnt do anything. It’d have been tragic had I reformatted my computer…

  8. Brett Howard says:

    Now if there was only a way to backup only the ones that you’d added since a base install. So that you could use it after an upgrade and not end up pulling back in older kernels and things of that nature…

  9. Bit Hacker says:

    Has anybody heard of AptOnCD…….http://aptoncd.sourceforge.net/ “Create APTonCD” feature we have the possibility to make a CD/DVD with all previously downloaded packages with apt-get or aptitude.

  10. foxh0und says:

    There are two tools that have helped me in this situation that is worthy of mention: Remastersys and Reconstructor. Both can build a live cd/dvd off your current install in essence creating your own distro to reinstall or share with family or friends (if you choose not to backup your Home folder with all your private files of course.) The problem I found with AptonCD is it doesn’t backup my cache, so certain applications not attached to the official repos (buntu or deb) are not backed up. Hope this helps.

    Remastersys
    Reconstructor

  11. foxh0und says:

    Whoops! I fixed the Reconstructor address:

    Reconstructor

  12. Bit Hacker says:

    Gonna try these two tools, thanks Foxh0und

  13. ATOzTOA says:

    I think APTonCD will help…

    You can burn all currently installed packages to a CD and later transfer them to the new machine 🙂

    _ATOzTOA

  14. Ivan Simeon says:

    How to this via apt-get?

    You mentioned that it can be done, but didn’t tell how to achieve this…

  15. Bit Hacker says:

    $ sudo apt-get install aptoncd
    Or via Add/Remove…

    Take a look at this (not relavent to APTONCD)
    http://ubuntuforums.org/showthread.php?t=688872 [How to make live DVD from your current HD installation.]

  16. jab says:

    Funny, usually the only reason I “re-install” Linux ever is because I have too much crap on my machine. Things that looked cool so I installed, played with it for a few days and then forgot about. I rarely want to re-install all (any?) of that stuff.

    For me at least, it is very therapeutic to “start fresh” when things get bogged down. I make sure I save off all configs (usually just keep a copy of /etc is sufficient) and re-install. The stuff I added to the system which I use all of the time will missing and obvious right off the bat. But installation is (usually) dead simple and quick with package managers they way they are today. The stuff I never touched after initial install/play time will be gone and I will be none the wiser and I get some system resources (even if it is just disk space) back that I never knew I had.

  17. jens says:

    Hello,

    what I use (from command line (in my backup scripts)) is this:
    dpkg --get-selections > /var/backups/dpkg-selections.txt
    debconf-get-selections > /var/backups/debconf-selections.txt

    The second line requires debconf-utils to be installed.

    after installation of a new sytem you can then simply feed them back using:
    debconf-set-selections debconf-selections.txt
    dpkg --set-selections < dpkg-selections.txt

    Jens

  18. Dave says:

    Does Jens’ idea using debconf work when upgrading? i.e. can I backup details of my currently installed packages and then reinstall them after upgrading to the latest release?

  19. spuffler says:

    As krsfer said…. you MUST check “save full state, not just changes”. I found out that simply launching Synaptic and doing the “save markings” thing but WITHOUT check marking the “save full state…” option will produce a zero byte file, totally empty. Would be quite annoying if you went to recover by reading from a zero byte file. I’d suppose that “apt-get” will need similar instructions.

    Be a good lad, add the “save full state, not just changes” information to the main article.

  20. admin says:

    @spuffler – I have updated the article

  21. Lakosshoots says:

    nice one. helped a lot

  22. Arun says:

    Your post was really Awesome !
    Thanks for the help Dude !

  23. jonny rocket says:

    i always wondered about this. now it makes it a breeze to re-install.

  24. linuxpusher says:

    Thanks But it does not work if packages are missing pieces, which is an ongoing issue for me.

  25. John Rose says:

    Just one problem. /etc/apt/sources.list does not contain ‘addresses’ of ppa’s. They seem to be contained as 1 line entries (e.g. deb http://ppa.launchpad.net/alanbell/unity/ubuntu precise main) each in their own file (e.g. alanbell-unity-precise.list) in directory /etc/apt/sources.list.d. There needs to be some means (rather than copying all these files to a home directory) of being able to recreate them if necessary from some file containing the 1 line entries (which is created by?). Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *