
You might prefer to have a clean system on reinstall but sometimes it is nice to reinstall applications from a previous machine/setup. Keeping a backup list of packages will make this a snap. Just give your package manager a list of all the packages you want it to install and let it rip.
Here are the backup and restore methods for each of the major distros/package managers.
Debian / Ubuntu
Backup
Restore
apt-get dselect-upgrade
Arch Linux
Backup
Restore
Fedora
Backup
Restore
Gentoo
Backup
Restore
OpenSuse
Backup
Restore
Was this information useful?
15 Responses
-
How could you ever do this on Windows? You’d basically have to Ghost (or whatever) an entire drive. Linux FTW!
-
openSuse:
rpm -qa –queryformat ‘%{NAME} ‘ > installed-software.bak
sudo zypper install $(cat installed-software.bak)
-
Mark Sanborn
6-24-2009
Thanks Erlend! I added your section to the post.
-
fiber
6-24-2009
Awesome list…. just a note: you have a stray ” in the restore lines for Debian/Ubuntu
-
Mark Sanborn
6-24-2009
Fiber, I don’t know where that came from
fixed. -
Eric Floehr
6-24-2009
Fedora has a daily cron task to take an installed package snapshot, and saves to /var/log/rpmpkgs, so just backup that file every day.
-
Siilex
6-24-2009
The solution proposed for Debian lists too many packages.
I usually use this, which is an improvement:
dpkg –get-selections | grep “\binstall\$” | cut -f 1 | while read f ; do c=$(apt-cache rdepends “$f” –installed | wc -l) ; if (($c == 2)) ; then echo -e “$f” ; fi ; done
This oneliner shows the ‘root’ packages between installed ones. ‘Root’ means they do not have other packages depending on them.
This makes the minimal subset of ‘apt-get install’ targets to get a system like the actual.
Please, notice metapackages are always shown as root, because nobody depends on them. So the result still has some redundancy.
Enjoy it. -
I usually also backup the /etc
So when we restore, the reinstalled software will be already configured as it were
backup :
tar cvf config.tar /etcrestore :
tar xvf config.tar -
Super handy
-
Johannes
6-25-2009
And do you know how to do this on a FreeBSD machine? I think it’s possible too, but I don’t know how.
Nice site! Thanks for posting!
-
anechoic
6-26-2009
the line:
‘dpkg –get-selections > installed-software.log’should be:
‘dpkg –get-selections > installed-software.log’the M dash ‘–’ is replaced with two ‘–’
***also, you can export markings in Synaptic which pr0lly does the same thing under the hood
-
Mark Sanborn
6-28-2009
Good question, I will see if I can dig up some information for you.
-
Rob
8-3-2009
Sorry to sound like an obvious noob but in order for the restore to work you would also need a backup of the sources.list correct?
-
Mark Sanborn
8-3-2009
Rob,
If you use extra repositories it would be a good idea to back it up. -
nice article…learning a lot from here…




6-24-2009