How to install and Enable Remi Repository in RHEL/Centos/Rocky 6/7/8

Remi’s RPM repository is a free and stable YUM repository mainly for the PHP stack. It contains packages for the latest versions of PHP. The Remi repository can be used on on CentOS 5/6/7/8.

For the latest version of RHEL, checkout:

Prerequisites

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

  • A Centos Server with root access or a user who can execute sudo commands
  • Internet access
  • Some packages in the Remi Repository depends on epel-release so if you don’t have install it with sudo dnf install epel-release

Enabling the remi repo

To enable the remi repo, Install the rpm provided by remi in this url http://rpms.remirepo.net/enterprise/remi-release-<version>.rpm, version being the Centos Release version.

Example:

For Centos 5/Rhel 5:

1
2
3
4
sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-5.rpm

# Or
Sudo yum install http://rpms.remirepo.net/enterprise/remi-release-5.rpm

For Centos 6/Rhel 6:

1
2
3
4
sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release6.rpm

# Or
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm

For Centos 7/Rhel 8:

1
2
3
4
sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

# Or
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

For Centos 8/Rhel 8/Alma Linux 8/Rocky Linux 8:

1
2
3
4
sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-8.rpm

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

For/Rhel 9/Alma Linux 9/Rocky Linux 9:

1
2
3
4
sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-9.rpm

# Or
sudo dnf install http://rpms.remirepo.net/enterprise/remi-release-9.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
$ sudo dnf module list php
Last metadata expiration check: 0:00:09 ago on Mon 04 Sep 2023 10:23:26 AM UTC.
Rocky Linux 9 - AppStream
Name            Stream              Profiles                              Summary
php             8.1                 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

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

If you want to install php 8.1 for instance, enable it with this command:

1
sudo dnf module enable php:remi-8.1

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
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy