Prerequisites
You must have shell access with sudo privileged account access to Debian 10 system. First of all, Login to your system and upgrade the current packages.
Step 1 – Install Redis on Debian 10
Redis packages are available under the default apt repository. You can directly install Redis on Debian 10 system without adding any PPA. Run the following command to install Redis on Debian: After installation, enable Redis service to start on system boot.
Step 2 – Configure Memory for 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 3 – Install Redis PHP Extension
This is an optional step. If you need to connect Redis from PHP application, You need to install Redis PHP extension on your Debian system. To install Redis PHP extension, simply type: The installer will automatically enable redis extension for all the pre installed PHP versions. If you installer new PHP version after this, you can use below command to enable redis module. For example to enable extension for PHP 7.4, type:
Step 4 – Connect 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.
Conclusion
This tutorial helps you with the installation of Redis server on Debian 10 system.