Skip to main content

Upgrade Debian 9 to Debian 10

Description

In this article, we will describe the process of upgrading the OS from Debian 9 to Debian 10.

Upgrading

WARNING

Before upgrading the operating system, we strongly recommend making a full backup of all data on the server. This will serve as an insurance policy in case of problems, allowing you to restore the system in the event of an emergency.

important

All commands during OS upgrade are executed in the server terminal under the root user.

Refuse system suggestions to replace configuration files (default action).

The names of repository files in /etc/apt/sources.list.d of your OS may be different from those used in these instructions.

  1. Make sure you have the correct repositories in /etc/apt/sources.list . The list of repositories for Debian 9 can be found below.
Debian 9 repositories
deb http://archive.debian.org/debian/ stretch main contrib non-free
deb-src http://archive.debian.org/debian/ stretch main contrib non-free

deb http://archive.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://archive.debian.org/debian-security/ stretch/updates main contrib non-free

deb http://archive.debian.org/debian/ stretch-backports main contrib non-free
deb-src http://archive.debian.org/debian/ stretch-backports main contrib non-free
  1. Update all current packages to the latest versions
apt update && apt dist-upgrade
  1. Replace the list of repositories in /etc/apt/sources.list to repositories from Debian 10. The list of repositories for Debian 10 can be found below.
Debian 10 repositories
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free

deb http://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free

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
  1. Update packages. Run the following commands one at a time
apt update
apt upgrade
apt dist-upgrade
  1. Update other repositories
sed -i 's|stretch|buster|g' /etc/apt/sources.list.d/*.list
  1. Add repository keys from MySQL and nginx
wget -q -O - http://repo.mysql.com/RPM-GPG-KEY-mysql |apt-key add -  

wget -q -O - http://nginx.org/keys/nginx_signing.key |apt-key add -

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
  1. Update packages
apt update

apt dist-upgrade
  1. Install PHP 7.3 with base modules, PHP7.3-FPM and the Apache2 module
dpkg -l | awk '/php7.0/ {print $2}' | sed -e 's/7.0/7.3/' | grep -v mcrypt | xargs apt install -y 

apt install -f php php-fpm libapache2-mod-php libapache2-mod-php7.3 php-common php7.3-cgi php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline php7.3-xml php7.3-xmlrpc php-imagick php-memcached

phpenmod calendar ctype curl dom exif fileinfo ftp gd gettext iconv json mbstring mysqli mysqlnd pdo pdo_mysql phar posix readline shmop simplexml sockets sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl opcache imagick memcached
  1. Replace PHP-FPM configurations
mv /opt/php73/etc/php-fpm.d/* /etc/php/7.3/fpm/pool.d/

rm /etc/php/7.0/fpm/pool.d/www.conf

mv /etc/php/7.0/fpm/pool.d/* /etc/php/7.3/fpm/pool.d/
  1. Remove PHP 7.0
apt purge php7.0*
  1. Activate PHP 7.3
a2enmod php7.3
  1. Correct PHP version in FASTPANEL base
sqlite3 /usr/local/fastpanel2/app/db/fastpanel2.db "update site set php_version = 73 where mode = 'mpm_itk';"
  1. Fixing dovecot
mv /etc/dovecot/private/dovecot{.pem,.key}
mv /etc/dovecot/dovecot.pem /etc/dovecot/private/dovecot.pem

apt install dovecot-lmtpd
  1. Reconfigure services
mogwai services configure -f
  1. Reboot the server
reboot
  1. Make sure that all services are started after reboot
systemctl --failed

Upgrade complete