This tutorial will help you with the installation of Redis server along with PHP Redis PHP extensions on an Ubuntu 19.04, 18.04 LTS, 16.04 LTS and 14.04.

Step 1 – Prerequsities

Log in to your system with sudo privilege account using shell access, to which you need to install Redis. Update the apt-get packages index files and also update existing packages to the newest versions by using the following commands:

Step 2 – Installing Redis

The Redis packages are available under the default apt repository. For the installation of Redis on an Ubuntu VPS. Run below command from the terminal to install Redis on your machine: Next is to enable Redis to start on system boot. Also restart Redis service once.

Step 3 – Configure Redis

Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server. The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:

Step 4 – Install Redis PHP Extension

Now, if you need to use Redis from PHP application, you also need to install Redis PHP extension on your Ubuntu system. Run below command to install:

Step 5 – Test Connection to Redis Server

Use redis-cli tool to verify the connection between the Redis server. Few more examples of redis-cli command line tool. You can find more details about redis-cli here.

How to Install Redis on Ubuntu 18 04   16 04 LTS   TecAdmin - 40