How to Install Remi RPM Repository on AlmaLinux 9

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. Being 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 no time. Another great thing about this repository is its frequent updates, which means you’ll always have access to the latest versions of PHP and its modules. So if you’re looking for a reliable way to keep your system up-to-date, REMI is worth checking out.

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

Update AlmaLinux

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 AlmaLinux 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 \
    https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

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

sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm -y

Enable Remi PHP 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 Install/Enable Remi RPM Repository on AlmaLinux 9

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

Example:

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.

dnf search php82

Example output:

How to Install/Enable Remi RPM Repository on AlmaLinux 9

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 Install/Enable Remi RPM Repository on AlmaLinux 9

Please note that installing alpha PHP versions is for upstream testing for websites or developers; do not deploy this on a live website unless you have particular reasons.

Enable Additional Remi RPM Repositories

The main focus for Remi RPM repositories is known chiefly for PHP. However, the RPM also supports Redis and Memcached for the latest or LTS versions that are still supported.

These can be imported as follows.

Enable Memcached RPM

sudo dnf module enable memcached:remi

Enable Remi Redis RPM

sudo dnf module enable redis:remi-{version}

Replace {version} with your desired version.

Enable Redis 7.0:



sudo dnf module enable redis:remi-7.0 -y

Enable Redis 6.2:

sudo dnf module enable redis:remi-6.2 -y

Enable Redis 5.0:

sudo dnf module enable redis:remi-5.0 -y

From here, upgrade or install as you see fit, or list the packages using the same method as the PHP instructions above, replacing PHP with Redis, for example.

Comments and Conclusion

REMI is an excellent resource for keeping your PHP installation up-to-date and secure. It is well documented, so you should have no trouble setting it up on your system. Be sure to enable the repository and keep your system updated with the latest versions of PHP and its modules.


Not what you were looking for? Try searching for additional tutorials.

Leave a Comment