Upgrade Ubuntu 22 to Ubuntu 24
Description
In this article, we will describe the process of upgrading the OS from Ubuntu 22.04
to Ubuntu 24.04
.
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 Ubuntu 22.04 can be found below.
Ubuntu 22 repositories
### Main repo for Ubuntu jammy
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
### Updates repo for Ubuntu jammy
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
### Security repo for Ubuntu jammy
deb http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
### Backports repo for Ubuntu jammy
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
### Proposed repo for Ubuntu jammy
deb http://archive.ubuntu.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-proposed main restricted universe multiverse
- Update all current packages to the latest versions
apt update && apt dist-upgrade
- Resolve potential proftpd and apache2 upgrade errors
a2dismod php8.3
sed -e 's/^IdentLookups/#IdentLookups/' -i /etc/proftpd/proftpd.conf
- Run the upgrade
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
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
- Install PHP 8.3 with base modules, PHP8.3-FPM and the module for Apache2
apt install -f php php-fpm libapache2-mod-php libapache2-mod-php8.3 php-common php8.3-cgi php8.3-cli php8.3-common php8.3-curl php8.3-gd php8.3-mbstring php8.3-mysql php8.3-opcache php8.3-readline php8.3-xml php8.3-xmlrpc php-imagick php-memcached
phpenmod calendar ctype curl dom exif fileinfo ftp gd gettext 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
- Replace PHP-FPM configuration
mv /opt/php83/etc/php-fpm.d/* /etc/php/8.3/fpm/pool.d/
rm /etc/php/8.1/fpm/pool.d/www.conf
mv /etc/php/8.1/fpm/pool.d/* /opt/php81/etc/php-fpm.d/
- Remove PHP 8.1
apt purge php8.1*
- Activate PHP 8.3
a2enmod php8.3
- Correct PHP version in FASTPANEL base
sqlite3 /usr/local/fastpanel2/app/db/fastpanel2.db "update site set php_version = 83 where mode = 'mpm_itk';"
- Install the Dovecot component required for receiving mail
apt install dovecot-lmtpd
- Reconfigure services
mogwai services configure -f
- Restart the server
reboot
- Make sure that all services are started after reboot
systemctl --failed
Upgrade complete.