Log in

Backup and restore all your packages on Debian based machines.

Friday, April 26th, 2013 by

So, you’re somebody that plays a lot with Linux?
Create a script that runs weekly or so with the commands below, and you’ll always be prepared for the worst that life can toss your direction!
Okay, that might be overly optimistic, but it can’t hurt, and can save you a ton of time when you rebuild a machine.

# SRJ 2008-09-03
mkdir SourcesAndPackages
cd SourcesAndPackages
dpkg --get-selections | grep -v deinstall > InstalledPackages.txt
cp -a /etc/apt .
# Comment out the lines above and uncomment the lines below to restore.
# cd SourcesAndPackages
# sudo cp -a apt /etc/
# sudo apt-get update
# sudo apt-get dist-upgrade
# sudo dpkg --set-selections < InstalledPackages.txt
# sudo apt-get dselect-upgrade

Comments are closed.

We (CLUG, or CLUG.Org) don't have a formal mission statement. Our goals are very simple. We have discovered GNU/Linux and want to talk to others who have made the same discovery. We are experts and novices, professionals and hobbyists, young and old. Whoever you are, we hope we have something for you. Come and check us out!