It is very straight forward to upgrade Ubuntu between releases.The BonsaiFramework recommends that with Servers, staying with LTS versions of Ubuntu and upgrading only when the next LTS version is introduced.
Carefully review the differences in releases. You will often find that most new features are GUI Desktop related and do not provide any value to the Server environment.
In this example the server is running 9.10 . The next and at the time current , the next available long term support release at the time is 10.04.
If we were behind multiple releases, for example at 9.04, we would first upgrade to 9.10 and then 10.04 by repeating the upgrade instructions.
Warning |
---|
Skipping versions is not advised as it may cause damage to your system. |
In an Enterprise environment, you may even want to build a new replacement server with a fresh install of the most up to date Ubuntu LTS release and do a cut over.
Determine Version
Before you start you should determine the kernel and release you are currently running. It is helpful to write this information down before starting your release upgrade. Here are the commands with sample data,
Code Block | ||
---|---|---|
| ||
uname -a # determine kernal version Linux myrakrypton 2.6.32.9-rscloud #6 SMP Thu Mar 11 14:32:05 UTC 2010 x86_64 GNU/Linux lsb_release \-a # determine release number No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic |
The most important point here is that the release is at 9.10 and the next release at the time of this tutorial is 10.04.
Info |
---|
An A comprehensive and updated table of Ubuntu releases is on the Wikipedia. |
Prepare for the Upgrade
First backup your system and data. If you are happen to be using visualization take a snapshot. Whatever your backup method is, make sure the restore works.
...
Code Block | ||
---|---|---|
| ||
sudo apt-get update
sudo apt-get dist-upgrade |
Finally stop as many services as possible especially those not managed by Ubuntu.
As a precaution we also stop even services managed by Ubuntu. Examples include web server deaemons (Apache, nginx, etc), database servers (PostgreSQL, MySQL, etc), and any other non-critical important services.
Perform the Upgrade
Perform the release upgrade,It is preferable to upgrade from the console. Even in the case of cloud or virtual computing try to get to a console. Most cloud and virtual systems provide a back door console access via the web browser.
Warning |
---|
Again, if your system is running real applications and stable make sure you can backup and restore your system before going further. |
Install the update-manager-core package if it is not already installed:
Code Block | ||
---|---|---|
| ||
sudo apt-get install update-manager-core |
View /etc/update-manager/release-upgrades and ensure Prompt=normal,
Code Block | ||
---|---|---|
| ||
sudo ne /etc/update-manager/release-upgrades |
Perform the release upgrade.
Code Block | ||
---|---|---|
| ||
do-release-upgrade |
After the upgrade it will request to restart the system.
Verify the Upgrade
Verify that the version you are running has changed,tinpham@myra:/opt$ uname -a
Code Block |
---|
uname -a Linux myra 2.6.32.9-rscloud #6 SMP Thu Mar 11 14:32:05 UTC 2010 x86_64 GNU/Linux lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.2 LTS Release: 10.04 Codename: lucid |
Change Release Upgrade Back to LTS
Provided you are happy with the version you are on, you may want to edit the etc/update-manager/release-upgrades and set Prompt=lts or whatever you were using before,
Code Block | ||
---|---|---|
| ||
sudo ne /etc/update-manager/release-upgrades |
Out of Disk Space for /boot
Especailly with a GUI version of Ubuntu you may run out of disk space on in your /boot partition. This is likely due to old images. To clear up.
First check your kernel version, so you won't delete the in-use kernel image,
Code Block | ||
---|---|---|
| ||
uname -r |
Now run this command for a list of installed kernels,
Code Block | ||
---|---|---|
| ||
dpkg --list 'linux-image*' |
Delete the kernels you don't want/need anymore by running this,
I'm not sure we need this given the subsequent command... look into this more.
Code Block | ||
---|---|---|
| ||
dpkg --list 'linux-image*'sudo apt-get remove linux-image-VERSION |
Replace VERSION with the version of the kernel you want to remove. When you're done removing the older kernels, you can run this to remove ever packages you won't need anymore,
Code Block | ||
---|---|---|
| ||
sudo apt-get autoremove
sudo apt autoremove |
And finally you can run this to update grub kernel list,
Code Block | ||
---|---|---|
| ||
sudo update-grub |