Upgrade Debian 10 to Debian 11
Description
In this article, we will describe the process of upgrading the OS from Debian 10
to Debian 11
.
Upgrading
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.
- Make sure you have the correct repositories in
/etc/apt/sources.list
. The list of repositories for Debian 9 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
- Update all current packages to the latest versions
apt update && apt dist-upgrade
- Replace the list of repositories in
/etc/apt/sources.list
to those from Debian 11. The list of repositories for Debian 11 can be found below.
Debian 11 repositories
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
- Resolve potential proftpd update errors
sed -e 's/^IdentLookups/#IdentLookups/' -i /etc/proftpd/proftpd.conf
- Update packages. Run the following commands one at a time
apt update
apt upgrade
apt dist-upgrade
- Update other repositories
sed -i 's|buster|bullseye|g' /etc/apt/sources.list.d/*.list
- Add nginx repository keys
wget -q -O - http://nginx.org/keys/nginx_signing.key |apt-key add -
The Debian 11 repository does not have older versions of the database servers. To upgrade further, you need to specify versions 8.0 and 10.5 for MySQL and MariaDB respectively in /etc/apt/sources.list.d/. You can find out the current database server version by executing the command
mysql -V
If MySQL is used, change the package version and add the repository key:
sed -i 's/mysql-5.7/mysql-8.0/g' /etc/apt/sources.list.d/mysql.list
wget -q -O - http://repo.mysql.com/RPM-GPG-KEY-mysql |apt-key add -
For MariaDB less then 10.5 use:
sed -i 's/10.[0-4]/10.9/' /etc/apt/sources.list.d/mariadb.list
- Update packages
apt update
apt dist-upgrade
- Install PHP 7.3 with base modules, PHP7.3-FPM and the Apache2 module
dpkg -l | awk '/php7.3/ {print $2}' | sed -e 's/7.3/7.4/' | xargs apt install -y
apt install -f php php-fpm libapache2-mod-php libapache2-mod-php7.4 php-common php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-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
- Replace PHP-FPM configurations
mv /opt/php74/etc/php-fpm.d/* /etc/php/7.4/fpm/pool.d/
rm /etc/php/7.3/fpm/pool.d/www.conf
mv /etc/php/7.3/fpm/pool.d/* /opt/php73/etc/php-fpm.d/
- Remove PHP 7.3
apt purge php7.3*
- Activate PHP 7.4
a2enmod php7.4
- Correct PHP version in FASTPANEL base
sqlite3 /usr/local/fastpanel2/app/db/fastpanel2.db "update site set php_version = 74 where mode = 'mpm_itk';"
- Install the Dovecot component required for receiving mail
apt install dovecot-lmtpd
- Reconfigure services
mogwai services configure -f
- Additional configuration depending on the database server used
For MySQL 8
- add compatibility settings
echo 'disable-log-bin
mysqlx = OFF
default-authentication-plugin = mysql_native_password
character-set-server = utf8
collation-server = utf8_unicode_ci
' >> /etc/mysql/my.cnf.fastpanel/99-fastpanel.cnf
For MariaDB
- run mysql_upgrade
mysql_upgrade
- Restart the server
reboot
- Make sure that all services are started after reboot
systemctl --failed
Upgrade complete.