How to Install and Enable the Remi Repository on CentOS/RHEL

Install and enable the Remi RPM repository on CentOS and RHEL 7, 8, 9 and 10, then enable a PHP module stream to install the latest PHP 8.4 or 8.5 packages.

Remi’s RPM repository is a free and stable RPM repository, maintained by Remi Collet, mainly for the PHP stack. It contains packages for the latest versions of PHP — far newer than the ones your distribution ships. It can be used on Fedora and on Enterprise Linux (RHEL, CentOS Stream, Alma Linux, Rocky Linux and other clones).

Read this first if you are on CentOS. CentOS Linux is end of life — CentOS 8 on 31 December 2021 and CentOS 7 on 30 June 2024 — and Remi has followed suit. In February 2026 the repositories for Enterprise Linux 7 and older were closed, and those for EL 6 and older were moved to the Remi archives. No new packages, no security updates. The original CentOS steps are still below, but on an EOL box a newer PHP is treating the symptom — see the migration path first.

You are on EOL CentOS: the migration path

If your server is CentOS 6, 7 or 8, no repository configuration will get you security updates again — the distro itself is dead. Move to a supported Enterprise Linux first, then come back and enable Remi on it:

Once you are on a supported release, the EL 8/9/10 instructions below apply as written. For the same guide framed around the modern clones, checkout:

Prerequisites

To follow along this guide, ensure you have the following:

1
sudo dnf install epel-release
  • Some Remi packages also need the CodeReady Builder (CRB) repository, which provides build-time dependencies:
1
sudo crb enable

Enabling the remi repo

To enable the remi repo, install the rpm provided by remi at this url https://rpms.remirepo.net/enterprise/remi-release-<version>.rpm, version being the Enterprise Linux release version.

Example:

For RHEL 8/Alma Linux 8/Rocky Linux 8:

1
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

For RHEL 9/CentOS Stream 9/Alma Linux 9/Rocky Linux 9:

1
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

For RHEL 10/CentOS Stream 10/Alma Linux 10/Rocky Linux 10:

1
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm

Use dnf install <url> rather than rpm -ivh <url>dnf resolves dependencies and imports the GPG key for you, which bare rpm does not.

Legacy releases (EL 5, 6 and 7)

These are kept for readers maintaining old systems. They are no longer supported and you should not build anything new on them — if this is your server, take the migration path above.

The EL 5 and EL 6 release packages have been removed from the main repository — the URLs below now return 404 — and only exist under rpms.remirepo.net/archives/:

1
2
3
# Both of these now 404 — kept only to show what the old guides told you to run
sudo rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-5.rpm
sudo rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-6.rpm

The EL 7 release package still downloads, but the repository behind it was closed in February 2026 and receives no further updates:

1
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Once the installation is done, confirm that the repo is enabled with this command:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$ sudo dnf repolist

repo id                       repo name
appstream                     Rocky Linux 9 - AppStream
baseos                        Rocky Linux 9 - BaseOS
cloud-kernel                  Rocky Linux 9 - Cloud Kernel
epel                          Extra Packages for Enterprise Linux 9 - x86_64
epel-cisco-openh264           Extra Packages for Enterprise Linux 9 openh264 (From Cisco) - x86_64
extras                        Rocky Linux 9 - Extras
google-cloud-sdk              Google Cloud SDK
google-compute-engine         Google Compute Engine
remi-modular                  Remi's Modular repository for Enterprise Linux 9 - x86_64
remi-safe                     Safe Remi's RPM repository for Enterprise Linux 9 - x86_64

If you see remi in the list then it means its been installed.

Installing packages from Remi repository

To use packages from the remi repository, you need to enable them. Lets list modules providing php using this command:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
$ sudo dnf module list php

Rocky Linux 9 - AppStream
Name            Stream              Profiles                              Summary
php             8.1                 common [d], devel, minimal            PHP scripting language
php             8.2                 common [d], devel, minimal            PHP scripting language

Remi's Modular repository for Enterprise Linux 9 - x86_64
Name            Stream              Profiles                              Summary
php             remi-7.4            common [d], devel, minimal            PHP scripting language
php             remi-8.0            common [d], devel, minimal            PHP scripting language
php             remi-8.1            common [d], devel, minimal            PHP scripting language
php             remi-8.2            common [d], devel, minimal            PHP scripting language
php             remi-8.3            common [d], devel, minimal            PHP scripting language
php             remi-8.4            common [d], devel, minimal            PHP scripting language
php             remi-8.5            common [d], devel, minimal            PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

The streams you actually want today are remi-8.4 (active support until December 2026) or remi-8.5 (active support until December 2027). Everything at 8.1 and below is end of life and gets no security fixes — do not stand up a new server on remi-7.4 or remi-8.0 just because an old tutorial says so.

If you want to install PHP 8.4 for instance, reset the module first so the distro’s default stream doesn’t conflict, then enable the Remi stream:

1
2
sudo dnf module reset php
sudo dnf module enable php:remi-8.4

On systems with dnf4 you can collapse both steps into one:

1
sudo dnf module switch-to php:remi-8.4/common

You can then install it with the dnf install command:

1
sudo dnf install php php-cli

To search all packages, use this command:

1
sudo dnf search php

On EL 10, dnf module prints a deprecation warning: modularity is being phased out and dnf5 only partially supports it. The module streams above still work there today, but for anything long-lived prefer the Software Collection below, and check the Remi configuration wizard for the current recommendation for your release.

Installing PHP as a Software Collection

Module streams replace the system PHP, so you only get one version at a time. If you need a specific PHP version alongside the one your distro ships — handy when you are migrating an app one version at a time — install it as a Software Collection instead. The packages are versioned (php84-*, php85-*) and live under /opt/remi:

1
sudo dnf install php85

Run it without touching the system php:

1
scl enable php85 'php -v'

Or call the binary directly, which is what you would point a web server or systemd unit at:

1
/opt/remi/php85/root/usr/bin/php -v
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy