How to Install Redis on Ubuntu 26.04

Redis is a powerful, open-source, in-memory data structure store widely used as a database, cache, message broker, and streaming engine. If you are looking to redis install Ubuntu 26.04, this guide walks you through every step, from installation and security hardening to persistence configuration and basic usage with redis-cli. By the end, you will have a fully functional and secure Redis instance running on your Ubuntu 26.04 Resolute Raccoon system.
Software Requirements
| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Ubuntu 26.04 Resolute Raccoon |
| Software | Redis 8.0.5 (from Ubuntu repository) |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Understanding Redis
Redis (Remote Dictionary Server) is an open-source, in-memory data structure store that operates at extremely high speeds because it keeps all data in RAM. Unlike traditional disk-based databases, Redis can handle millions of requests per second, making it an ideal choice for scenarios where performance is critical.
Common use cases for Redis include:
- Caching: Store frequently accessed data in memory to reduce database load and speed up application response times.
- Session management: Maintain user session data for web applications with fast read and write access.
- Message broker: Use Redis Pub/Sub or Streams for real-time messaging between application components.
- Rate limiting: Track and limit API requests using Redis counters with automatic expiration.
- Leaderboards and counters: Leverage sorted sets for real-time rankings and atomic increment operations.
Redis supports a variety of data structures including strings, hashes, lists, sets, sorted sets, bitmaps, and streams. This versatility, combined with its speed, makes it one of the most popular choices for modern application architectures. For a comprehensive overview, consult the official Redis installation documentation.
Installing Redis on Ubuntu 26.04
The redis install Ubuntu 26.04 process is straightforward because the redis-server package is available directly from the default Ubuntu repository. Therefore, there is no need to add third-party sources.
Update your package index: Before installing any new software, refresh the local package cache to ensure you get the latest available version:
sudo apt update
Install the Redis server package: Install Redis along with its command-line client tool:
sudo apt install redis-server
This installs the redis-server daemon and the redis-cli utility. The installation automatically creates the Redis configuration file at /etc/redis/redis.conf and sets up the systemd service unit.
Verify the Redis version: Confirm the installed version:
redis-server --version
Check the service status: Redis should start automatically after installation. Verify it is running:
sudo systemctl status redis-server
At this point, Redis is installed and running on your Ubuntu 26.04 system with its default configuration. The next step is to adjust the configuration to match your requirements.
Configuring Redis on Ubuntu 26.04
The main Redis configuration file is located at /etc/redis/redis.conf. This section covers the most important settings you should review and adjust after a fresh installation.
Open the configuration file: Use your preferred text editor to modify the Redis configuration:
sudo nano /etc/redis/redis.conf
Configure the bind address: By default, Redis binds to 127.0.0.1 -::1, meaning it only accepts connections from the local machine. If you need Redis to accept connections from specific network interfaces, modify the bind directive. For local-only access (recommended for most setups), keep the default:
bind 127.0.0.1 -::1
If you need to allow connections from a specific IP on your network, add it:
bind 127.0.0.1 192.168.1.100
Set a memory limit: To prevent Redis from consuming all available system memory, set a maximum memory limit using the maxmemory directive. For example, to limit Redis to 256 MB:
maxmemory 256mb
Additionally, configure an eviction policy that determines how Redis handles new writes when the memory limit is reached:
maxmemory-policy allkeys-lru
Save and restart Redis: After making your changes, save the file and restart the Redis service to apply the new configuration:
Save and restart Redis: After making your changes, save the file and restart the Redis service to apply the new configuration:
$ sudo systemctl restart redis-server
Securing Redis Installation
Redis is designed for use in trusted environments; however, it is essential to apply proper security measures to prevent unauthorized access. This section covers the critical steps to harden your Redis installation on Ubuntu 26.04.
Setting Password Authentication
Open the Redis configuration file:
$ sudo nano /etc/redis/redis.conf
Set a strong password: Locate the requirepass directive (commented out by default), uncomment it, and set a strong password:
requirepass LinuxConfig_passwd_2026
Choose a long, complex password because Redis is extremely fast and can process a large number of password attempts per second.
Restart Redis to apply the change:
$ sudo systemctl restart redis-server
Verify password authentication is active: Attempt to connect without a password and confirm that Redis rejects unauthenticated commands:
$ redis-cli PING
(error) NOAUTH Authentication required.
Then authenticate and verify access:
$ redis-cli -a LinuxConfig_passwd_2026 PING
PONG
IMPORTANT
When using the -a flag with redis-cli, you will see a warning: “Using a password with ‘-a’ or ‘-u’ option on the command line interface may not be safe.” This is expected behavior. For interactive sessions, connect with redis-cli first and then use the AUTH command to authenticate.
Disabling Dangerous Commands
Redis includes commands such as FLUSHALL, FLUSHDB, CONFIG, and KEYS that can be destructive or expose sensitive information. You can rename or disable these commands in /etc/redis/redis.conf:
rename-command FLUSHALL "LINUXCONFIGFLASH"
rename-command FLUSHDB ""
rename-command CONFIG "linuxconfig_config_2025"
Setting a command to an empty string ("") disables it entirely. Alternatively, renaming it to a hard-to-guess string allows restricted access for administrators who know the renamed command. After adding these directives, restart Redis and verify:
$ sudo systemctl restart redis-server
$ redis-cli -a LinuxConfig_passwd_2026 FLUSHDB
(error) ERR unknown command 'FLUSHDB', with args beginning with:
The disabled FLUSHDB command is rejected, while the renamed FLUSHALL remains accessible through its new alias LINUXCONFIGFLASH:
Configuring Firewall Rules
If your Redis instance needs to accept remote connections, you should restrict access using UFW (Uncomplicated Firewall). For example, to allow connections only from a specific application server at 192.168.1.50:
$ sudo ufw allow from 192.168.1.50 to any port 6379
Moreover, if Redis should only be accessible locally, ensure the bind address is set to 127.0.0.1 and no firewall rule opens port 6379 to external networks. For more details on managing firewall rules, see how to allow ports with UFW on Ubuntu 26.04.
Testing Redis with redis-cli
The redis-cli tool is the standard command-line interface for interacting with a Redis server. Use it to verify that your installation and configuration are working correctly.
Connect to Redis: Launch the Redis CLI:
$ redis-cli
If you configured password authentication, you will need to authenticate before running any commands.
Authenticate with your password: Use the AUTH command:
127.0.0.1:6379> AUTH LinuxConfig_passwd_2026
OK
Alternatively, you can pass the password directly when connecting:
$ redis-cli -a LinuxConfig_passwd_2026
Test the connection with PING: The PING command verifies that the server is responsive:
127.0.0.1:6379> PING
PONG
A PONG response confirms that Redis is running and accepting commands.
Store and retrieve a test value: Use SET and GET to write and read a key-value pair:
127.0.0.1:6379> SET greeting "Hello from LinuxConfig.org"
OK
127.0.0.1:6379> GET greeting
"Hello from LinuxConfig.org"
Conclusion
You have successfully completed the Redis install on Ubuntu 26.04 Resolute Raccoon. Throughout this guide, you installed the Redis server from the Ubuntu repository, configured essential settings including bind address and memory limits, secured the installation with password authentication and firewall rules, tested the server with redis-cli, and enabled persistence to protect your data. Redis is now ready to serve as a high-performance cache, session store, or message broker for your applications.
Share this:
- Share on Facebook (Opens in new window) Facebook
- Share on X (Opens in new window) X
- Share on Bluesky (Opens in new window) Bluesky
- Share on LinkedIn (Opens in new window) LinkedIn
- Share on Reddit (Opens in new window) Reddit
- Share on Threads (Opens in new window) Threads
- Print (Opens in new window) Print
- Share on Mastodon (Opens in new window) Mastodon








