Thursday, September 4, 2025
HomeGuest BlogsInstall PHPUnit on CentOS 8|7 / Fedora 37/36/35/34/33

Install PHPUnit on CentOS 8|7 / Fedora 37/36/35/34/33

Are you looking for an easy way to install PHPUnit on CentOS 7 / CentOS 8 & Fedora 37/36/35/34/33/32?. PHPUnit is a unit testing framework for PHP applications. It is an instance of the xUnit architecture for unit testing frameworks and it became popular with JUnit. PHPUnit requires PHP dom and json , pcrereflection and spl extensions.

Step 1: Add Remi repository

PHPUnit package for CentOS 7/8 will be pulled from Remi repository which is not readily available on either system. Add it manually using the commands shared below.

CentOS 8:

sudo dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf -y install dnf-utils
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

CentOS 7:

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install epel-release
sudo yum -y install yum-utils

Fedora:

# Fedora 37
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-37.rpm
sudo dnf -y install dnf-utils

# Fedora 36
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-36.rpm
sudo dnf -y install dnf-utils

# Fedora 35
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-35.rpm
sudo dnf -y install dnf-utils

# Fedora 34
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
sudo dnf -y install dnf-utils

# Fedora 33
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm
sudo dnf -y install dnf-utils

# Fedora 32
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm
sudo dnf -y install dnf-utils

Step 2: Install PHPUnit on CentOS / Fedora

Let’s install the latest PHPUnit and required extensions.

CentOS 8 / Fedora:

sudo dnf --enablerepo=remi -y install phpunit9

CentOS 7:

sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php74
sudo yum --enablerepo=remi -y install phpunit9

View more information on the installed package.

$ rpm -qi phpunit9
Name        : phpunit9
Version     : 9.5.28
Release     : 1.fc37.remi
Architecture: noarch
Install Date: Tue 24 Jan 2023 08:26:03 PM UTC
Group       : Unspecified
Size        : 1438302
License     : BSD-3-Clause
Signature   : RSA/SHA256, Mon 16 Jan 2023 07:17:15 AM UTC, Key ID 83c0639e1fef0014
Source RPM  : phpunit9-9.5.28-1.fc37.remi.src.rpm
Build Date  : Mon 16 Jan 2023 06:54:14 AM UTC
Build Host  : builder.remirepo.net
Packager    : Remi Collet
...

Visit PHPUnit Documentation page to get started.

More content:

Best CCNP R&S Certification Preparation books

Best Kubernetes Study books

Best Linux Books for Beginners & Experts

RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS