have Debian 9.x installed on AWS EC2. How do I upgrade Debian 9 Stretch to Debian 10 Buster using the apt command/apt-get command CLI? How can I upgrade Debian 9 to Debian 10 using ssh client?
Debian Linux 10 “Buster” released. The new version offers updated packages and five years of support. In this release, GNOME defaults to using the Wayland display server instead of Xorg. However, the Xorg display server still installed by default. This page shows how to update Debian 9 Stretch to Debian 10 Buster using command-line options, including upgrading all installed packages.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Debian Linux 9.x |
Est. reading time | 4 minutes |
What’s new in Debian 10?
- Updated desktop environments such as Cinnamon 3.8, GNOME 3.30, KDE Plasma 5.14, LXDE 0.99.2, LXQt 0.14, MATE 1.20, Xfce 4.12.
- Secure Boot support greatly improved
- AppArmor is installed and enabled by default
- Apache
- BIND
- Chromium
- Emacs
- Firefox
- GIMP
- GNU
- GnuPG
- Golang
- Inkscape
- LibreOffice
- Linux
- MariaDB
- OpenJDK
- Perl
- PHP
- PostgreSQL
- Python
- Ruby
- Rustc
- Samba
- systemd
- Thunderbird
- Vim
Upgrade Debian 9 to Debian 10 Buster
The procedure is as follows:
- Backup your system. Typically I create a snapshot.
- Update existing packages and reboot the Debian 9.x system.
- Edit the file /etc/apt/sources.list using a text editor and replace each instance of stretch with buster.
- Update the packages index on Debian Linux, run:
sudo apt update - Prepare for the operating system upgrade, run:
sudo apt upgrade - Finally, update Debian 9 to Debian 10 buster by running:
sudo apt full-upgrade - Reboot the Linux system so that you can boot into Debian 10 Buster
- Verify that everything is working correctly.
Let us examine all commands step by step to upgrade Debian 9 Stretch to Debian 10 Buster safety running in the cloud or bare metal environment.
Step 1. Backup your system
Warning! Do not skip the backup step. The author and nixCraft are not responsible for data loss and failed installation.
It is crucial to backup all data and system configurations. Cloud-based VMs can be quickly backup and restore using snapshots. I use rsnapshot, which is the perfect solution for making backups on the local or remote servers. Check os version in Linux:
lsb_release -a
Sample outputs:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.12 (stretch) Release: 9.12 Codename: stretch
Note down the Linux kernel version too:
uname -mrs
Sample outputs:
Linux 4.9.0-12-amd64 x86_64
Step 2. Update ALL existing installed packages
Before you upgrade your Debian version to 10, you must apply all security patches and pending upgrades to Debian 9 itself Hence, Type the following apt command or apt-get command:
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt --purge autoremove
OR
sudo apt-get update
sudo apt-get upgrade
sudo apt-get full-upgrade
sudo apt-get --purge autoremove
Reboot the Debian 9.x stretch to apply the kernel and other updates:
sudo reboot
Step 3. Update /etc/apt/sources.list file
Before starting the upgrade you must reconfigure APT’s source-list files. To view current settings using the cat command:
cat /etc/apt/sources.list
Sample outputs:
deb http://cdn-aws.deb.debian.org/debian stretch main deb http://security.debian.org/debian-security stretch/updates main deb http://cdn-aws.deb.debian.org/debian stretch-updates main
The stretch indicates that we are using an older version. Hence, we must change all the references in this file from Stretch to Buster using a text editor such as vim:
vi /etc/apt/sources.list
I prefer to use sed tool, but first backup all config files using the cp command:
sudo cp -v /etc/apt/sources.list /root/
sudo cp -rv /etc/apt/sources.list.d/ /root/
sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*
### see updated file now ###
cat /etc/apt/sources.list
Updating the package list
Simply run:
sudo apt update
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
- If your domain is not sending email, set these DNS settings to avoid spoofing and phishing
Step 4. Minimal system upgrade
A two-part process is necessary to avoid the removal of large numbers of packages that you want to keep. Therefore, first run the following:
sudo apt upgrade
Just follow on-screen instructions. During the upgrade process, you may get various questions, like “Do you want to restart the service? ” OR “keep or erase config options” and so on. For example, I got a screen as follows indicating new changes:
Press ‘q‘ to exit and further you may see additional screens:
And:
Step 5. Upgrading Debain 9 to Debian 10
In addition, minimum upgrades we need to do full upgrades to finish the whole Debian 9 to Debian 10 update process. This is the main part of the upgrade. In other words, execute the following command to perform a complete upgrade of the system, installing the newest available versions of all packages, and resolving all possible dependency:
sudo apt full-upgrade
Reboot the Linux system to boot into Debian Linux 10 buster, issue:
sudo reboot
Step 6. Verification
It is time to confirm the upgrade. Run:
uname -r
lsb_release -a
Sample outputs:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
Finally, clean up outdated packages using the apt command/apt-get command:
sudo apt --purge autoremove
Conclusion
And there you have it. We have successfully upgraded to Debian Linux 10. Updated Debian 10 version always brings new features and hardware support via Linux kernel. Hence, one must evaluate needs and then do upgrades. Debian project also posted an in-depth guide that explains other issues one might face during installation.