cPanel

Install Redis on cPanel with EasyApache 4

install redis
install redis

Install Redis on cPanel with EasyApache 4

This post describes how to install Redis on cPanel with EasyApache 4. Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

Also, read more about Redis from here.

Steps to install Redis Daemon

Please note that you need to enable EPEL repo to install Redis Daemon on your cPanel server. You can simply install it with “yum” utility as given in the installation part. If that not work, please check this blog to know how to Install EPEL Repo on CentOS.

CentOS 6
yum install epel-release -y
yum install redis -y
chkconfig redis on
service redis start
CentOS 7
yum install epel-release -y
yum install redis -y
systemctl enable redis
systemctl start redis

By default, Redis does not run as a daemon. Use ‘yes’ if you need it. Open the file “/etc/redis.conf” using vi editor and set the following value and restart the Redis service again.

daemonize yes

You now have Redis installed and running. The prompt will look like this:

root@server [~]# redis-cli
127.0.0.1:6379>

Run command “redis-cli ping” to make sure Redis is working. It will provide an output “PONG” if the Redis is installed properly.

root@server [~]# redis-cli ping
PONG
root@server [~]#

That’s all you need to do. Also, you can find the Installation of Redis on cPanel EasyApache 3 from Here.

Install Redis PHP extension on cPanel with EasyApache 4

Please note that you can install Redis PHP extension using PECL on EasyApache 3, but in EasyApache 4 you need to compile the Redis PHP extension manually.

Install Redis PHP extension in PHP 7.0
cd /usr/local/src/
wget -O redis.tgz https://pecl.php.net/get/redis
tar -xvf redis.tgz
cd redis-*
/opt/cpanel/ea-php70/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config
make
make install

Add Redis extension into the PHP 7.0 configuration file to load the module.

echo 'extension=redis.so' > /opt/cpanel/ea-php70/root/etc/php.d/redis.ini

Restart the web server.

service httpd restart

Then verify the installation.

/opt/cpanel/ea-php70//root/usr/bin/php -m | grep redis

Note: If you would like to enable redis module on PHP 7.1, you just need to update the correct binary paths on the above installationie.,

/opt/cpanel/ea-php70/root/usr/bin/phpize to /opt/cpanel/ea-php71/root/usr/bin/phpize
/opt/cpanel/ea-php70/root/usr/bin/php-config to /opt/cpanel/ea-php71/root/usr/bin/php-config
/opt/cpanel/ea-php70/root/etc/php.ini to /opt/cpanel/ea-php71/root/etc/php.ini
/opt/cpanel/ea-php70/root/usr/bin/php to /opt/cpanel/ea-php71/root/usr/bin/php

Do the same on other PHP versions also.

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Button

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com