How to Install Remi RPM on Rocky Linux 9 or 8

Are you looking to install Remi RPM on Rocky Linux to unlock the latest versions of PHP, Memcached, Redis, and more? Remi’s RPM repository is a must-have for anyone running web servers or enterprise applications on Rocky Linux, offering fast access to up-to-date software that the default repositories often lack.

By following this guide, you’ll learn how to quickly add and enable the Remi RPM repository on Rocky Linux 8 or 9. This ensures your system stays secure, compatible, and high-performing—whether you’re a developer needing the newest PHP features or a sysadmin focused on stability and security.

Updating Rocky Linux Before Importing the Remi RPM

Before installing new packages, make sure your Rocky Linux system is up to date. Upgrading existing packages minimizes the risk of conflicts during installation. Run the following command to refresh your system:

sudo dnf upgrade --refresh

This command upgrades all installed packages to their latest available versions.

Import the Remi RPM Repository on Rocky Linux

After updating your system, the next step to install Remi RPM on Rocky Linux is to add the Extra Packages for Enterprise Linux (EPEL) repository, which is a dependency for Remi’s RPM repository.

The EPEL repository provides a wide range of additional packages for RHEL-based distributions like Rocky Linux. It offers useful software that complements the default repositories.

Note: Choose the appropriate Remi RPM for your Rocky Linux version (8 or 9) when following the steps below.

Importing the Remi PHP Repository for Rocky Linux 9

Activate the Code Ready Builder (CRB) repository, which is required to install EPEL on Rocky Linux 9:

sudo dnf config-manager --set-enabled crb

With CRB enabled, install both EPEL and EPEL Next repositories using:

sudo dnf install -y \
    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 -y dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm

Importing the Remi PHP Repository for Rocky Linux 8

On Rocky Linux 8, install the EPEL repositories with:

sudo dnf install -y \
    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

With EPEL in place, import the Remi RPM for Enterprise Linux 8 using:

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

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 learned how to install Remi RPM on Rocky Linux 8 or 9, 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.

Leave a Comment