Table of Contents
Table of Contents
Redis is a popular system that would increase the speed and performance. It is an open-source, in-memory database used as a cache and message broker. It is also known as a data structure server. This tutorial demonstrates how to install, configure, and secure Redis.
Update your local apt package cache if you haven’t done so recently, using command:
sudo apt update
install Redis by using command:
sudo apt install redis-server
verify the version of installed Redis by executing the “redis-server” command with the “-v” option:
redis-server -v
Once the installation is complete, we recommend checking if the Redis instance is running. In order to test connectivity, you can use the following command:
sudo systemctl status redis
If Redis hasn’t been started and the status is inactive, you can enable Redis client by entering the following command:
sudo systemctl restart redis-server
The default Redis configuration file is located in /etc/redis/redis.conf. The default configuration is when the Redis server listens for all available connections. Open it with your preferred editor. In our case, we are using the vi editor.
sudo vi /etc/redis/redis.conf
Locate the line “bind 127.0.0.1 ::1”.
Change the IP address by entering the values of the connections you want the Redis server to listen for. Here’s an example:
bind 45.245.177.70
Then, locate the requirepass directive under the SECURITY section and uncomment it (by removing #). Once you have uncommented the line, replace with the password of your choice.
Once you are done making changes, save and close the file. Then restart the Redis service to apply the changes:
sudo systemctl restart redis-server