MeshWorld India LogoMeshWorld.
HowToRedisDatabaseLinuxUbuntuDevOps5 min read

How to Install Redis Server & Redis CLI on Ubuntu & Linux (2026)

Vishnu
By Vishnu
·
Vishnu
Updated by Vishnu
|Updated: Jul 24, 2026
How to Install Redis Server & Redis CLI on Ubuntu & Linux (2026)

Redis (Remote Dictionary Server) is an open-source, in-memory data structure store utilized as a high-performance database, caching broker, session store, and message queue. Supporting key-value strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, and geospatial indexes, Redis operates with sub-millisecond latency.

Setting up a production-ready Redis instance on Ubuntu 24.04 LTS (Noble Numbat) or 22.04 LTS (Jammy Jellyfish) requires configuring the official Redis APT repository (packages.redis.io), securing memory allocation policies in redis.conf, enabling authentication passwords, and managing the systemd service.

Last updated: July 24, 2026

Key Takeaways

  • Installing Redis via official repository (`packages.redis.io`) ensures access to upstream stable releases (Redis 7.2+) rather than outdated distribution packages.
  • Redis configuration file (`/etc/redis/redis.conf`) controls systemd integration, memory eviction policies (`maxmemory-policy`), and network binding.
  • Password authentication should always be enabled using the `requirepass` directive in production environments.
  • Use `redis-cli` to test latency (`ping`), verify key-value operations, and monitor active database statistics.

What are the system requirements for Redis on Linux?

Before installing Redis Server on Ubuntu, Debian, or Linux Mint, verify system prerequisites:

  • Operating System: Ubuntu 24.04 LTS, 22.04 LTS, Debian 12, or Linux Mint 22
  • Privileges: User account with sudo administrative rights
  • Memory: Minimum 512 MB RAM (RAM requirements scale directly with dataset volume size)
  • Utilities: curl, gpg, lsb-release, and terminal access

How do you install Redis Server from official APT repository?

Installing Redis from official upstream repositories guarantees you receive up-to-date security patches and performance optimizations.

Step 1: Install GPG Key and Add Redis Repository

Open your terminal (Ctrl+Alt+T) and import the official Redis signing keyring:

bash
sudo apt update
sudo apt install -y curl ca-certificates gpg lsb-release

# Import official Redis GPG key
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

# Add Redis official repository to APT sources
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

Step 2: Update Package Index and Install Redis

Update package lists and install redis (which includes both redis-server and redis-cli):

bash
sudo apt update
sudo apt install -y redis

Step 3: Verify Redis Service Status

Confirm that the Redis server service is active and running:

bash
sudo systemctl status redis-server

Ensure Redis automatically starts during system boot:

bash
sudo systemctl enable redis-server

How do you configure Redis for security and performance?

Default installation configurations require adjustments for systemd integration, memory limits, and authentication.

Step 1: Edit redis.conf Configuration File

Open the primary Redis configuration file in a text editor:

bash
sudo nano /etc/redis/redis.conf

Step 2: Configure Systemd Supervision

Locate the supervised directive and change it from no to systemd to allow Ubuntu’s service manager to control Redis lifecycle events:

text
# Enable systemd integration
supervised systemd

Step 3: Set Memory Limit and Eviction Policy

Prevent Redis from exhausting host system RAM by setting a maximum memory threshold (maxmemory) and an eviction policy (maxmemory-policy):

text
# Set memory cap (e.g., 2 Gigabytes)
maxmemory 2gb

# Evict least recently used keys when memory limit is reached
maxmemory-policy allkeys-lru

Step 4: Enable Password Authentication

Uncomment and configure a strong authentication password under the SECURITY section:

text
# Require password for client connections
requirepass YourSuperStrongRedisPassword

Save and close the file (Ctrl+O, Enter, Ctrl+X).

Step 5: Restart Service to Apply Changes

Restart the Redis service to load your configuration:

bash
sudo systemctl restart redis-server

How do you test Redis connections using Redis CLI?

Use the bundled redis-cli utility to verify database connectivity, test authentication, and execute key-value operations.

Step 1: Connect with Password Authentication

Open redis-cli and authenticate:

bash
redis-cli -a YourSuperStrongRedisPassword

Step 2: Test Server Ping

Send a ping command to test response latency:

sql
127.0.0.1:6379> ping
PONG

Step 3: Execute Basic Key-Value Operations

Set and retrieve data keys inside the console:

sql
-- Store a key-value pair
127.0.0.1:6379> SET app:user "Vishnu"
OK

-- Retrieve key value
127.0.0.1:6379> GET app:user
"Vishnu"

-- Set expiration time (60 seconds)
127.0.0.1:6379> EXPIRE app:user 60
(integer) 1

Exit the CLI:

sql
127.0.0.1:6379> exit

Security Warning: Network Binding

By default, Redis binds to 127.0.0.1 ::1 (localhost). Never expose port 6379 to public internet interfaces without TLS encryption and strong requirepass authentication configured.


Frequently Asked Questions (PAA)

Is Redis free for commercial use?

Yes. Redis community edition remains open source and available for commercial deployment. Upstream packages downloaded via packages.redis.io are fully functional without licensing fees.

How do I check which version of Redis is running?

Run redis-server --version or redis-cli --version in terminal. Inside redis-cli, execute INFO server to view detailed build info.

What is the difference between redis-server and redis-cli?

redis-server is the background daemon process that manages in-memory data structures and client connections. redis-cli is the command-line client interface used by developers to interact with the database.

How do I run benchmark tests on Redis?

Redis includes a built-in benchmarking tool named redis-benchmark. To simulate 50 parallel clients sending 10,000 requests to your local instance:

bash
redis-benchmark -h 127.0.0.1 -p 6379 -a YourSuperStrongRedisPassword -c 50 -n 10000

Share_This Twitter / X
Vishnu
Written By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Vishnu
Updated By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Enjoyed this article?

Support MeshWorld and help us create more technical content