How to Install Redis on Ubuntu 24.04 LTS

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.

  • SSH Access with admin privileges
  • Ubuntu 24.04 LTS with minimal installation

Update the Ubuntu Repository:

sudo apt update

Install Redis:

sudo apt install redis-server
How to Install Redis on Ubuntu 24.04 LTS 1

Verify the Installation:

redis-server --version
How to Install Redis on Ubuntu 24.04 LTS 2

Open the Redis configuration file:

sudo nano /etc/redis/redis.conf
How to Install Redis on Ubuntu 24.04 LTS 3

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
How to Install Redis on Ubuntu 24.04 LTS 4

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
How to Install Redis on Ubuntu 24.04 LTS 5

Restart the Redis server to apply your configuration changes.

sudo systemctl restart redis
How to Install Redis on Ubuntu 24.04 LTS 6

Access Redis CLI:

redis-cli
How to Install Redis on Ubuntu 24.04 LTS 7

Test Redis: Once in the Redis CLI, you can test the server by running:

ping
How to Install Redis on Ubuntu 24.04 LTS 8

Verify that your request fails with the above output

Now log in to the Redis server using a valid password

auth devopshint
How to Install Redis on Ubuntu 24.04 LTS 9

Now test access to the database server again.

ping
How to Install Redis on Ubuntu 24.04 LTS 10

Select a database to use on your server. For example

SELECT 1
How to Install Redis on Ubuntu 24.04 LTS 11

Create a new sample key testkey with a value such as “hello

set testkey "hello"
How to Install Redis on Ubuntu 24.04 LTS 12

Query the key value from the database.

get testkey
How to Install Redis on Ubuntu 24.04 LTS 13

if you want to exit from Redis CLI then use below command

exit
How to Install Redis on Ubuntu 24.04 LTS 14

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:

Redis Installation official page

Harish Reddy

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap