How to Install Redis Caching Engine on cPanel server?

Redis is an open-source in-memory caching engine that can improve web applications' performance by storing frequently accessed data in memory, reducing the number of requests made to the database.

By utilizing Redis caching, there is no longer a need to clear the cache when new content is published manually. In addition, if a page or blog post is edited, Redis will automatically invalidate the store for that content, ensuring that the updated content is displayed after the next page refresh.

This article will walk you through installing Redis on a cPanel server.

Check Prerequisites

-> You must have root access to your cPanel server.

-> The server must have a supported Linux distribution installed

-> You need to have a recent version of cPanel installed on your server.

To complete the installation, you will need root access to your server. We will install Redis on Centos 7 Operating System and the Latest cPanel version.

Install Redis

Step 1: Log in to your server as root via SSH.

Step 2: Add the EPEL repository to your server:

# sudo yum install epel-release

Step 3: Install Redis using the following command.

# sudo yum install redis


Step 4: Once the installation is complete, start the Redis service and enable it to start automatically on the system boot.

# sudo systemctl start redis

# sudo systemctl enable redis

Step 5: Finally, check if Redis is running by using the following command.

# redis-cli ping

If Redis is installed and running, it should return a response of PONG.

Once Redis is installed on your cPanel server, you can configure it to suit your needs. The Redis configuration file is located at /etc/redis.conf.

You can open the Redis configuration file using any text editor, such as nano or vi. For example, to open the configuration file using nano, use the following command:

# sudo nano /etc/redis.conf

You can configure various settings in the Redis configuration file, such as the port number, maximum memory usage, and data persistence.

To test if Redis is working correctly, you can use the following command:

redis-cli ping


Install PHP Redis extension:

Step 1: Log into WHM as root.

Step 2: Navigate to the Software section.

Step 3: Click on Module Installers.

Step 4: Click Manage for PHP Pecl.

The PHP Pecl Installer section will appear.

Step 5: In the Search box, type redis and click Go.


Step 6: This will return the relevant PHP Redis module. Click on Install.

A PHP extension will be installed, acting as a Redis interface.

For the changes to take effect, restart redis and httpd.

# service httpd restart

# service redis restart

In this article, we have installed Redis on a cPanel server.


Was this answer helpful?

« Back


/* */