Ubuntu update / upgrade, fresh install and keep your settings

Ubuntu really rules, and distribution update / upgrade seems to work. I’ve been using it for many years and never had a problem.

Linux in general is not like windows, there is not any registry file that keep bloating and after a year you need a fresh install because your new super duper zillion core pc seems so unresponsive.

On the other hand, even if update / upgrade works well enough on Ubuntu why not do a fresh install once but keep your settings?

It never hurts to use clonezilla to make partition backups in case something goes wrong. This guide could result to a trashed installation but nonetheless it did worked for me. The author can not be held responsible if following this guide you trashed your pc. There are 3 rules to successful computing Backup, Backup and Backup.

For the rest of the text I will assume that you have an external disk which is mounted on /mnt/backup

The trick first of all is to tar the /etc and /home directory. Both of them are where all the setting for all the programs are lying.

The command that creates the archives and keeps all the permission settings for those dirs is:

tar -czvf /mnt/backup/etc.tar.gz /etc && tar -czvf /mnt/backup/home.tar.gz /home

*the etc file should be a couple of mb but the home could be well over 1gb it depends on your home directory

The next command will save on the external disk the file installedpackages which will include all the packages that you have installed

sudo dpkg –get-selections > /mnt/backup/installedpackages

In case you have added other repositories keep in hand the source.list file

cp /etc/apt/sources.list /mnt/backup/

Now you have these 4 files to an external hardisk.Begin the fresh install, keep in mind that having a partition for the home directory can be a lifesaver.

After you finish  do an update upgrade

sudo apt-get update && sudo apt-get upgrade

Have a look on the sources.list file and copy over the additional repositories, you maybe have to change the name of the distro from e.g. lucid to maverick

Then execute the following command so as to install all the applications you used to have

sudo dpkg –set-selections < /mnt/backup/installedpackages && apt-get dselect-upgrade

Then boot using the live cd and copy over your home archive, maybe this command works from inside the fresh installation but again I suggest using the live cd

tar -xzvf /mnt/backup/home.tar.gz /home

Reboot to your installation and everything should work as expected. In case some applications do not have all the customization you used to have e.g. apache then have a look on the /etc tar and copy over the settings files accordingly.

This entry was posted in Hardware, Linux, Software and tagged , , , . Bookmark the permalink.

One Response to Ubuntu update / upgrade, fresh install and keep your settings

Leave a Reply to me Cancel reply

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