Accueil > Système > Best way to backup all settings, list of installed packages, tweaks, etc?

Best way to backup all settings, list of installed packages, tweaks, etc?

02/02/2024 Categories: Système Tags: , , , , ,
Print Friendly, PDF & Email

Programs

 

A quick way of backing up a list of programs is to run this:

dpkg --get-selections > ~/Package.list
sudo cp /etc/apt/sources.list ~/sources.list
sudo apt-key exportall > ~/Repo.keys

 

It will back them up in a format that dpkg can read for after your reinstall, like this:

sudo apt-key add ~/Repo.keys
sudo cp ~/sources.list /etc/apt/sources.list 
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

 

Settings and Personal Data

 

Before you reinstall, you should probably back up the settings from some of your programs, this can easily be done by grabbing folders from /etc and all the content from your user directory (not just the stuff you can see in nautilus!):

rsync --progress /home/`whoami` /path/to/user/profile/backup/here

 

After you reinstall, you can restore it with:

rsync --progress /path/to/user/profile/backup/here /home/`whoami`

 

So all together as a pseudo-bash script.

 

This assumes there is only one user on the machine (remove /'whoami' otherwise) and that you used the same username on both installs (modify dest. of rsync otherwise).

dpkg --get-selections > ~/Package.list
sudo cp /etc/apt/sources.list ~/sources.list
sudo apt-key exportall > ~/Repo.keys
rsync --progress /home/`whoami` /path/to/user/profile/backup/here

##  Reinstall now

rsync --progress /path/to/user/profile/backup/here /home/`whoami`
sudo apt-key add ~/Repo.keys
sudo cp ~/sources.list /etc/apt/sources.list 
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo dselect

 

Lire aussi:  Rsync (Remote Sync): 10 Practical Examples of Rsync Command in Linux
Les commentaires sont fermés.