Redis is an in-memory data structure store that can serve as a temporary database, cache, or message broker. It supports various data types, such as strings, lists, sets, hashes, and more. Redis is fast, flexible, and reliable. The steps below show you how to install and configure Redis on Ubuntu 23.04 LTS. Without any further ado, let’s begin!
1. Update system packages:
sudo apt update2. Get Redis installed by executing the following command:
sudo apt install redis-server3. Open the Redis configuration file:
sudo nano /etc/redis/redis.confAnd Change supervised directive to systems:
supervised systemdSave and close the file by pressing: Ctrl + X, then Y, and Enter.
4. Restart Redis service:
sudo systemctl restart redis.service5. Test if Redis is working:
redis-cli pingYou should see this output:
PONG6. Open the config file to secure Redis with a password:
sudo nano /etc/redis/redis.confUncomment and modify requirepass directive:
requirepass your_passwordSave your change and exit the file: Ctrl + X, Y, Enter.
7. Restart Redis service:
sudo systemctl restart redis.service8. Check if Redis is secured:
redis-cli pingOutput:
NOAUTH Authentication requiredTry again but authenticate with your password:
redis-cli -a your_password pingThis time, it works like a charm:
PONGDone!