How to restore settings and programs after a reinstallation

If you were thinking of updating or formatting everything or, perhaps, you have several machines that you want to have the same programs and settings, you cannot miss this article.


Update: the main advantage is that the system remains exactly the same as we had it before the update, with the same configurations and the same programs installed, but with all the news and updates of the new Ubuntu.

Clean installation: leaves the system clean, ensuring that everything works perfectly and that we do not carry previous configuration errors.

In most cases, the ideal would be a mix: a clean system but keeping the user settings and previously installed manually programs. In this article we will see how to achieve this, a system installed from scratch but keeping the programs and customizations that we had in the previous system.

Maintain user settings

All user options, without exception, are in the directory / Home, all we have to do is keep this folder unchanged.

There may be two different situations, that the directory / Home It is on the same partition as the rest of the system (which will erase its contents with the new installation) or it is on a separate partition.

/ Home in an independent partition: this case makes things much easier for us, all we have to do is select manual partitioning during the installation process and make sure that the partition / Home get back on / Home and the format box is NOT checked.

/ Home in the root partition: in this case we will have to make a backup copy of the entire directory / Home as this will be erased during installation.

1. Create a backup BEFORE upgrade:

cd / && sudo tar cvfz backup_home.tar.bz2 / home

We save the file backup_home.tar.bz2 on a site that we know will not be erased, for example a USB drive.

2. Install the new system: we install the new Ubuntu normally

3. Restore backup AFTER upgrade:

cd / && sudo tar xvfz /routadondeguardeelbackup/backup_home.tar.bz2
Note: For this method to work properly, the new users must be named the same as the old system.

Restore installed programs

Another issue that can take a while after an installation is to reinstall all the programs that we had previously, however this can be solved with just two commands:

1. Obtain the list of installed programs: BEFORE the update, in the old system we will obtain the list of installed programs with the command:

dpkg --get-selections | awk '$ 2 ~ / ^ install $ / {print $ 1}'> package_list.txt

We save the file package_list.txt in a place that we know will not be erased, for example a USB drive

2. Install the new system: we install the new Ubuntu normally

3. Reinstall all the programs: AFTER the installation we will not have the programs installed manually, to recover them we will use the file package_list.txt As follows:

cat package_list.txt | xargs sudo aptitude install -y

Note: this system only works for programs installed using the package manager, it will not work for programs compiled manually or installed using any other method.

Other customizations

It may be the case that we have other customizations made manually in the system, for example a modification of the boot system in / Boot, files from a web server in/ Var / www or system configuration files in / Etc to give some examples.

In this case we will make a backup copy of the affected folder or folders and restore it to the updated system:

cd / && sudo tar cvfz backup.tar.gz / folder1 / folder2 ... # Create backup
cd / && sudo tar xvfz backup.tar.gz # Restore backup
Thanks Fosco (the original author of this great article)!

Source: Ubuntu in Depth


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Lizmer A Ruiz G said

    Good afternoon ,,, I am writing for help ,,, I restored the desktop of Linux Canaima 2.0 to 3.0… ..But I lost the educational programs, how do I restore them, did you have to make a backup first? but he told me that he wouldn't lose the programs now I can't get them, and I used the install-canima.sh scripts ... there is a way to get those programs on the partitions ,,,,, and how do I ... Please I am a beginner in linux …….

  2.   Lizmer A Ruiz G said

    Good afternoon ,,, I am writing for help ,,, I restored the desktop of Linux Canaima 2.0 to 3.0… ..But I lost the educational programs, how do I restore them, did you have to make a backup first? but he told me that he wouldn't lose the programs now I can't get them, and I used the install-canima.sh scripts ... there is a way to get those programs on the partitions ,,,,, and how do I ... Please I am a beginner in linux …….

  3.   Luz said

    Good afternoon, I have mint 18.1 linux… I changed the name of my terminal and now I cannot access my user as administrator. When I try to access I get this message cloud not update ICEauthority file / home / luz.ICEauthority What do I do?