LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   apt-get backup/recovery (https://www.linuxquestions.org/questions/debian-26/apt-get-backup-recovery-448295/)

gugamare 05-24-2006 10:48 PM

apt-get backup/recovery
 
I am planning to do some heart surgery on my Debian system (I got some packages I need to downgrade) and I am worried that I'll end-up screwing things up.

Since I don't want to spend the weekend kicking myself if something goes wrong, I m wondering if there is a painless way to make a complete backup of my installed packages, through apt-get/synaptic/etc, and restore my machine to where it is today?

Does any one know a way I can do this?

Thanks

pljvaldez 05-24-2006 10:56 PM

Well, I know a way to record what packages you have now and then restore them later, but it won't backup config files. If you want to backup everything, use dd, g4u, or partition image.

Otherwise do the following
Code:

dpkg --get-selections > myselections.txt
Save that text file somewhere, as well as your sources.list.

Then to restore it, copy your sources.list to the machine and do
Code:

dpkg --set-selections < myselections.txt
apt-get update
dselect update
apt-get dselect-upgrade

This should install all the programs you had installed on the machine before, but you'll have lost the config files unless you back them up separately...

craigevil 05-24-2006 11:14 PM

For a convenient reinstallation save the list of programs/packages in /root/old-packages-YYYYMMDD-HHMM.txt which can be used to reinstall all packages with apt-get after the update installation:

apt-get install $(</root/old-packages-20051221-2030.txt)

Keep in mind like pljvaldez previously stated you will lose any custom configuration files you may have made.


All times are GMT -5. The time now is 02:20 AM.