How to upgrade your web server from Debian 7 Wheezy to Debian 8 Jessie

Upgrading your Debian machine to a new, major release is not as difficult of an operation as it seems.  Actually, the most difficult part for me was remembering which version name pairs with which release number.  The tough part is dealing with the big changes that are introduced with the new version, rather than the upgrade itself.

These instructions are primarily targeted to web servers running Debian 7, but the instructions can also be applied to regular desktop machines as well.  (Just ignore all the parts about Apache!)

Before you begin

Understand that the move to Debian 8 is a major change to your system.

The upgrade process

Here are the steps I used to upgrade my Debian 7 (Wheezy) machines to Debian 8 (Jessie).

STEP 1

Start off by ensuring that your system is up-to-date with its current distribution.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

STEP 2

Set the apt sources to the new distribution version.

You can either go through /etc/apt/sources.list and change instances of “wheezy” to “jessie” manually, or use this command to do the find-and-replace for you in one step.

sudo sed -i 's/wheezy/jessie/g' /etc/apt/sources.list

STEP 3

Upgrade the packages again with the new source, and run upgrades.

You will want to stick around during the upgrade processes.  Two things will happen that will require your input:

During the upgrade process, packages will be upgraded and some configuration files that you may have modified will need to be updated also.  APT will give you the option to keep the existing files and preserve your changes, or overwrite them with the latest package maintainer’s version.  I choose to wipe out my changes and install new configuration files.

Your computer may stop during the upgrade process to show you important release notes for the packages that are being upgraded.  When you see the notes come up, you can use Page Down/Up to browse through them.  When you reach the bottom, it will tell you.  Pressing q will exit the notes and proceed with the installation.

Run these commands to upgrade your system to the new package versions.  These commands are the same as the ones above – that’s not a typo!  The only thing that changes is the distribution source, which we changed in step 2.  Easy, eh?

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

STEP 4

Reboot the system.

Sorry, uptime lords, you’re going to lose that super-long uptime you’ve been maintaining.  I find that it’s best to do a full restart every now and then to ensure the system is cleaned out, and more importantly that it will recover cleanly from an unexpected reboot.

I especially want to do a full system restart after a major upgrade to ensure that all of the new packages are working properly, and that there are no hidden surprises.

STEP 5

Verify your services are running properly, troubleshoot any issues.

Some major things broke for me during the upgrade to Debian 8.  Here’s what I ran into, and how I fixed it.

STEP 6

Tidy up by removing any unused packages.

sudo apt-get autoremove

And that’s it!  You’re now running with Jessie.