How to Install Redis for Production on Ubuntu in 2025
Redis is blazing fast, but production demands stability, security, and control over what features you enable. In this guide, we cover the best way to install Redis for production use and how to avoid common bloat or instability.
This guide will demystify the Redis ecosystem. We’ll break down each component, recommend the best setup for production with a focus on the Redis 7.4 LTS release, and walk you through the installation process.
Understanding the Redis Ecosystem
First, let’s clarify what each package name actually means.
🗄️ Redis-server
This is the heart of the matter. redis-server is the actual, executable daemon that runs the Redis database. It listens for connections, stores data in memory, and handles all the commands. When you say “I’m running Redis,” you’re running redis-server.
⚙️ Redis-tools
This package contains the essential command-line interface (CLI) utilities for interacting with your Redis server. The most important tool here is redis-cli, which allows you to connect to the server, issue commands, and inspect data. It also includes other useful tools like:
-
redis-benchmark: For performance testing your Redis instance.
-
redis-check-aof / redis-check-rdb: For checking the integrity of persistence files.
You almost always want redis-tools alongside redis-server.
🔴 Redis
Often, redis is a "meta-package". Installing it is typically a convenient shortcut that installs both redis-server and redis-tools as dependencies. If you’re unsure, installing the redis package is usually a safe bet to get everything you need for a basic setup.
🛢️Redis-stack
Redis Stack is “Redis on steroids.” It’s a bundle that includes:
-
Core redis-server.
-
RedisInsight: A powerful GUI for visualizing and interacting with your data.
-
Key Redis Modules: Pre-packaged modules that extend Redis’s functionality far beyond a simple key-value store. This includes:
-
RediSearch: Full-text search engine.
-
RedisJSON: Native JSON support.
-
RedisGraph: Graph database capabilities.
-
RedisTimeSeries: Time-series data handling.
-
RedisBloom: Probabilistic data structures.
Redis Stack is fantastic for development, rapid prototyping, or when your application is specifically designed to leverage these advanced data models from the start.
📦Redis-modules
This isn’t a package, but a concept. Redis Modules are dynamic libraries you can load into a standard redis-server to extend its functionality. Redis Stack is simply a pre-packaged collection of popular modules, but you can also pick and choose, installing only the specific modules you need.
In short: redis-server is the engine, redis-tools are the controls, redis-stack is a full-featured vehicle, and redis-modules are the custom upgrades.
For most production cases, redis-server + redis-tools is all you need.
Which is Best for Production?
Keep it light, stable, and secure.
If you're deploying Redis in production, you want control and stability — not an overloaded feature set you won't use.
✅ Recommended Setup:
-
Use redis-server for the daemon
-
Use redis-tools for inspection/CLI access
-
Use Redis version 7.4.x LTS for production (avoid Redis 8.x unless needed)
🛠️ Optional:
-
Install individual modules manually (e.g., just RedisBloom)
-
Avoid redis-stack unless you require all its modules
🔒 Lock Redis Version to Prevent Accidental Upgrade:
sudo apt-mark hold redis-server redis-tools
Installing Redis 7.4 LTS on Ubuntu 22.04+ (Stable Production Setup)
Step 1: Installs required tools
sudo apt-get install curl gpg lsb-release -y
Step 2: Add the Redis Repository GPG Key
Add the official Redis GPG key to ensure the packages you download are authentic.
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
Step 3: Adds the official Redis APT repository to your system
Now, add the repository to your system’s package 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 4: Install specific Redis LTS version (7.4.x)
sudo apt-get update
sudo apt-get install redis-server=6:7.4.2-1rl1~jammy1 redis-tools=6:7.4.2-1rl1~jammy1
Step 5: Lock Redis version to avoid auto upgrade
sudo apt-mark hold redis-server redis-tools
Step 6: Start and enable Redis
sudo systemctl enable redis-server
sudo systemctl start redis-server
Step 7: Test Redis
redis-cli ping # Should return PONG
Configure Redis for Production
The Redis service should now be running. For production, you should make one small but important change to the configuration file to ensure it plays nicely with modern Linux systems.
sudo nano /etc/redis/redis.conf
Find the supervised directive. It’s probably set to no . Change it to systemd.
# /etc/redis/redis.conf
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not mean "process is healthy."
supervised systemd 👈🏻
Save the file (Ctrl+O, Enter) and exit (Ctrl+X). Then, restart the Redis service to apply the change.
sudo systemctl restart redis-server
Authentication for Redis
To configure a password for Redis so clients need to authenticate before using it, you do this by setting the requirepass directive in the Redis config file (/etc/redis/redis.conf).
- Open the Redis config file:
sudo nano /etc/redis/redis.conf
- Find the line starting with # requirepass
It will be commented out like this:
# requirepass foobared
- Uncomment and change it to your desired password:
For example:
requirepass YourStrongPasswordHere
-
Save and exit the editor (Ctrl+O, then Ctrl+X in nano).
-
Restart Redis to apply changes:
sudo systemctl restart redis-server
Custom Installs: The Power of Modules
What if you need just one module, like RedisJSON, but don’t want the rest of Redis Stack? You can have the best of both worlds. You can install the standard redis-server and then compile and load just the module you need.
This approach maintains a lean setup while still giving you powerful features. You would:
-
Install redis-server.
-
Download the source code for your desired module (e.g., RedisJSON), check modules here.
-
Compile it into a shared object file (.so).
-
Update your redis.conf file with a loadmodule /path/to/your/module.so directive.
This gives you surgical control over your Redis capabilities.
Now implementation
- Download and Extract the ZIP
wget https://s3.amazonaws.com/redismodules/redisbloom/redisbloom.Linux-ubuntu22.04-x86_64.2.8.5.zip
sudo apt install unzip -y
unzip redisbloom.Linux-ubuntu22.04-x86_64.2.8.5.zip
- Move the .so to a Redis Modules Directory
sudo mkdir -p /etc/redis/modules
sudo mv redisbloom.so /etc/redis/modules/
- Edit Redis Config to Load RedisBloom
Edit Redis Config to Load RedisBloom
Add this line (or replace any loadmodulelines):
loadmodule /etc/redis/modules/redisbloom.so
Save and exit (Ctrl+O, then Enter, then Ctrl+X).
- Restart Redis-server
sudo systemctl restart redis-server
- Verify Module Loaded
redis-cli -a YourStrongPasswordHere # Open Redis CLI with ur password
# after inside redis-cli run
MODULE LIST
✅ Expected output (if RedisBloom is loaded):
1) 1) "name"
2) "bf"
3) "ver"
4) (integer) 20805
Conclusion
Now you can connect to redis with password only
- With redis-cli
redis-cli
> AUTH YourStrongPasswordHere
> [then you can run Redis commands]
- With some library like ioredis
new Redis({
port: 6379, // Redis port
host: "127.0.0.1", // Redis host
username: "default", // needs Redis >= 6
password: "YourStrongPasswordHere",
});
Your Redis instance is now installed, configured, and ready for production traffic.
