Skip to main content

Upgrade Debian 9 to Debian 10


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



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.


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 stretch main contrib non-free
deb-src stretch main contrib non-free

deb stretch/updates main contrib non-free
deb-src stretch/updates main contrib non-free

deb stretch-backports main contrib non-free
deb-src 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 buster main contrib non-free
deb-src buster main contrib non-free

deb buster-updates main contrib non-free
deb-src buster-updates main contrib non-free

deb buster/updates main contrib non-free
deb-src 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 - |apt-key add -  

wget -q -O - |apt-key add -

apt-key adv --keyserver --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

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

Upgrade complete