
Redis® (Remote Dictionary Server) is an open-source, in-memory key-value data store that works as a database, cache, or message broker. It integrates with modern web applications to improve performance and reduce server load by storing repeated queries, such as database queries, in memory. On Ubuntu 24.04, Redis® benefits from the system’s stability, security updates, and package management, making it a reliable choice for high-performance caching and real-time data processing.
This article explains how to install Redis® on Ubuntu 24.04 and access the database to integrate it with other applications on your server. If you're using a different system such as Ubuntu 20.04, Debian 10, or CentOS 8 and want to install Redis®, check out our guides on Installing and Configuring Redis® on Ubuntu 20.04, and Installing Redis® from Source on Debian 10.
Before you begin:
Access the server using SSH as a non-root user with sudo privileges.
Redis® is available in the default package repositories on Ubuntu 24.04. Follow the steps below to install the latest Redis® package on your server.
Update the server's package index.
Install Redis® on Ubuntu 24.04.
View the installed Redis® version on your server.
Output.
Redis® listens for connection requests on the default localhost port 6379 on your server. In the following steps, configure Redis® to increase the default database limit and accept connections on your localhost 127.0.0.1 address.
Open the main Redis® configuration file using a text editor such as nano.
bind directive and verify that your localhost IPV4 127.0.0.1 and IPV6 ::1 values are available.port directive and verify the default Redis® port or modify it to a custom TCP port available on your server.daemonize directive and verify that it's set to yes to enable the Redis® service on your server.Save and close the file.
Enable the Redis® server to automatically start at boot time.
Start the Redis® service.
View the Redis® server status and verify it's running.
Redis® does not require authentication by default which enables unrestricted access for system users to available databases on the server. In the following steps, enable authentication to secure your Redis® server and only accept authorized user access.
Open the main Redis® configuration file.
requirepass directive, uncomment it, and replace foobared with a strong password of your choice.Save and close the file.
The above configuration enables authentication on your Redis® server using the specified user password. Uncomment the aclfile directive to enable multiple users with unique passwords authorized to access your Redis® server.
Restart the Redis® server to apply your configuration changes.
The Redis® server accepts connection requests using the redis-cli utility or compatible application modules on your server. In the following steps, access the Redis® server and test access write sample data to the default database to test your server configurations.
Connect to the Redis® server.
Test access to the server without authentication.
Verify that your request fails with the following output:
Log in to the Redis® server using a valid password set in your configuration. Replace strong-password with the actual password you set earlier.
Output:
Test access to the database server again.
Output:
Select a database to use on your server. For example 1.
Create a new sample key testkey with a value such as Greetings from Vultr!.
Output:
Query the key value from the database.
Output.
Exit the Redis® CLI.
You have installed Redis® on your Ubuntu 24.04 server and configured it to accept secure connection requests. You can integrate your Redis® server with your existing web applications to work as a database or cache to optimize your application and server performance. For more information and usage options, visit the official Redis® documentation.
0 Comments
Be the first to comment and share your perspective with the community.