Redis Log

Install Redis on Ubuntu

Estimated reading time: 3 minutes

If you’re looking to harness the power of Redis on Ubuntu, you’re in the right place. In this guide, I’ll walk you through installing Redis on Ubuntu 24.04 with secure settings to ensure smooth and efficient use. Redis installation on Linux is straightforward, and following these steps will have you up and running in no time.

Step 1: Preparing for Redis Installation

Before installing Redis, start by updating the package index to ensure all software sources are up-to-date. Run:

This prepares your system to fetch and install the latest Redis package. Updating the package index ensures you don’t encounter compatibility issues during the installation.


Read also: Install Redis on Ubuntu Manually


Step 2: Installing Redis

Now, it’s time to install Redis. Use the command below to download and install Redis directly from Ubuntu’s official package repository:

After installing Redis, you can confirm the version by typing:

This command will display the installed version, which should be ready to use immediately.

Step 3: Configuring Redis for Optimal Performance

Redis’s default settings work well, but a few configuration adjustments will help secure and optimize it. Open the main configuration file with:

In the file, set Redis to run in the background by enabling the “daemonize” directive:

Redis also defaults to 127.0.0.1, the localhost, which prevents outside access. This is a secure setup for development environments but can be modified for specific networking needs.

Step 4: Enabling and Starting Redis

To make sure Redis starts automatically with your system, enable it by running:

Then, start the Redis service:

To check the Redis status and confirm it’s running, use:

If Redis is active, it’s ready to accept connections.

Step 5: Securing Redis with Authentication

By default, Redis doesn’t require a password, which can be risky in production environments. To enable a password, open the configuration file again:

Locate the requirepass directive, uncomment it, and set a strong password:

Save the changes and restart Redis:

Now, when accessing Redis, you’ll need to authenticate. Try logging in with the redis-cli command and use the auth command to authenticate with your password.

Final Thoughts on Using Redis with Ubuntu

Now that Redis is installed and configured, it’s ready to boost your application’s speed and performance. Whether you’re using it for caching, message brokering, or session management, Redis on Ubuntu offers powerful support for high-speed data management. So go ahead and put Redis to work on your applications!

Further reading

Leave a Reply

Your email address will not be published. Required fields are marked *