Darryl Dias

Upgrade from Debian 8 Jessie to 9 Stretch on Digital Ocean

Debian 9.5 Stretch is the latest release, at the time of writing this post.

It is a tried and tested method, but I highly recommend taking snapshots and backup of your data, before proceeding with these sets of instructions.

MariaDB will be replacing MySQL in Stretch and it uses new binary data file format/structure, which does not offer backward compatibility to MySQL. The switching to the new binary format will occur in the upgrade process automatically. You may run into issues after the upgrade and this step cannot be reversed

It is highly recommended that you do a complete database backup before continuing

I had no issues with the upgrade as I was already using MariaDB as my database of choice.

These are the steps I followed to upgrade to Stretch from Jessie.

Updating packages.

sudo apt update && apt upgrade

Creating a backup of the sources.list.

cp /etc/apt/sources.list /etc/apt/sources.list.jessie-version

Converting Jessie mirrors to Stretch.

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

You can verify that the command above has successfully worked by looking into the file with the help of nano.

The sources.list before the command.

deb http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main

The sources.list after the command.

deb http://httpredir.debian.org/debian stretch main
deb http://httpredir.debian.org/debian stretch-updates main
deb http://security.debian.org stretch/updates main

Update the packages towards Stretch release.

sudo apt update && apt upgrade

Do a distribution upgrade.

sudo apt dist-upgrade

You can overwrite all the files to the maintainer's version as you desire, but when it gives you the option to decided over the editing of /etc/cloud choose N.

The cloud-init module is specific to Digital Ocean droplet and should not be overwritten if overwritten the VPS might have some issues with interacting with other Digital Ocean modules.

That's it, folks.

If you have any questions leave a comment below.