Upgrading Linux without having to manually reinstall programs
So now that Linux Mint 6 is out what do you do? Do you update or do a fresh install? Updates are easy, but fresh installs usually work better. But what about all that stuff you installed and settings you made? I am going to give you a few commands to do a fresh install and keep all the stuff you installed.
First I would like to explain the easiest way to keep your documents and settings. When you are installing Linux Mint create a separate partition or use a separate hard drive for your /home directory. Of course this requires repartitioning your hard drive and possibly reinstalling, but to me it seems it is something that a lot of long time Linux user recommend. And if this is the first time you are installing Linux it is something that can help you a ton in the long run. If you are like most first time Linux installers you are probably doing this on a machine that already has Windows installed and you are planning on dual booting the machine though. Keep in mind that setting up your home directory on a separate partition/hard drive DOES NOT keep your programs installed when you do a fresh install.
If you already have Linux Mint installed and are just updating to Linux Mint 6 than the below instructions are for you. If you just want to update to Linux Mint 6 without doing a fresh install than you should use the awesome updater program.
First thing I would like to do is give credit where credit is due. I found these instructions (and added some extra stuff) from hehe2.net.
So here is what you do. While you are still using your “old” version of Linux mint open up a command prompt and run this command. Note that throughout this tutorial you are going to replace wherever I have put “rothgar” with whatever your username is on the machine.
sudo dpkg -–get-selections > /home/rothgar/package.selections
*NOTE* those are two ‘-‘s and not just one in front of “get-selections”
This makes a list of everything that is installed and saves it to your home folder.
Next we are going to back up all your files. One of the easy ways to do this without missing hidden files or screwing up permissions is to backup your home directory with the tar commend. The tar command is like a zip/rar file for windows.
The command to use is
tar -cvpzf /home/rothgar/Desktop/homebackup.tar ~ —exclude=/home/rothgar/.local/share/trash
Here is what the letters all mean after tar
c = creates a file
v = verbose, shows you what it is doing
p = permissions, keeps your permissions in tact (make sure your new user has the same username on the fresh install)
z = gzip the files, actually compresses the files
f = file, moves files
You can use the —exclude=/home/rothgar/anyfileorfolderyoudontwant to exclude multiple folders by just putting another one at the end of the code. I included the trash folder because I have a nasty habbit of not emptying my trash in Linux Mint.
One you have your home folder all backed up the file should show up on your desktop. Go ahead and backup your /etc folder too so you can have extra configuration files (sources.list, xorg.conf, etc.) that you might need to reference for system wide settings you made. Do that with this command.
tar -cvpzf /home/rothgar/Desktop/etcbackup.tar /etc
Once you have the two tar files on your desktop move them off to a external hard drive. We are going to format your current drive for a fresh install remember? Make sure you verify that everything is there. If for some reason the copy didn’t work there won’t be any easy way to get your stuff back.
Do a fresh install of Linux Mint 6. Trust me, it is as painless as Linux Mint 5.
Once Linux Mint 6 is all installed plug in your external hard drive where you saved all those important files. Go ahead and extract that package.selections file we created in step one and copy it to your new home folder. If you added any special sources to your sources.list file you will need to extract that from the other tar file and make sure you replace all of the versions (Gusty etc.) with the current version (in this case Intrepid). I hope you also checked that the software you installed supports the new version. Otherwise they may not have a repository for the right version. Once you have all your sources added then just run these two commands in a terminal.
sudo apt-get update
sudo dpkg -–set-selections /home/rothgar/package.selections && apt-get dselect-upgrade
This may take a while. It is going to download all the software you had installed before and install it. After everything is installed you will now need to extract the rest of your home folder. To extract open a terminal and browse to the folder you have the tar file stored. Then just run:
tar -vxpvf /homebackup.tar ~
This will take all your files, including your setings, and move it to your new home folder. Once the extract finishes just reboot to apply all the settings and you should be good to go. Now it is just like you left it.
Two problems that I thought I would point out that I had were video card drivers and missing icon set. The video drivers were easily re-installed with Envy and the icons I just had to re-download and put them in the .icons folder in my home folder.
If you want more info on the tar command go read on here.
If you have any questions go ahead and leave them in the comments.