At Clouding, we have various images available for installation on servers. Even so, although we work daily to update Clouding's new features, an image may occasionally be unavailable. That is why we create articles like this one, which allow you to upgrade earlier versions to a new one so you can use the operating system you want.
Preparation
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"WARNING: MariaDB replaces the MySQL package in Debian 9 “Stretch”. This introduces a new binary database data file format that is not backward-compatible with the current database format (Debian 8 Jessie). During the upgrade, the databases will be upgraded automatically. However, if you encounter a problem during or after the upgrade, you will not be able to roll back. For this reason, it is important to back up all your current databases before proceeding with an upgrade to Debian 9 Stretch.
Fully updating Debian 8 “Jessie”
Before proceeding with the upgrade, let's fully update our current Debian 8 “Jessie” system:
# apt-get update
# apt-get upgrade
# apt-get dist-upgradeNOTE: Be careful when updating certain packages that come preconfigured in the Debian 8, image, since deleting the configuration may cause some configurations to fail later. For example, if there is an update to cloud-init, you will be asked whether you want to replace the existing configuration. If you choose yes, you will delete the configuration we created, and you may have problems when resizing resources.
If everything goes smoothly, check the database for partially installed, missing, and obsolete packages:
# dpkg -CIf no errors are reported, check the packages that are on hold:
# apt-mark showholdPackages on hold (in hold) will not be updated, which may cause inconsistencies after the upgrade to Stretch. Before moving on to the next part, we recommend resolving all issues reported by the two commands above.
Update repositories to Debian 9 “Stretch”
Now that our current system is fully up to date, it is time to resynchronize the repositories with new sources for Debian 9 “Stretch”. This is done by editing the file /etc/apt/sources.list to include the Debian 9 package repository. First, back up the /etc/apt/sources.list file currently in use:
# cp /etc/apt/sources.list /etc/apt/sources.list_backupTo do this, we need to replace “jessie” with “stretch” in the /etc/apt/sources.list file, using the sed command:
# sed -i 's/jessie/stretch/g' /etc/apt/sources.listOnce we have changed it, update the repositories:
# apt-get updateUpgrading Debian 8 to Debian 9
Before upgrading, we can see which packages have updates available with the following command:
# apt-get upgrade
# apt-get dist-upgradeDuring the upgrade, some configuration files will need to be updated. To avoid problems with our platform, we recommend keeping the files and not replacing them with new configurations.
Restart the server:
# rebootOnce it starts, we can check that Debian 9 “Stretch” is installed correctly:
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (Stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (Stretch)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"