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
sudoadministrative 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:
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.listStep 2: Update Package Index and Install Redis
Update package lists and install redis (which includes both redis-server and redis-cli):
sudo apt update
sudo apt install -y redisStep 3: Verify Redis Service Status
Confirm that the Redis server service is active and running:
sudo systemctl status redis-serverEnsure Redis automatically starts during system boot:
sudo systemctl enable redis-serverHow 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:
sudo nano /etc/redis/redis.confStep 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:
# Enable systemd integration
supervised systemdStep 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):
# Set memory cap (e.g., 2 Gigabytes)
maxmemory 2gb
# Evict least recently used keys when memory limit is reached
maxmemory-policy allkeys-lruStep 4: Enable Password Authentication
Uncomment and configure a strong authentication password under the SECURITY section:
# Require password for client connections
requirepass YourSuperStrongRedisPasswordSave and close the file (Ctrl+O, Enter, Ctrl+X).
Step 5: Restart Service to Apply Changes
Restart the Redis service to load your configuration:
sudo systemctl restart redis-serverHow 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:
redis-cli -a YourSuperStrongRedisPasswordStep 2: Test Server Ping
Send a ping command to test response latency:
127.0.0.1:6379> ping
PONGStep 3: Execute Basic Key-Value Operations
Set and retrieve data keys inside the console:
-- 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) 1Exit the CLI:
127.0.0.1:6379> exitBy 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:
redis-benchmark -h 127.0.0.1 -p 6379 -a YourSuperStrongRedisPassword -c 50 -n 10000


