Log in to the command line via SSH as the ROOT user and run the following commands line-by-line.
yum groupinstall 'Development Tools'
yum install tcl wget
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable/
make distclean
make
make test
make install
cd utils/
./install_server.sh
This will allow REDIS to use more memory than it has been allocated by Plesk if required
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf && sysctl -p
Disable transparant_hugepage
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Start and test your Redis service
systemctl start redis_6379
systemctl status redis_6379
Check if redis is working (should reply with PONG
)
redis-cli ping
Configure Redis to bind only on localhost for obvious security reasons by editing /etc/redis/6379.conf, uncommenting line 57 (bind 127.0.0.1 ::1)
vi /etc/redis/6379.conf
(edit and save)
systemctl restart redis_6379
Install EPEL (this is for CentOS 7, do hostnamectl
to verify your version) then php-pecl-redis
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install php-pecl-redis
Update PECL channels
pecl channel-update pecl.php.net
Install php-devel package for your desired PHP version (here I am going with PHP 7.2)
yum install plesk-php72-devel
Finally install redis in PHP
/opt/plesk/php/7.2/bin/pecl install redis
Plesk should already have "extension=redis.so" enabled inside /etc/php.d/redis.ini
You can start using redis with phpredis!
Now, if you use WordPress with the plugin Redis Object Cache you should see in diagnostic that you are using at least PhpRedis (v5.0.2) instead of the obsolete v.3 coming with default Plesk!
Enjoy