How to Install Remi RPM on Rocky Linux 9 or 8

Remi’s RPM repository is an essential tool for users who need access to the latest versions of PHP, Memcached, Redis, and other related software on enterprise-grade distributions like Rocky Linux. By utilizing this repository, administrators can maintain updated software packages without relying on slower-moving base repositories. Remi’s repository is especially useful for developers and system administrators who require newer software for compatibility, security, or performance reasons. With support for multiple PHP versions and timely updates, this repository plays a critical role in maintaining a stable and secure environment for web servers and other applications running on Rocky Linux.

Installing Remi’s RPM repository on Rocky Linux 9 or its earlier enterprise-supported version, Rocky Linux 8, is a straightforward process via the command-line terminal. This method ensures full control over the repository configuration and allows for easy version selection when installing PHP or other packages. By adding and enabling Remi’s repository, users gain access to the latest stable releases of critical software components while still retaining the robust features of their Rocky Linux systems.

Updating Rocky Linux Before Remi RPM Import

Embarking on this journey, the first step is to ensure our Rocky Linux system is current. Upgrading existing packages minimizes the risk of conflicts arising during new installations. This essential prerequisite sets a clean stage for the subsequent steps. Let’s go ahead and refresh our system:

sudo dnf upgrade --refresh

This command will upgrade all the packages in your Rocky Linux system to their latest versions.

Import Remi Repository on Rocky Linux 9 or 8

Having updated our system, it’s time to import the Remi repository. However, before we do that, we must take an intermediate step: installing the EPEL (Extra Packages for Enterprise Linux) repository.

The EPEL repository is a beneficial resource for RHEL-based distributions like Rocky Linux. It presents a treasure trove of software packages frequently employed in Enterprise Linux environments.

Note: We must import the Remi RPM corresponding to our specific distribution version, as this guide covers Rocky Linux 8 and Rocky Linux 9. Let’s get into the specifics.

Importing the Remi PHP Repository for Rocky Linux 9

To kick things off, we must activate the CRB. This is achieved through the following command:

sudo dnf config-manager --set-enabled crb

Having activated the Code Ready Builder (CRB), it’s time to install both versions of the Extra Packages for Enterprise Linux (EPEL) repository. Let’s do that with this 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

With EPEL installed, we can now add the Remi repository for Enterprise Linux 9 to our system by executing the following command:

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

Importing the Remi PHP Repository for Rocky Linux 8

For Rocky Linux 8, we follow a similar sequence, starting with activating the EPEL repository. The following command will get that done:

sudo dnf install \
    https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm

Upon successful activation of EPEL, we proceed to import the Remi Enterprise Linux 8 repository using the command:

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

Enable Remi PHP Repository

Listing Available PHP Modules

By integrating the Remi RPM repository into our system, we have unlocked the door to the latest versions of the PHP branch that we might want to use in our server stack. This is an essential capability, especially for developers switching between different PHP versions for various projects.

To understand the supported PHP versions, let’s execute the following command. This will provide us with a comprehensive list of all available PHP modules:

sudo dnf module list php
Listing PHP modules from Remi RPM repository on Rocky Linux
Output of PHP modules listed from Remi RPM repository on a Rocky Linux system.

The command above queries the DNF module and fetches a list of all PHP versions available for installation through our recently integrated Remi repository.

Select and Enable the Desired PHP Version via Remi RPM

After perusing the available PHP modules, we can now make an informed choice on the PHP version that best suits our needs. We can then enable the selected version on our Rocky Linux system.

Below are examples of commands that enable different PHP versions. Choose the one that corresponds to your desired PHP version:

sudo dnf module enable php:remi-7.4 -y
sudo dnf module enable php:remi-8.0 -y
sudo dnf module enable php:remi-8.1 -y
sudo dnf module enable php:remi-8.2 -y
sudo dnf module enable php:remi-8.3 -y

Install Enabled PHP Version

Once the desired version of PHP has been selected and enabled, we’re ready to proceed with the installation process. To install the enabled PHP version, we execute the usual installation command:

sudo dnf install php

This command kicks off the installation process for the PHP version that we have enabled. Once the process is completed, the chosen PHP version will be ready for use on our Rocky Linux system.

Enable Additional Remi RPM Repositories

The Remi RPM repository is not a one-trick pony. In addition to PHP, it provides support for the latest versions of two very popular caching tools: Redis and Memcached. By tapping into these additional repositories, we can streamline our setup process and ensure we use our server stack’s most up-to-date and efficient tools.

Enable and Install Memcached via Remi RPM

Memcached is a high-performance, distributed memory object caching system that is generic in nature but intended for speeding up dynamic web applications by alleviating database load.

Let’s enable the Memcached repository from Remi RPM using the following command:

sudo dnf module enable memcached:remi

This command instructs our system to activate the Memcached repository within Remi RPM.

Following the enablement, we proceed with the installation process of Memcached:

sudo dnf install memcached

With this command, we initiate the installation of Memcached on our Rocky Linux system.

Enable and Install Redis via Remi RPM

Redis is an open-source, in-memory data structure store used as a database, cache, and message broker. It supports various data structures and is known for its speed and flexibility.

To enable Redis from the Remi repository, use the following command, replacing {version} with your desired version:

sudo dnf module enable redis:remi-{version}

For instance, if you intend to use Redis 7.0, replace {version} with 7.0 as follows:

sudo dnf module enable redis:remi-7.0 -y

Note: Redis 7.0 is an example only; other higher versions may be available; you must adjust the command accordingly.

If you prefer to use Redis 6.2 or 5.0, replace {version} accordingly:

sudo dnf module enable redis:remi-6.2 -y
sudo dnf module enable redis:remi-5.0 -y

The above commands instruct the system to activate the Redis branch within Remi RPM.

Once the desired Redis branch has been enabled, we can now proceed with the usual installation command:

sudo dnf install redis

This will either install the chosen Redis version or upgrade your existing Redis installation, if any.

Conclusion

In this guide, you successfully installed Remi’s RPM repository on Rocky Linux 9 or 8, gaining access to a broader range of updated software packages through a command-line terminal. This setup allows your system to stay ahead in terms of performance, security, and functionality by keeping key software up to date. Make sure to enable only the repositories you need to avoid potential conflicts between versions, especially when managing multiple PHP environments. Stay vigilant with updates to ensure your system remains secure and efficient.

Joshua James
Follow me
Latest posts by Joshua James (see all)

Leave a Comment