News
New 1-Click Apps are now available in the Serverspace control panel
Serverspace Black Friday
JT
April 23 2026
Updated April 23 2026

Installation Redis on Ubuntu: Step-by-step guide

Redis is a high-performance in-memory data store used as a cache, database, and message broker. Thanks to its extremely low latency and simple architecture, Redis is widely adopted in web development, microservices, and high-load systems.

Installing Redis on Ubuntu usually takes only a few minutes, but it is important to configure the basic setup correctly from the start to ensure security and production readiness.

System Preparation

Before installing Redis, it is recommended to update the system packages. This reduces the risk of version conflicts and dependency issues during installation.

sudo apt update
sudo apt upgrade -y

After updating, the system is ready to install Redis from the official Ubuntu repositories.

Installing Redis

Redis can be installed with a single command using the package manager:

sudo apt install redis-server -y

Once installed, Redis usually starts automatically as a system service. You can check its status using systemd:

sudo systemctl status redis

If the service is not active, you can start it manually:

sudo systemctl start redis

To enable Redis to start automatically on boot:

sudo systemctl enable redis

Redis includes a built-in CLI client used for testing and administration. You can connect to the server with:

redis-cli

The simplest test is the ping command. If Redis is working correctly, it will respond with PONG:

ping

You can also test basic storage operations:

set key "Hello Redis"
get key

If Redis returns the stored value, the installation is working correctly. The main Redis configuration file is located at:

/etc/redis/redis.conf

You can edit it using a text editor:

sudo nano /etc/redis/redis.conf

This file defines key settings such as network interface, port, authentication, and memory usage. By default, Redis is configured to accept only local connections, which is safer for development environments.

For production use, it is common to enable password authentication:

requirepass StrongPassword123

After making changes, restart the service:

sudo systemctl restart redis

Security and Remote Access

By default, Redis is only accessible from localhost, which helps prevent unauthorized access. If remote access is required, you need to modify the bind setting:

bind 0.0.0.0

However, exposing Redis directly to the internet is strongly discouraged. If remote access is necessary, you should always enable authentication and properly configure firewall rules.

To allow traffic through the firewall:

sudo ufw allow 6379

In production environments, it is better to restrict access to trusted IP addresses only. Since Redis stores data in memory, it is important to control memory usage. You can define a memory limit in the configuration file:

maxmemory 256mb

You can also configure how Redis behaves when memory is full:

maxmemory-policy allkeys-lru

This policy ensures that Redis removes the least recently used keys when it reaches the memory limit, helping prevent service crashes.Installing Redis on Ubuntu is quick and straightforward, but proper configuration is essential for secure and stable operation. Even a basic setup allows Redis to function as a high-speed cache or in-memory data store.

In modern application architectures, Redis often becomes a critical component, significantly improving performance and reducing the load on primary databases.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33401 West Palm Beach, FL 700 S Rosemary Ave, Suite 204
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP | All rights reserved
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.