July 2023

Migration Guide: CentOS to AlmaLinux, Rocky Linux and Other Alternatives

CentOS 8 Reached End-of-Life on December 31, 2021

With Red Hat officially ending support for CentOS 8, users are forced to migrate to a different operating system. While CentOS 7 remains supported till end of 2024, the life cycle of the newer CentOS 8 was cut short by Red Hat for the end of 2021. Red Hat’s decision to end the CentOS 8 support remains highly controversial in the Linux community and it has stirred a lot of criticism. While the EOL of CentoOS 8 is a fact, we’re going to focus on recommending reasonable alternatives that can swiftly replace no longer supported CentOS 8.

Alternatives to CentOS 8

If your server runs CentOS, then the natural solution seems to migrate to other distribution based on Red Hat Enterprise Linux (RHEL) code. Migrating to one of the recommended RHEL derivatives will ensure a seamless experience and uninterrupted performance regardless of what you run on the server. We describe 4 RHEL derivatives in this article:

• AlmaLinux
• Rocky Linux
• Oracle Linux
• CentOS Stream

All of them aim to be 100% binary compatible with the original CentOS, meaning your current projects running on CentOS should run on each of them in the same way. From a technical perspective and from user’s experience, there is not much of a difference between the original CentOS 8 and the above-mentioned distributions.

The decision on which distribution to migrate is less about the functionality of the operating system and more about how it’s developed and maintained. Some of the alternatives are free community projects, while others are backed by large-scale commercial businesses.

AlmaLinux

First distribution we will cover is AlmaLinux, an increasingly popular semi-commercial project.

AlmaLinux is developed as a direct successor for CentOS. It is the binary equivalent to CentOS 8. But unlike Rocky Linux, the development is run by a private company. CloudLinux is a company that founded and funded the AlmaLinux OS foundation. CloudLinux invested approximately $1 million to develop AlmaLinux, after Red Hat announced discontinued support for CentOS 8. The combination of private funding and a strong community makes this distribution very promising.

This distribution is widely recognized in the IT community. For example, cPanel, developers of a popular server management panel, decided to support AlmaLinux from day one. And so did Plesk. The endorsement from both well-known panels’ developers is not only a matter of reputation, but it also guarantees easy migration for all users working with these panels.

Key features:

  • Backed by a reputable company
  • Active community
  • Works with cPanel and Plesk

Rocky Linux

When Red Hat announced the end of support for CentOS 8, one of the co-founders of the original CentOS operating system stepped in. Henry Kurtzer founded CentOS together with his colleague Rocky McGaugh in 2004. When Kurtzer decided to start working on a new substitute for CentOS, he named the new operating system after the late Rocky McGaugh. As all other alternatives mentioned in this article, the Rocky Linux distribution is based on the RHEL code, which means there are only marginal differences in code in comparison to CentOS.

Rocky Linux is an independent project with a free community support. The stable release 8.4 was released in June 2021 under the codename “Green Obsidian”. From all mentioned distributions, this is the youngest distribution, and one that is still under construction.

Since mid-2021, Henry Kurtzer has been offering paid support plans via his CIQ company, trying to offer “enterprise-grade” services . Still, the Rocky Linux distribution is at heart a community project preserving the original open-source spirit.

Key features:

  • Active community
  • Lead by CentOS founder
  • Slower release cycle
  • Young project
  • Plesk / cPanel support is missing

CentOS Stream

CentOS Stream is an alternative to CentOS 8 that comes directly from Red Hat. The main difference is that it has a different release cycle than other CentOS8 alternatives. It’s a rolling release of the RHEL, meaning that there are almost constant updates with all the newest developments in the code of the core, libraries and applications:

On one hand this means access to the newest software very quickly, on the other hand there is a higher risk of compatibility issues. It is a great idea for a development sandbox, but not necessarily for a production system.

Key features:

  • Backed by a renowned company
  • Constantly Updated

Oracle Linux

One of the less mentioned alternatives is using Linux from Oracle. Like all other alternatives, Oracle’s Linux is 100 percent binary compatible with the original Red Hat distribution. And that makes it also very close to the CentOS distribution – Oracle ensures that their Linux is fully compatible with existing CentOS 8 apps.

The biggest advantage of Oracle Linux is obvious – the support of one of the most prominent IT companies. The customer support isn’t free, but everything else is. Some users also consider as an advantage the possibility to perform updates via the yum server.

On the other hand, many users are now discouraged from using Linux distributions developed by corporations. They argue that after Red Hat discontinued support of CentOS, Oracle Linux can end up doing the same. But at least for now, the Oracle Linux remains a perfectly viable alternative, especially if you can afford their support.

Key Features:

  • Backed by a renowned company

Contabo Recommendation

All distributions mentioned above are very close to the original CentOS 8. Developers of all mentioned distributions also made it easy to migrate using just a few commands.

Your decision which alternative to use should be based on who stands behind each project. Do you trust an open community like Rocky Linux or are you more keen on projects backed by big corporations like Oracle?

If we were to recommend just one distribution, it would undoubtedly be AlmaLinux. It has the stability thanks to the backing of CloudLinux and the energy coming from the community. That’s why we recommend AlmaLinux as a safe bet for CentOS 8 users.

How to Migrate from CentOS 8

Video Guide

Below, you will find a brief description of the migration process for AlmaLinux, Rocky Linux, CentOS Stream and Oracle Linux.

Don’t forget to back up your data before performing the migration. If you don’t care about the data on the instance, you can simply reinstall the virtual machine without performing a migration. Contabo customers can do this in Contabo Customer Panel and choose AlmaLinux, Rocky Linux or CentOS Stream.

First, log in to your instance using SSH. Also, please make sure you have sufficient admin rights first. The easiest way how to avoid admin rights issues is to enter the command sudo -i at the beginning of each session:
sudo -i

How to migrate from CentOS 8 to AlmaLinux

Before migrating, update your current distribution by running this command:
dnf update

Download the distribution from GitHub using
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

Assign all necessary permissions to the script:
chmod +x almalinux-deploy.sh

Now run the script by typing
./almalinux-deploy.sh

And finally
reboot

How to migrate from CentOS 8 to Rocky Linux

Before migrating, update your current distribution by running this command:
dnf update

Rocky Linux developers have created a script called migrate2rocky. To obtain the distribution, just download it using this command:
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh

When the file has been finished downloading, give the script all necessary permissions by
chmod u+x migrate2rocky.sh

Now execute the script itself:
./migrate2rocky.sh -r

And finally
reboot

How to migrate from CentOS 8 to CentOS Stream

Before migrating, update your current distribution by running this command:
dnf update

Start the installation by typing:
dnf install centos-release-stream

After the installation is done, you have to change the repository for CentOS Stream:
dnf swap centos-linux-repos centos-stream-repos

And at last, let’s sync all your existing packages with the new distribution:
dnf distro-sync

and finally
reboot

How to Migrate From CentOS 8 to Oracle Linux

Before migrating, update your current distribution by running this command:
dnf update

Download the distribution from GitHub:
curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh

Now run this command to replace your CentOS 8 with the Oracle:
./centos2ol.sh

And finally
reboot

How to Install Laravel on Ubuntu 22.04 with Nginx

How To Install and Configure Laravel with Nginx on Ubuntu 22.04

Just follow the following steps to install and configure laravel with Nginx on ubuntu 22.04:

  • Step 1 – Install Required PHP Modules
  • Step 2 – Creating a Database for Laravel
  • Step 3 – Install Composer in Ubuntu 22.04
  • Step 4 – Install Laravel in Ubuntu 22.04
  • Step 5 – Configure Laravel in Ubuntu 22.04
  • Step 6 – Configure NGINX to Serve Laravel Application
  • Step 7 – Accessing Laravel Application from a Web Browser

Step 1 – Install Required PHP Modules

First of all, install required php modules, so open command prompt and execute the following command to install required php modules:

$ sudo apt update
$ sudo apt php-common php-json php-mbstring php-zip php-xml php-tokenizer

Step 2 – Creating a Database for Laravel

Create a MySQL database for Laravel application; so execute the following command on command line to create database for laravel app:

$ sudo mysql
MariaDB [(none)]> CREATE DATABASE laraveldb;
MariaDB [(none)]> GRANT ALL ON laraveldb.* to 'webmaster'@'localhost' IDENTIFIED BY 'tecmint';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit

Step 3 – Install Composer in Ubuntu 22.04

Then use the following command to install composer (a dependency manager for PHP) on ubuntu 22.04 system:

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composer

Step 4 – Install Laravel in Ubuntu 22.04

Once the composer installation has been done; execute the following command on command line to install laravel apps in ubuntu 22.04 system:

$ cd /var/www/html
$ composer create-project --prefer-dist laravel/laravel example.com

Step 5 – Configure Laravel in Ubuntu 22.04

Now configure laravel apps using the following commands:

Set permissions on the Laravel directory using the following command:

$ sudo chown -R :www-data /var/www/html/example.com/storage/
$ sudo chown -R :www-data /var/www/html/example.com/bootstrap/cache/
$ sudo chmod -R 0777 /var/www/html/example.com/storage/

he default .env contains a default application key but you need to generate a new one for your laravel deployment for security purposes.

$ sudo php artisan key:generate

We also need to configure the Laravel database connection details in .env as shown in the following screenshot.

$ sudo nano /var/www/html/example.com/.env

Step 6 – Configure NGINX to Serve Laravel Application

Create a server block for it within the NGINX configuration, under the /etc/nginx/sites-available/ directory:

$ sudo nano /etc/nginx/sites-available/example.com.conf

Also, set the fastcgi_pass directive should point to the medium PHP-FPM is listening on for requests (for example fastcgi_pass unix:/run/php/php7.4-fpm.sock):

server{
        server_name www.example.com;
        root        /var/www/html/example.com/public;
        index       index.php;

        charset utf-8;
        gzip on;
        gzip_types text/css application/javascript text/javascript application/x-javascript  image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php {
                include fastcgi.conf;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        }
        location ~ /\.ht {
                deny all;
        }
}

Save the file and then enable the Laravel site configuration by creating a link from /etc/nginx/sites-available/example.com.conf to the /etc/nginx/sites-enabled/ directory. Besides, remove the default server block configuration.

$ sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/
$ sudo rm /etc/nginx/sites-enabled/default

Next, check if the NGINX configuration syntax is correct by running the following command before restarting the service.

$ sudo nginx -t
$ sudo systemctl restart nginx

Step 7 – Accessing Laravel Application from a Web Browser

Now open a web browser on the local computer and use the following address to navigate.

http://www.example.com/

Conclusion

Through this tutorial, we have learned how to install and configure laravel on ubuntu 22.04 with nginx.

Free Web Hosting