Remote Dictionary Server, or Redis, is an open-source in-memory data structure server. It’s used as cache storage and database. Redis stores a mapping of keys to five different types of values, and it is also useful in running task queues in the server background.
Following are the steps to install Redis on Ubuntu Server.
Install Redis Server
1. Execute the command below to install Redis –
# sudo apt-get install redis-server -y
2. Execute the command given below to check if Redis is working -
3. If the installation is successful, Redis will open a command-line interface. Run this command to check if it is working properly –
# 127.0.0.1:6379> PING
If you receive PONG in response, Radis is installed correctly on your server.
4. Click on the EXIT command to exit from Radis-cli.
# 127.0.0.1:6379> EXIT
Now let us configure Redis for Memory Usage Limit and Password.
Configure Redis Server
1. The Redis configuration file will be in /etc/redis/redis.conf.
Edit the configuration file with your preferred editor, and execute the following command –
# sudo nano /etc/redis/redis.conf
2. Press Ctrl + W and find the following line by clicking the Enter button –
3. Change it to 256mb or to the number you require –
# maxmemory 256mb
4. Set the password for Redis using Ctrl+W, type # requirepass, and press Enter.
requirepass Your Password
5. Change it to your desired Password.
6. Type CTRL+X, press the Y key, and then the Enter key to save the configuration.
7. Restart the Redis Service to update the configuration made in the redis.conf file.
# rsudo service redis restart
8. Check the Redis status by executing this command –
# sudo service redis status
This is all you need to do for Redis installation and configuration.