Redis called as Remote Dictionary Server. Redis is an Open-Source in-memory data structure server. It is used as cache storage and Database. Redis stores a mapping of keys to five different types of values. Redis is also useful to run task queues in the server background.
Following are the steps to install Redis on Ubuntu Server.
Install Redis Server :
- Execute the below command to install Redis.
# sudo apt-get install redis-server -y
- Hit the below command to check that the Radis is working.
- If the installation is successful, Redis will open a command-line interface. Hit below command to check it is working fine.
# 127.0.0.1:6379> PING
If you receive PONG in response, this means Radis is installed properly on your server.
- Hit EXIT command to exit from Radis-cli.
# 127.0.0.1:6379> EXIT
Let us configure Redis for Memory Usage Limit and Password.
Configure Redis Server :
- Redis configuration file will be at “/etc/redis/redis.conf”. Edit the configuration file with your favorite editor, Hit the following command.
# sudo nano /etc/redis/redis.conf
- Hit Ctrl+W Button and find the following line by hitting enter Button.
change it to 256mb or to the number you required.
# maxmemory 256mb
- Set the Password for Radis. Hit Ctrl+W and type “# requirepass” and Hit Enter.
requirepass Your Password
- Change it to your desired Password.
- Type CTRL+X and press Y Button and Hit the Enter key to save the configuration.
- Restart the Redis Service to update the configuration we have made in redis.conf file.
# rsudo service redis restart
- Check the Redis Status by executing the below command.
# sudo service redis status
This is it. You are done with Redis installation and configuration.