Howto Reinstall all of currently installed packages in fresh Ubuntu install
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.
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
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.
Very good tip, this has bothered me a few times before. Thanks!
Seems like you have to click “Save full state, not only changes” check-box in Synaptic’s Save changes dialog-box.
Thanks a lot !!!
But, it would be great if all the packages can be taken a backup with proper dependency checks.
This is one of those simple but pretty perls that made me add this RSS to my Google reader.
worked a treat thnx
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…
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…
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.
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.
Whoops! I fixed the Reconstructor address:
Gonna try these two tools, thanks Foxh0und
I think APTonCD will help…
You can burn all currently installed packages to a CD and later transfer them to the new machine 🙂
How to this via apt-get?
You mentioned that it can be done, but didn’t tell how to achieve this…
$ 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.]
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.
what I use (from command line (in my backup scripts)) is this:
--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:
--set-selections < dpkg-selections.txt
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?
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.
@spuffler – I have updated the article
nice one. helped a lot
Your post was really Awesome !
Thanks for the help Dude !
i always wondered about this. now it makes it a breeze to re-install.
Thanks But it does not work if packages are missing pieces, which is an ongoing issue for me.
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?