Wednesday, February 11, 2009

Upgrading Ubuntu to the Next Release

So you're running Ubuntu. Now there's a new release. While the upgrade path is fairly smooth, I'm inclined to do a fresh install. Below, I'll show you an easy way to reinstall all your softare. And I'll show you two slightly different ways of upgrading to the next release. I've upgraded Ubuntu 7.10 (Gutsy Gibbon) to Ubuntu 8.04 LTS (Hardy Heron), and all went smooth as silk. The choice is yours.

Re-installation

Again, this is my choice. As a desktop system, re-installation should go fairly smooth. As a server, reconfiguring all your server components (apache, mysql, nfs, samba, openssh, etc) could be a little aggravating. But then I'd never choose Ubuntu for a server. I'd go for Debian or CentOS, depending on the circumstances and hosted services.

After installing the new version, you'll have to install all your software again. You can either take note of what additional software is installed, or you can do it the semi-automatic easy way.

Keep in mind that any packages you've installed that are not in the Ubuntu repositories, you'll have to manually add them later.

Before you reinstall, do the following at the command line on your existing system:


dpkg --get-selections > /home/user/software.list


What this does is take a snapshot of all installed software packages on your computer, and dumps the list into a file called software.list. Save this file. Email it to yourself, put it on a flash stick, or whatever.

Now, make sure you have backups of all your data. All /home directories, anything you've changed in /var, or any other files located elsewhere. This is all on you.

Now, reinstall your new OS. You could even follow my Ubuntu 8.04 Perfect Desktop how-to if you'd like.

After you're up and running, let's install all the software you had installed before. As root, do


apt-get update
dpkg --set-selections < /home/user/software.list


This will select software to be installed. Now, let's install it with dselect. You may have to install dselect. As root, do


apt-get dselect-upgrade


Instead of using apt-get dselect-upgrade, you could use dselect, provided you have it installed. At the dselect menu, press "I" to install, and enter to begin installation. This process may take some time. My system needs to download about 2.7 Gigs of packages. Yours will vary. When prompted, press Enter to continue. Press "Q" and Enter to quit dselect

Now, update the entire system. As root, do


apt-get -y upgrade


It is feasible that the above command will not bring in any updates. Now if you've installed any packages that are not in the Ubuntu repos (built your own, or installed a deb package from the web), you'll have to install those separately.

All you have to do now is reboot and restore all your files. That's it!!

Upgrade Your System - Method 1

If you choose not to re-install your system, don't fret. There's an easy way to upgrade. This has worked for me to upgrade Ubuntu 7.10 to Ubuntu 8.04.

At a terminal window, as root, enter


update-manager


This will start the update manager. After the window opens, it should tell you at the top that there is a "New distribution release 'some new version' is available". In my case, it tells me that 8.04 LTS is available.


Click on Upgrade. A window will pop up describing the new release. Click on the Upgrade button in the new window. This will download and start the upgrade tool.

After the upgrade tool examines your system, it will tell you how many packages will be removed, how many will be installed new, and how many will be upgraded. This is the last chance. Click on Start Upgrade, and forever hold your peace!

During installation, you'll no doubt encounter packages that want to replace existing configuration files. Each package has its own way of dealing with additions. Just follow the prompts. Usually, if you have no idea what it's updating, is generally safe to accept the default.

After the new packages are installed, you'll be asked whether you want to remove obsolete packages. Be sure to remove them.

Upon completion, you'll be asked to reboot your system. It'll reboot to your new upgraded version! Also, depending on how long it took to do the upgrade, you may have a few more updates to do. You can install them with the following commands, as root.


apt-get update
apt-get upgrade


Welcome to Hardy Heron!

Upgrade Your System - Method 2

This method requires editing one simple file. Here's a portion of the sources.list file. This is only part of the file, not the entire file.

/etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe


All you have to do is edit this file with your favorite text editor, and change all occurrences of gutsy to hardy, so it reads like the following:

/etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe


Again, this is only a portion of the sources.list file. Don't replace the contents of your file with the above 4 lines!

After you save the file, update the package list on your computer, and upgrade your system.


apt-get update
apt-get -y dist-upgrade


After installation, you'll need to reboot. Again, there may be a few packages that need to be updated, if any packages were updated during your upgrade.

Welcome to Hardy Heron!

P.S. Upgrade method 2 works for Debian also. Just change etch to lenny, instead of gutsy to hardy.

No comments: