First of all, log in to the server, with SSH (root). Open the Terminal and execute the command line as per OS version:
Redis Installation for CentOS/RHEL 6:
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum -y install redis --enablerepo=remi --disableplugin=priorities
chkconfig redis on
service redis start
Redis Installation for CentOS/RHEL 7:
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum -y install redis --enablerepo=remi --disableplugin=priorities
systemctl enable redis
systemctl start redis
Installing the Redis PHP extension for all available versions of PHP:
for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
cd ~
wget -O redis.tgz https://pecl.php.net/get/redis
tar -xvf redis.tgz
cd ~/redis* || exit
/opt/cpanel/"$phpver"/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/"$phpver"/root/usr/bin/php-config
make clean && make install
echo 'extension=redis.so' > /opt/cpanel/"$phpver"/root/etc/php.d/redis.ini
rm -rf ~/redis*
done
/scripts/restartsrv_httpd
/scripts/restartsrv_apache_php_fpm
Check to make sure the PHP extension is loaded in each version of PHP:
for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
echo "PHP $phpver" ; /opt/cpanel/"$phpver"/root/usr/bin/php -i |grep "Redis Support"
done
That's all! Feel free to contact us if you need our help!