Redis is an open-source in-memory data store used as a database, cache, and message broker. It dramatically improves website performance by reducing database queries and speeding up applications such as WordPress, Laravel, Magento, Node.js, and many other web services.
Requirements
- Ubuntu 24.04 VPS
- Root or sudo access
- SSH connection
Step 1 — Update Your VPS
sudo apt update
sudo apt upgrade -y
Step 2 — Install Redis Server
sudo apt install redis-server -y
Step 3 — Verify Installation
redis-server --version
Example output:
Redis server v=7.x.x
Step 4 — Enable Redis on Boot
sudo systemctl enable redis-server
sudo systemctl start redis-server
Step 5 — Check Redis Status
sudo systemctl status redis-server
The service should display active (running).
Step 6 — Test Redis
redis-cli ping
If Redis is working correctly, the server will reply:
PONG
Step 7 — Configure Redis
Edit the configuration file:
sudo nano /etc/redis/redis.conf
Recommended settings:
supervised systemd
maxmemory 256mb
maxmemory-policy allkeys-lru
Save the file and restart Redis:
sudo systemctl restart redis-server
Useful Redis Commands
redis-cli
INFO
PING
FLUSHALL
DBSIZE
EXIT
Monitor Redis
redis-cli monitor
Security Tips
- Do not expose Redis directly to the public Internet.
- Bind Redis to localhost unless remote access is required.
- Protect Redis with authentication if remote access is enabled.
- Allow access only through your firewall.
- Keep Redis updated with the latest security releases.
Performance Benefits
- Faster website loading times.
- Reduced MySQL database load.
- Improved API response times.
- Better scalability under heavy traffic.
- Excellent support for session storage and caching.
Conclusion
Redis is one of the easiest ways to improve VPS performance. Whether you are running WordPress, Laravel, Magento, or a custom application, Redis caching can significantly reduce response times while improving scalability and user experience.
Related Articles
- How to Install MySQL 8 on Ubuntu 24.04 VPS
- How to Install PHP 8.4 on Ubuntu 24.04 VPS
- How to Install Nginx on Ubuntu 24.04 VPS
- How to Secure Your Linux VPS
- How to Connect to Your VPS via SSH
