NEW! EPYC + NVMe based VPS

Log in
+1 (855) 311-1555
#server-performance#vps

How to install and use Redis on a VPS

9 min read - January 7, 2026

hero section cover

Table of contents

  • How to install and use Redis on a VPS
  • How To Install Redis on Ubuntu (Linux)
  • Preparing Your VPS for Redis Installation
  • Installing Redis on a VPS
  • Configuring and Securing Redis
  • Testing and Using Redis on a VPS
  • Maintaining and Monitoring Redis on a VPS
  • Conclusion
  • FAQs

Share

Learn how to install and configure Redis on a VPS for optimal performance, security, and management in your applications.

How to install and use Redis on a VPS

Redis is a fast, in-memory data store used for caching, databases, and message brokering. Installing it on a Virtual Private Server (VPS) ensures dedicated resources, better performance, and control over configuration. Here's a quick summary of what you need to know:

  • Why Redis? It's ideal for caching, session management, real-time analytics, and message queuing.
  • VPS Benefits: Dedicated CPU, RAM, and storage for consistent performance. Customizable configurations and scalability for growing workloads.
  • System Requirements: At least 1 GB RAM (4 GB+ recommended for production), 10–20 GB disk space, and a Linux OS like Ubuntu or CentOS.
  • Installation Steps: Use package managers (apt for Ubuntu or yum/dnf for CentOS) to install Redis, configure it for systemd, and secure it with passwords or ACLs.
  • Optimization Tips: Set memory limits, enable persistence, bind to secure IPs, and disable transparent huge pages for better performance.

Redis on a VPS delivers low-latency data processing and flexibility for demanding applications. Below, you'll find detailed steps for setup, configuration, and maintenance.

How To Install Redis on Ubuntu (Linux)

Redis

Preparing Your VPS for Redis Installation

Before diving into Redis installation, it’s important to set up secure access to your VPS and ensure your system is fully updated. This initial groundwork creates a stable and secure environment, paving the way for a hassle-free Redis deployment.

Accessing Your VPS via SSH

SSH (Secure Shell) is the go-to method for securely accessing your VPS command line. The steps vary slightly depending on your operating system:

  • Windows users: Download and install PuTTY, a free SSH client designed for secure connections to Linux servers. You can grab it from the official PuTTY website. Once installed, use your VPS IP address, username, and password to connect.
  • macOS and Linux users: Fire up the built-in Terminal application. Use the following command to connect:

    ssh username@your-server-ip  
    

    Replace username and your-server-ip with your actual credentials.

  • Other VPS providers: Many providers include a browser-based terminal in their dashboards, letting you connect without using separate software.

Once connected, avoid performing installations as the root user. Instead, create a new user account with administrative privileges. If you're logged in as root, add a user with:

adduser your-username  

Replace your-username with your chosen name, and set a strong password when prompted. Next, grant the new user sudo privileges with:

usermod -a -G sudo your-username  

Switch to the new user using:

su your-username  

Updating Your VPS and Installing Dependencies

Keeping your system updated ensures you’ll benefit from the latest security fixes and software improvements. As noted in Vultr Docs:

“Redis® benefits from the system's stability, security updates, and package management” - Vultr Docs

Here’s how to update your system based on the operating system you’re using:

  • For Ubuntu/Debian-based systems:
    Update the package cache and upgrade all available packages:

    sudo apt update  
    sudo apt upgrade  
    

    Ubuntu versions like 20.04, 22.04, and 24.04 are all suitable for Redis installations.

  • For CentOS systems:
    First, install the EPEL repository if it’s not already installed, then update all packages:

    yum -y install epel-release  
    sudo yum update  
    

During the installation, the package manager will handle any Redis-related dependencies, ensuring everything is up-to-date and secure.

This preparation process usually takes around 5–15 minutes, depending on your system’s current state and internet speed. Once your VPS is updated and ready, you can move on to installing Redis.

Installing Redis on a VPS

Once your VPS is updated, the next step is to install Redis. While the process varies slightly between Linux distributions like Ubuntu and CentOS, both make it relatively simple using their package managers.

Installing Redis on Ubuntu

Ubuntu includes Redis in its default repositories, which makes installation a breeze with the APT package manager. Follow these steps to get Redis up and running:

  1. Install the Redis server package by running:

    sudo apt install redis-server
    

    This command will install Redis along with its required dependencies.

  2. After installation, configure Redis to work with Ubuntu's systemd. Open the Redis configuration file:

    sudo nano /etc/redis/redis.conf
    

    Locate the supervised directive and change its value from no to systemd:

    supervised systemd
    

    This adjustment integrates Redis with Ubuntu's systemd for better service management. Save your changes by pressing Ctrl+X, then Y, and hitting Enter.

  3. Restart the Redis service to apply the changes:

    sudo systemctl restart redis.service
    
  4. Enable Redis to start automatically on boot:

    sudo systemctl enable redis
    
  5. Verify the installation by running:

    redis-cli ping
    

    If everything is set up correctly, you should see PONG.

Installing Redis on CentOS

CentOS

For CentOS, Redis isn’t included in the default repositories, so you’ll need the EPEL repository to access it. If you’ve already added the EPEL repository during the setup phase, you can proceed as follows:

  1. Install Redis using one of these commands based on your CentOS version:

    sudo yum install redis
    

    Or for newer versions:

    sudo dnf install redis
    
  2. Start the Redis service:

    sudo systemctl start redis
    
  3. Enable Redis to start automatically on boot:

    sudo systemctl enable redis
    
  4. Check if Redis is running properly:

    sudo systemctl status redis
    

    You should see an active (running) status. To confirm the installation, run:

    redis-cli ping
    

    A PONG response indicates that Redis is functioning correctly.

Installation Steps Comparison

The process for installing Redis on Ubuntu and CentOS differs mainly in the package manager and configuration details. Here's a quick comparison:

AspectUbuntuCentOS
Package ManagerAPT (Advanced Package Tool)YUM/DNF
Installation Commandsudo apt install redis-serversudo yum install redis or sudo dnf install redis
Configuration File/etc/redis/redis.conf/etc/redis.conf
Required RepositoryDefault repositoriesEPEL repository
Systemd ConfigurationManual setup (supervised systemd)Default configuration
Service Managementsystemctl commandssystemctl commands

While both distributions use the same commands for starting, enabling, and testing Redis, the setup steps and configuration file paths vary slightly. For Ubuntu, you’ll need to configure systemd integration, whereas CentOS uses a default setup.

Once Redis is installed and verified, you can move on to configuring and securing it for better performance and reliability.

Configuring and Securing Redis

Once Redis is installed and running, the next step is to fine-tune it for better performance and safeguard it against unauthorized access. By default, Redis prioritizes ease of use over security, which means adjusting its settings is crucial for production environments. Here's how you can configure Redis to optimize its operation and secure your system.

Editing Redis Configuration

Redis comes with a configuration file that controls various aspects, such as memory usage and network settings. On Ubuntu, this file is usually located at /etc/redis/redis.conf, while on CentOS, it's typically found at /etc/redis.conf. You can edit it using your favorite text editor:

sudo nano /etc/redis/redis.conf

Memory Management:
It's essential to set a memory limit for Redis to prevent it from using all available system memory, which could cause performance issues. Use the maxmemory directive to define a maximum memory limit:

maxmemory 512mb

Adjust this value based on your server's available RAM.

Persistence Options:
Redis offers two ways to save data to disk: RDB snapshots and AOF (Append Only File) logging. For a balance between performance and durability, configure RDB snapshots and enable AOF with every-second fsync:

save 900 1
save 300 10
save 60 10000
appendonly yes
appendfsync everysec

Network Binding:
For security, Redis should be bound to the loopback interface (127.0.0.1) by default. If it's listening on all interfaces (0.0.0.0), it could be exposed to unauthorized access. Restrict it to localhost unless external access is absolutely necessary:

bind 127.0.0.1

If external access is required, specify only the necessary IP addresses instead of using a wildcard.

Securing Redis with Passwords and Access Restrictions

Redis supports two main methods for authentication: the requirepass directive and Access Control Lists (ACLs), introduced in Redis 6.

Basic Password Protection:
To enable password authentication, locate the requirepass directive in the configuration file. First, generate a strong password with the following command:

openssl rand 60 | openssl base64 -A

This generates a secure 60-character password. Uncomment the requirepass line in the configuration file and add your generated password:

requirepass your_generated_password_here

Restart Redis to apply the changes:

sudo systemctl restart redis

You can test the password authentication by launching the Redis CLI and using the auth command:

redis-cli
auth your_generated_password_here
ping

If successful, the auth command will return "OK", and the ping command will respond with "PONG."

Access Control Lists (ACLs):
For more granular control, Redis 6 and later versions allow you to create multiple users with specific permissions. To set up ACLs, add lines like these to your configuration file:

# Disable the default user
user default off
# Create a new user with full permissions
user myuser on >your_generated_password ~* &* +@all

Here, ~* grants access to all keyspaces, &* permits all Pub/Sub channels, and +@all allows all commands. You can restrict permissions further by specifying command categories, such as +@read or +@write.

After restarting Redis, test the ACL setup using:

redis-cli --user myuser --askpass

Enter the password when prompted, and verify the connection with the ping command.

Performance Tips for VPS

To get the most out of Redis on a VPS, focus on optimizing both its configuration and your hardware resources.

Memory Allocation:
Keep an eye on Redis's memory usage with the info memory command in the Redis CLI. Adjust the maxmemory directive as needed to prevent overuse.

Storage Optimization:
For persistence, faster storage like NVMe can significantly improve read/write speeds compared to traditional SSDs. If possible, choose a VPS with NVMe storage for better performance.

CPU Optimization:
While Redis operations are mostly single-threaded, tasks like persistence and replication can benefit from multiple CPU cores. Adjust the frequency of RDB snapshots to reduce CPU load while maintaining data safety:

# Less frequent saves reduce CPU overhead
save 900 1
save 300 10
save 60 10000

Network Performance:
If your application relies heavily on Redis for caching or real-time processing, ensure your VPS provides sufficient network bandwidth. Unmetered bandwidth can help avoid unexpected data transfer costs.

Kernel Optimization:
Make these adjustments in /etc/sysctl.conf to enhance Redis performance:

vm.overcommit_memory = 1
net.core.somaxconn = 65535

The first setting prevents issues during background saves, while the second increases the maximum number of simultaneous connections.

Disabling Transparent Huge Pages (THP):
THP can cause latency problems with Redis. Disable it by adding this command to your system startup:

echo never > /sys/kernel/mm/transparent_hugepage/enabled

With these steps, your Redis instance will be well-equipped to handle demanding workloads efficiently and securely.

background image
Is your server holding back your growth?

Tired of slow deployments or bandwidth limits? FDC Servers offers instant dedicated power, global reach, and flexible plans built for any scale.

Upgrade now

Testing and Using Redis on a VPS

Once you've set up and secured Redis on your VPS, the next step is to ensure it's working correctly and explore how it can enhance your applications. Testing confirms everything is functioning as it should, and understanding Redis's potential can help you make the most of its capabilities.

Testing the Redis Installation

To check if Redis is installed and running, you can use the command-line interface (CLI). Here’s how:

  • Basic Connection Test (No Authentication):

    redis-cli ping
    

    If Redis is running, it will respond with PONG.

  • Testing with Password Authentication:

    redis-cli
    auth your_generated_password_here
    ping
    

    Replace your_generated_password_here with the password you set up. If successful, you'll see PONG.

  • Testing with ACL Authentication:

    redis-cli --user myuser --askpass
    ping
    

    Enter your password when prompted, and Redis should return PONG.

To test basic functionality, try storing and retrieving data:

redis-cli
set test "It's working!"
get test

The set command should return OK, and the get command should display "It's working!".

Finally, verify the Redis service status and ensure it's bound to the correct network interface:

sudo systemctl status redis
sudo netstat -lnp | grep redis

These steps confirm that Redis is ready to handle tasks like caching, session management, or real-time analytics on your VPS.

Common Use Cases for Redis on a VPS

Once Redis is up and running, you can start leveraging it to optimize your VPS environment. Redis is a powerful tool that can boost performance and responsiveness across a range of applications. Here are some of the most common ways to use Redis:

  • Caching:
    Redis excels at caching frequently accessed data, reducing database load and speeding up response times. Whether it's caching database query results, API responses, or precomputed values, Redis helps improve efficiency without overloading your backend.
  • Session Management:
    Redis is perfect for storing session data in memory, offering fast and consistent access. This is especially useful for applications running on multiple servers, as Redis ensures seamless session handling across your infrastructure.
  • Real-time Analytics:
    Thanks to its ability to handle rapid data updates, Redis is ideal for tracking live metrics like page views, user interactions, or system performance. Its built-in data structures, such as sorted sets and hashes, make it easy to manage leaderboards, counters, and time-series data.

Here’s a quick breakdown of Redis use cases tailored for VPS environments:

Use CaseVPS-Specific AdvantagesLimitationsBest For
CachingConsistent performance with dedicated VPS resources; fast persistence with NVMe storageLimited by VPS memory sizeHigh-traffic websites, API caching
Session ManagementSecure storage thanks to VPS isolation; scales across multiple VPS instancesRisk of single point of failure without clusteringMulti-server applications, user sessions
Real-time AnalyticsEfficient handling of frequent updates with dedicated CPU; unmetered bandwidth aids data ingestionComplex queries may need additional databasesDashboards, activity tracking, monitoring
  • Message Queuing:
    Redis’s pub/sub feature allows real-time messaging between components, making it great for chat systems, notifications, or triggering background tasks.
  • Rate Limiting:
    With its atomic operations and expiration capabilities, Redis is excellent for implementing rate limits, whether controlling API requests or user actions.

The key to getting the most out of Redis is to start small - choose one use case, monitor its impact, and then expand Redis's role as you gain confidence in its capabilities. By aligning Redis's strengths with your VPS needs, you can unlock better performance and efficiency for your applications.

Maintaining and Monitoring Redis on a VPS

Once Redis is installed and running, keeping it in top shape requires consistent maintenance and monitoring. Redis is a critical part of many systems, so staying proactive helps ensure smooth performance and avoids potential disruptions.

Routine Maintenance Tasks

Backup management is a must. Automate backups through your hosting provider and use the SAVE command in Redis to create snapshots. Store backup files like dump.rdb and appendonly.aof securely in /var/lib/redis/, applying strict permissions. For added safety, encrypt these backups using tools like gpg and transfer them to remote storage, such as object storage buckets. To fully protect your data, enable both RDB and AOF persistence in the Redis configuration file (/etc/redis/redis.conf).

Testing your backups is just as important as creating them. Regularly restore backups on a staging server to confirm they work and ensure your recovery process is solid.

Performance monitoring is another key task. Keep an eye on metrics like memory usage, CPU load, and latency. Tools like Prometheus and Grafana integrate well with VPS setups and provide detailed insights into Redis performance.

Log analysis can help you detect potential problems early. Use journalctl to monitor logs, and consider forwarding them to a centralized system like the ELK stack. This allows you to spot anomalies, such as repeated authentication failures (NOAUTH errors) or unusual connection attempts.

The Redis slow log is invaluable for identifying performance bottlenecks. Configure settings like slowlog-log-slower-than and slowlog-max-len in the Redis configuration file. You can then use the redis-cli SLOWLOG GET command to review slow-running commands and address inefficiencies.

Finally, regular updates are essential. Check for Redis updates at least once a month, and always test new patches on a staging server before rolling them out to production.

For long-term stability, combining these maintenance practices with a robust VPS infrastructure can make a big difference.

Leveraging FDC Servers for Long-Term Stability

FDC Servers

FDC Servers offer features that can enhance the reliability and performance of your Redis deployment. Their platform includes NVMe storage, unmetered bandwidth, instant deployment, and global locations, all of which are particularly useful for Redis workloads.

NVMe storage improves the speed of Redis persistence operations. Whether writing RDB snapshots or AOF logs, the faster I/O performance of NVMe storage minimizes delays, especially as your dataset grows.

With unmetered bandwidth, you can move large backup files or replicate data to multiple locations without worrying about extra costs. This makes it easier to implement robust backup strategies or set up real-time monitoring with external tools.

The instant deployment feature allows you to quickly spin up new VPS instances. This is especially helpful for tasks like testing, clustering, or disaster recovery. If you need to take your primary Redis server offline for maintenance, you can deploy a backup instance in minutes to minimize downtime.

Lastly, global locations give you the flexibility to position Redis servers closer to your users or create geographically distributed backups. This can reduce latency and improve disaster recovery as your application scales.

Conclusion

Running Redis on a VPS offers a high-performance solution by leveraging in-memory data operations. By following the setup steps and best practices mentioned earlier, this approach provides a strong and reliable foundation for handling demanding applications.

With VPS hosting, you get dedicated CPU, RAM, and storage, ensuring consistent performance for Redis. This isolation not only stabilizes the system but also provides the flexibility to scale resources as your application requirements grow, making it a smart choice for Redis workloads.

When properly configured and maintained, Redis on a VPS delivers lightning-fast performance and long-term reliability. Whether you're using it for caching, session management, or real-time data processing, Redis's sub-millisecond response times combined with the dedicated resources of a VPS can significantly enhance application speed, reduce server strain, and improve scalability. Additionally, advanced VPS features further bolster this setup.

With options like NVMe storage, unmetered bandwidth, and quick deployment, VPS solutions can seamlessly scale to meet growing demands. This flexibility allows you to expand resources or deploy additional instances without sacrificing performance or uptime.

For developers and businesses focused on performance, scalability, and control, pairing Redis with a VPS is a strategic and efficient choice for managing data infrastructure.

FAQs

What are the main advantages of using Redis on a VPS?

Redis is prized for its blazing speed and efficiency. By keeping data in memory, it delivers incredibly fast read and write operations. This makes it a go-to solution for tasks like caching, session management, and real-time analytics.

Running Redis on a VPS gives you complete control over your server, allowing you to fine-tune configurations to meet your unique requirements. Plus, Redis supports various data structures and ensures data durability, making it a dependable and flexible choice for modern applications.

How can I secure my Redis installation on a VPS?

To keep your Redis installation secure on a VPS, consider these key steps:

  • Limit access: Bind Redis to specific IP addresses and allow connections only from trusted sources.
  • Enable password protection: Add an extra layer of security by requiring authentication.
  • Modify or disable sensitive commands: Reduce the risk of misuse by unauthorized users.
  • Implement a firewall: Block unwanted traffic and secure the Redis port from unauthorized access.
  • Use SSL tunneling: Encrypt data exchanges between your Redis server and its clients to safeguard transmissions.

Taking these precautions can go a long way in protecting your Redis setup and keeping your data safe from potential threats.

What are common challenges when maintaining Redis on a VPS, and how can you address them?

When running Redis on a VPS, you might encounter challenges like memory management, network performance, and connection limits. Here’s how you can tackle these issues effectively:

  • Memory management: Set the maxmemory limit and select an appropriate maxmemory-policy to prevent Redis from consuming more memory than your VPS can handle.
  • Network performance: Fine-tune network settings, such as adjusting the tcp-keepalive parameter, to minimize latency and maintain stable connections.
  • Connection limits: Use the maxclients setting to define the maximum number of simultaneous connections, helping to avoid resource overload.

By keeping a close eye on your Redis instance and refining these configurations as needed, you can maintain smooth and reliable performance on your VPS.

Blog

Featured this week

More articles
How to install and use Redis on a VPS
#server-performance#vps

How to install and use Redis on a VPS

Learn how to install and configure Redis on a VPS for optimal performance, security, and management in your applications.

9 min read - January 7, 2026

#vps#dedicated-servers

Monitoring your Dedicated server or VPS, what are the options in 2025?

12 min read - November 28, 2025

More articles
background image

Have questions or need a custom solution?

icon

Flexible options

icon

Global reach

icon

Instant deployment

icon

Flexible options

icon

Global reach

icon

Instant deployment