Linux

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

Pinterest LinkedIn Tumblr

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:

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:

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:

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:

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

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

$ sudo dnf repolist
repo id                                 repo name
appstream                               CentOS Linux 8 - AppStream
baseos                                  CentOS Linux 8 - BaseOS
epel                                    Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                            Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                  CentOS Linux 8 - Extras
remi-modular                            Remi's Modular repository for Enterprise Linux 8 - x86_64
remi-safe                               Safe Remi's RPM repository for Enterprise Linux 8 - 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:

$ sudo dnf module list php
Last metadata expiration check: 2:53:03 ago on Sun 29 Aug 2021 08:52:16 AM UTC.
CentOS Linux 8 - AppStream
Name                Stream                      Profiles                                 Summary
php                 7.2 [d]                     common [d], devel, minimal               PHP scripting language
php                 7.3                         common [d], devel, minimal               PHP scripting language
php                 7.4                         common [d], devel, minimal               PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name                Stream                      Profiles                                 Summary
php                 remi-7.2                    common [d], devel, minimal               PHP scripting language
php                 remi-7.3                    common [d], devel, minimal               PHP scripting language
php                 remi-7.4 [e]                common [d], devel, minimal               PHP scripting language
php                 remi-8.0                    common [d], devel, minimal               PHP scripting language

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

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

sudo dnf module enable php:remi-8.0

You can then install it with the dnf install command:

sudo dnf install php php-cli

To search all packages, use this command:

sudo dnf search php

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment