Hello, friends. In this simple post, you will learn how to enable REMI repository in CentOS 9 Stream. This way, you will be able to have multiple PHP versions or upgrade the one you already have on the system. Let’s go.
The REMI repository
REMI is a third-party repository that provides us with the latest versions of PHP on RHEL-derived systems. However, it is not only limited to PHP, but also to many of its modules. This makes that if you are an active PHP developer, then you have to enable this repository almost mandatory.
An excellent aspect that has the repository and its creator is that it is very well documented. Making that, we can solve any doubt about its use and operation.
So let’s go for it.
Enable REMI repository in CentOS 9 Stream
To enable this repository, we need to meet some important requirements. First, we need to update the system completely
sudo dnf update
Thereafter, we will have to enable the EPEL repository. When it is enabled, we can continue.
To enable the REMI repository, we just have to run the following command
sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm
Then you can refresh DNF so that it automatically imports the necessary GPG keys
sudo dnf update --refresh
And with this, you can use the REMI repository.
Example: Installing PHP 8.1 on CentOS 9 Stream
In this section, you will learn how to install PHP 8.1 to show how it works and how to use REMI.
In the official CentOS 9 Stream repositories, PHP 8 is included, so we must disable the corresponding module.
sudo dnf module reset php
Then, list the modules available in the system:
sudo dnf module list php
As you can see, PHP 8.1 is available. Enable that module:
sudo dnf module enable php:remi-8.1
And now you can install PHP.
sudo dnf install php
REMI is a special repository that helps us to better manage PHP on the system. It is ideal for developers, but for those sysadmins who need it to deploy the necessary applications.