Skip to main content

Upgrade Ubuntu 18 to Ubuntu 20

Description

In this article, we will describe the process of upgrading the OS from Ubuntu 18.04 to Ubuntu 20.04.

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 Ubuntu 18.04 can be found below.
Ubuntu 18 repositories
deb https://mirrors.xtom.ee/ubuntu/ bionic main restricted universe multiverse  
deb-src https://mirrors.xtom.ee/ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.xtom.ee/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.xtom.ee/ubuntu/ bionic-updates main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

deb https://mirrors.xtom.ee/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.xtom.ee/ubuntu/ bionic-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
  1. Update all current packages to the latest versions
apt update && apt dist-upgrade
  1. Resolve potential proftpd and apache2 upgrade errors
a2dismod php7.2
sed -e 's/^IdentLookups/#IdentLookups/' -i /etc/proftpd/proftpd.conf
  1. Remove all query-cache entries from the mysql configuration and adjust the mysql repository:
sed -i 's/^query[_,-]cache[^ ]*//' /etc/mysql/my.cnf.fastpanel/99-fastpanel.cnf
  1. Run the update
do-release-upgrade --allow-third-party

If for some reason the utility is not installed, you can fix it with the command

apt install update-manager-core
important

Carefully read the output of the utility before confirming, make sure that nothing unnecessary will be deleted in the process.

The upgrade is considered successful if the system prompts you to restart the server.

Accept the reboot

  1. Install PHP 7.4 with base modules, PHP7.4-FPM and the module for Apache2
apt-get 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 json iconv mbstring mysqli mysqlnd pdo pdo_mysql phar posix readline shmop simplexml sockets sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlrpc xmlwriter xsl opcache imagick memcached
  1. Replace PHP-FPM configuration
mv /opt/php74/etc/php-fpm.d/* /etc/php/7.4/fpm/pool.d/
rm /etc/php/7.2/fpm/pool.d/www.conf
mv /etc/php/7.2/fpm/pool.d/* /etc/php/7.4/fpm/pool.d/
  1. Correct PHP version in FASTPANEL base
sqlite3 /usr/local/fastpanel2/app/db/fastpanel2.db "update site set php_version = 74 where mode = 'mpm_itk';"
  1. Reconfigure services
mogwai services configure -f
  1. 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
  1. Restart the server
reboot
  1. Make sure that all services are started after reboot
systemctl --failed

Upgrade complete.