How to Install Redis on Ubuntu 24.04 VPS

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
  • redis
  • 0 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

How to Change Your SSH Port for Better Security

By default, SSH runs on port 22, which is commonly targeted by automated attacks. Changing the...

How to Connect to Your VPS via SSH

SSH (Secure Shell) is a protocol used to securely connect to your VPS. Follow the steps below to...

How to Update and Upgrade Your VPS

Keeping your VPS up to date is essential for security and performance. Here’s how to update and...

How to Check Your VPS Resource Usage

Monitoring your VPS resource usage helps you keep your server performing well. Here’s how you can...

How to Reboot Your VPS Safely

<p>Sometimes, you need to reboot your VPS to apply updates or fix issues. Here’s how to do...