Installing Redis 6 on CentOS 7 improves the performance of Cache objects, the content generated by PHP, and the Database.
This version of Redis 6 can be divided into several different categories such as Security, performance, ease of use, and even some completely new functions such as:
- Client side caching: Caching at the client
- Threaded I/O
- Cluster support in Redis-benchmark and improved redis-cli cluster
- Supports multiple Redis modules
- Redis Cluster Proxy
- RDB deletes itself when no longer in use
- Psync2 optimized replication protocol
- Support timeout setting
- RDB loading is 20-30% faster
Install Redis 6 on CentOS 7
Step 1: SSH into the Linux server
To install Redis 6.2 on a CentOS 7 server you need to SSH into the server. If you do not know how to SSH, please refer to the following article:
Because the installation steps will take a long time, so to be safe, you should create a screen and run it on a backup screen when suddenly shutting down or losing an internet connection.
Step 2: Update the system
The first thing you should do is update the system with the following command.
yum update -y
yum install gcc make wget tcl
Step 3: Install Redis 6 on CentOS 7
To install you need to download source Redis from the homepage and unzip the installation.
tar xf 6.2-rc2.tar.gz
After you have extracted and moved into the directory, start compiling with the
make command as follows.
And the build may take some time depending on your server resources, once completed you will get a message like the following.
Now run the
make test command to make sure the build is correct.
The next step is to install Redis binaries with the
make install command
Step 4: Create Redis User
adduser --system -g redis --no-create-home redis
Create a directory to store the database for Redis.
mkdir -p /var/lib/redis
chown redis: /var/lib/redis
chmod 770 /var/lib/redis
Step 5: Create Redis . configuration file
Now that Redis is installed, the next step is to configure Redis as follows.
cp /usr/local/src/redis-6.2-rc2/redis.conf /etc/redis/
Then you find the
supervised line and change it to
supervised systemd as shown in the picture.
Step 6: Create the Redis system file
Now that Redis is installed and configured, the final step is to create a systemd unit file so that you can manage Redis services like a regular systemd service.
Description=Redis Data Store
#Activate the same system
systemctl enable redis
systemctl start redis
systemctl status redis
Step 7: Check Redis Version
To check the Redis version, use the command below in the terminal.
Install Redis PHP Extension
Step 1: Install Redis PHP Extension
To connect the communication between the Redis server and the website, you need to install the Redis PHP Extension. If you do not install the Extension, you can still connect through
Predis. To install you do it quickly with the following command.
yum install php-pear php-devel
yum install php-redis -y
Step 2: Configure Redis as Cache Server
Find and correct the following.
Step 3: Install Redis cache on WordPress
After installing Redis, you can configure Redis on your website to work. Each source code will have a different configuration. In this article, I only guide the configuration on WordPress using the Redis developer’s dedicated Plugin.
We will use the Redis Object Cache Plugin for configuration.
Before installing, open the wp-config.php file and add the following code to authenticate the key.
Next, install the Redis Object Cache Plugin. It installs a PHP script that helps WordPress communicate with Redis.
After installing the plugin you need to activate it. Navigate to Settings => Redis and click on “Enable Object Cache” and make sure Status shows “Connected”. If not, make sure you have added the configuration to the wp-config.php file as above.
So we have just finished the tutorial on Installing Redis 6 on CentOS 7. Hope the above article brings many new things to you. From there, it can help you set up performance improvement settings for your server and website.