Server Gigabit provides the latest versions of various popular Linux operating systems. This guide will walk you through the process of upgrading your server from an older version to the latest Debian (stable) or Ubuntu LTS.
Important Note:
-
Backup: Before proceeding with the upgrade, ensure you have a local backup of all critical files. The upgrade process might encounter issues, rendering your server inoperable.
-
Snapshot for VPS with 100% SSD: If you’re upgrading a VPS with 100% SSD storage, creating a snapshot beforehand will suffice for backup purposes.
-
Customization and Software: The upgrade process can vary depending on the level of customization and the amount of software installed on your system. A higher number of additional software packages increases the likelihood of package conflicts, which may require manual resolution.
Steps to Upgrade
Step 1: Preparation
Root Privileges: If you’re unsure about your administrative privileges, execute the following command at the beginning of each session to gain root access:
sudo -i
This command will grant you root-level privileges without the need to prefix every command with “sudo” on the command line.
Update Packages: Before proceeding, ensure your system has all pending updates for its software packages. If you haven’t installed updates recently, this might take some time.
apt-get update && apt-get upgrade -y
apt-get autoremove
Remove Unnecessary Packages: Remove any packages that were installed due to dependencies but are no longer needed.
apt-get autoremove
Step 2: Adjusting apt.conf (Debian)
(Applicable to Debian systems)
Replace “stretch” with “buster”: The following commands will replace all instances of “stretch” with “buster” in any repository entry within the apt.conf configuration files.
sed -i 's/stretch/buster/g' /etc/apt/sources.list
sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*
Verify Configuration: Usually, there shouldn’t be any additional package sources configured. Your sources list should have the following configuration:
cat /etc/apt/sources.list
deb http://asi-fs-n.contabo.net/debian buster main non-free contrib
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
deb http://asi-fs-n.contabo.net/debian buster-updates main contrib non-free
Step 3: Starting the Upgrade
a) Debian Upgrade
Clean and Update Packages: Start the upgrade process by cleaning and updating the package repositories.
apt clean && apt update
Perform Upgrade and Dist-Upgrade: Upgrade and dist-upgrade the installed packages.
apt upgrade -y
apt dist-upgrade -y
Autoremove Unused Packages: Remove any unused packages that were automatically installed during the upgrade process.
apt autoremove
Verify Upgrade: Verify the successful upgrade by checking the operating system release information.
cat /etc/os-release
The expected output should indicate the upgraded Debian version.
b) Ubuntu Upgrade
Ubuntu provides a dedicated tool, “do-release-upgrade,” to simplify the upgrade process to the next available LTS version. For instance, it will upgrade from 14.04 LTS to 16.04 LTS or from 16.04 LTS to 18.04 LTS.
do-release-upgrade
If the “do-release-upgrade” command is not found, indicating the tool is missing, install it using the following command:
apt-get install update-manager-core
Step 4: Restart Server
To apply the newly installed kernel, restart your server. Upon reboot, you’ll be running the latest version of Debian (stable) or Ubuntu LTS.
Conclusion
If you encounter any issues or have further inquiries, Contabo’s customer support team is available to assist you.