How To

Install Redis on Ubuntu: Configuration and Remote Access

Redis is an open-source, in-memory key-value store built for raw speed and versatility. It works equally well as a high-performance database, a caching layer, or a message broker, and natively supports data structures including Strings, Hashes, Lists, and Sets. For production deployments, Redis Sentinel handles high availability while Redis Cluster enables horizontal scaling across multiple nodes. This guide walks through how to install Redis on Ubuntu and configure it for secure, controlled remote access.

How to Install Redis on Ubuntu

Redis is available in Ubuntu’s official repositories, making installation fast and dependency-free. Run the following commands with sudo privileges:

bashsudo apt updatesudo apt install redis-server

The Redis service starts automatically after the package installs. Verify it is active by running:

bashsudo systemctl status redis-server

Look for active (running) in the output to confirm Redis is live. The default Ubuntu repositories include Redis version 5.0 — stable and suitable for most workloads. If your project requires a newer release, the official packages at redis.io are a reliable source.

Heads up: Redis will fail to start if IPv6 is disabled on your server. Enable it before installation if your system has it turned off.

Configure Redis to Accept Remote Connections

Out of the box, Redis only listens on 127.0.0.1 — the local machine. If your application and Redis share the same server, that default is ideal and should not be changed. Remote access is only needed when a separate application server needs to communicate with Redis across a network.

To enable remote connections, open the Redis configuration file:

bashsudo nano /etc/redis/redis.conf

Find the line starting with bind 127.0.0.1 ::1 and comment it out:

ini# bind 127.0.0.1 ::1

Private network tip: If your server sits on a private network, add the server’s private IP address next to 127.0.0.1 rather than commenting the line out entirely. This limits Redis to internal traffic only and keeps it off the public internet.

Save the file, then restart Redis to apply the change:

bashsudo systemctl restart redis-server

Confirm that Redis is now listening on all interfaces at TCP port 6379:

bashss -an | grep 6379

Output showing 0.0.0.0:6379 means Redis is accepting connections on all IPv4 interfaces. Two entries — one for IPv4 and one for IPv6 — is expected and correct.

Restrict Access with UFW Firewall Rules

Opening Redis to remote connections without firewall controls is a serious security risk. Use UFW to restrict which IPs can reach port 6379. To allow only a specific private subnet:

bashsudo ufw allow proto tcp from 192.168.121.0/24 to any port 6379

Only whitelist IP ranges that belong to trusted machines. Leaving Redis exposed to the open internet without firewall rules and password authentication is a misconfiguration that attackers actively exploit.

Test the Remote Connection

With everything configured, test connectivity from your remote machine using the redis-cli utility:

bashredis-cli -h <REDIS_IP_ADDRESS> ping

A correctly configured Redis server responds with:

PONG

If you get a timeout instead of PONG, the two most common causes are:

  • A firewall rule that blocks port 6379 or hasn’t been applied yet
  • The bind directive in redis.conf still pointing to localhost only

Getting Redis installed and accessible is straightforward the complexity lies in securing it correctly. Keep firewall rules tight, restrict bind addresses to private interfaces where possible, and consider enabling Redis password authentication as an added defence layer. Once your setup is solid, explore RDB snapshots or AOF logging to add data persistence to your instance. Hit a snag? Drop a comment below and we’ll help you sort it out.

Cyber Defence

Recent Posts

Install Skype on Ubuntu: Two Methods That Actually Work

Skype doesn't ship with Ubuntu by default it's a proprietary application owned by Microsoft and…

59 minutes ago

Install PHP on Ubuntu: Complete Setup Guide for Apache & Nginx

PHP is the backbone of the web. Frameworks like Laravel, WordPress, and Magento all run on…

1 hour ago

Best OSINT Tools for Cybersecurity Teams 2026: Threat Intel and Exposure Checks

Cybersecurity teams use OSINT to see what attackers can already see from public sources. In…

3 hours ago

Best Legal OSINT Tools 2026: Research Safely Without Crossing Privacy Lines

Legal OSINT is about collecting and analyzing publicly available information without bypassing privacy controls, breaking…

3 hours ago

Mono Ubuntu Install: Complete Setup Guide for 20.04

Developers building cross-platform .NET applications often rely on Mono Ubuntu Install to create a flexible…

3 hours ago

How to Install Spotify on Ubuntu 20.04

Spotify is one of the most popular music streaming services worldwide, giving you instant access…

3 hours ago