How to Import Remi Repository on CentOS 9 Stream


REMI is a third-party repository that provides us with the latest PHP versions on RHEL-derived systems. However, it is not only limited to PHP but also many of its modules. If you are an active PHP developer, you must enable this repository almost mandatory. An excellent aspect of the repository and its creator is that it is very well documented, so even a newbie can set it up and update their system in a matter of minutes following the repository documentation.

Another significant advantage of using REMI over other third-party repositories or compiling PHP from the source is that it keeps the RPM packaging consistent with the official repositories. As a result, you will not have any issues when trying to install other software that has dependencies on PHP from the official repositories. All in all, REMI is an essential repository for anyone running an RHEL-derived distribution who wants to stay up-to-date with the latest version of PHP.

In the following tutorial, you will learn how to import the Remi Repository on CentOS 9 Stream for users who would prefer to install the latest version of the PHP branch they have installed on their system using the command line terminal.

Update CentOS Stream

First, update your system to ensure all existing packages are up to date. This will ensure no conflicts arise as best as possible during the installation.

sudo dnf upgrade --refresh -y

Import PHP Remi Repository

The first task is to install the (EPEL) repository, which stands for (Extra Packages for Enterprise Linux). For newer users of CentOS Stream and similar distributions based on RHEL, EPEL contains the most commonly used software packages for Enterprise Linux.


First, enable the CRB.

sudo dnf config-manager --set-enabled crb

Next, install EPEL using the following (dnf) terminal command.

sudo dnf install \ \

Now that you have added the EPEL repository enable the (Remi repository) with the following command.

sudo dnf install dnf-utils -y

Situational – Remove Existing PHP Installation

Often you can upgrade directly over an existing version of PHP, but usually, for significant upgrades, it can be best to remove PHP and re-install. For users that would like to do this, use the following steps.

Make sure to back up any configuration files.

sudo dnf remove php php-fpm -y

Then remove the rest of the package extensions.


sudo dnf remove php* -y

To reset the PHP module list is easy with the following command:

sudo dnf module list reset php -y

Now you can proceed to the next part of the tutorial.

Enable Remi Repository

A quick tip is to use the dnf module list command to see the options available and the default.

The following dnf module list command can do this:

dnf module list php

You will be prompted to import the GPG key for Remi’s repository. Type (Y) to proceed if you encounter it.

Example output:


How to Import Remi Repository on CentOS 9 Stream

Next, enable the PHP version that is listed you would prefer to work with.


Enable PHP 7.4

sudo dnf module enable php:remi-7.4 -y

Enable PHP 8.0

sudo dnf module enable php:remi-8.0 -y

Enable PHP 8.1

sudo dnf module enable php:remi-8.1 -y

Once done, install PHP as you usually would.

sudo dnf install php

Please note that you can also install development alpha or beta versions. The module, until fully released, which is in alpha status at the time of the tutorial, is PHP 8.2 and is ported, so you can search for it as follows.

sudo dnf search php82

Example output:

How to Import Remi Repository on CentOS 9 Stream

Next, you can install specific versions side by side using the php{version}, then the modules with php{version}-php-{module}. Below is an example install PHP and PHP-FPM.


sudo dnf install php82 php82-php-fpm

Example output:

How to Import Remi Repository on CentOS 9 Stream

Please note, installing alpha PHP versions is for upstream testing for websites or developers, do not deploy this on a live website unless you have very specific reasons too.

Comments and Conclusion

REMI has quickly become an essential part of my workflow as a developer, and I would recommend it to anyone looking for an easy way to keep up with the latest versions of PHP and its modules. If you have not yet taken advantage of this repository,

Share on: