In this article we will cover How to Install Redis on Ubuntu 24.04 LTS, Configure Redis on Ubuntu 24.04 LTS and Secure Redis on Ubuntu 24.04 LTS.
Redis is a powerful, open-source, in-memory data structure store that can be used as a database, cache, or message broker. This guide will walk you through installing Redis on Ubuntu 24.04, ensuring your system is ready to leverage Redis for enhanced performance and efficient data management. By following these instructions, you can set up Redis quickly and securely on your Ubuntu server.
Table of Contents
Prerequisites
- SSH Access with admin privileges
- Ubuntu 24.04 LTS with minimal installation
Install Redis on Ubuntu 24.04 LTS
Update the Ubuntu Repository:
sudo apt update
Install Redis:
sudo apt install redis-server
Verify the Installation:
redis-server --version
Configure Redis on Ubuntu 24.04 LTS
Open the Redis configuration file:
sudo nano /etc/redis/redis.conf
Look for the supervised
directive and set it to systemd
and close the file
supervised systemd
Restart Redis:
sudo systemctl restart redis.service
Enable the Redis server to automatically start at boot time.
sudo systemctl enable redis-server.service
Check Redis Status:
sudo systemctl status redis.service
Secure Redis On Ubuntu 24.04 LTS
Securing a Redis server is crucial to protect your data and ensure the stability of your system. Here are some key steps to get you started:
Open the main Redis configuration file.
sudo nano /etc/redis/redis.conf
Locate the requirepass
directive, remove the comment symbol and substitute foobared
with a secure password of your choosing. After that save and close the file.
requirepass devopshint
Restart the Redis server to apply your configuration changes.
sudo systemctl restart redis
Access the Redis Server on Ubuntu 24.04 LTS
Access Redis CLI:
redis-cli
Test Redis: Once in the Redis CLI, you can test the server by running:
ping
Verify that your request fails with the above output
Now log in to the Redis server using a valid password
auth devopshint
Now test access to the database server again.
ping
Select a database to use on your server. For example
SELECT 1
Create a new sample key testkey
with a value such as “hello“
set testkey "hello"
Query the key value from the database.
get testkey
if you want to exit from Redis CLI then use below command
exit
Conclusion:
By following the outlined steps, you have successfully installed and configured Redis server on your Ubuntu system. Redis is now ready to be used for caching, session management, and other data storage tasks, providing a high-performance and efficient solution for your applications.
Related Articles:
How to Install Redis on Ubuntu 22.04 LTS
Reference: