How to Install Redis on Ubuntu 24.04: Step-by-Step
Redis is an extremely fast data store that stores all its data in memory, rather than on disk. It can react almost immediately as a result. Redis is typically used for cache, user sessions, message queues, and to speed up slow programs. Because Redis can return data so quickly, it helps reduce the small delays users might experience in high-traffic systems.
Redis works incredibly well with Ubuntu 24.04, a contemporary, reliable operating system. Installing Redis on it is easy and convenient because it provides long-term support and good performance. It’s a great choice for developers, students, or small teams that want fast data processing without complicating things.
#What is Redis?
Redis stands for Remote Dictionary Server. Because it retains all data in memory rather than writing it to disk during regular activity, it is known as an in-memory data structure store. Using this method, Redis can support data types, including hashes and strings. These structures facilitate a range of tasks, including caching and real-time counting.
Unlike traditional databases, Redis does not constantly read and write from disk. Standard databases store large tables and long-term records. Redis works with short-term data. It focuses on quick access. This makes it perfect for apps that need instant responses. Real-time features? Redis handles them easily. It’s simple and powerful.
#Prerequisites
Before installing Redis on Ubuntu 24.04, make sure you have the following:
- An Ubuntu 24.04 instance set up on your machine or server. You can easily get one from Cherry Servers.
- A non-root user with sudo privileges to run important system commands.
- Basic command-line knowledge is required to follow the installation steps.
- Hardware that meets the recommended requirements, such as sufficient memory and processing power, is necessary for Redis to run smoothly.
- Network access and firewall permissions that allow Redis ports to communicate without blocks.
#Installing Redis on Ubuntu 24.04
The following is a summary of the steps outlined in this article.
- Update system packages.
- Install Redis from the Ubuntu Repository.
- Verify the Redis installation.
- Start and enable the Redis service.
- Test the Redis connection.
Now that you have a quick overview of the installation, let's go through the steps.
#Step 1: Update system packages
Before installing new programs, refresh your system packages. It’s simple. Ubuntu will fetch the latest updates. It also helps avoid setup errors during the installation. Open your terminal and update the package index. Then upgrade the installed packages.
sudo apt update
sudo apt upgrade -y
OutputHit:1 http://us-centrall.gce.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://us-centrall.gce.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu noble-backports InRelease
Hit:4 https://packages.cloud.google.com/apt google-cloud-ops-agent-noble-2 InRelease
Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
The first command checks for the most recent package information. The second command installs the available updates. Once these two commands finish running, your system will be ready for the Redis installation.
#Step 2: Install Redis from the Ubuntu repository
Ubuntu 24.04 comes with Redis built in. No extra links, no downloads from the web. Just one command, and it’s there, ready to run. After the installation, you can check the version immediately.
To install Redis, run the command below.
sudo apt install redis-server
OutputReading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libatomicl libjemalloc2 liblzfl redis-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libatomic1 libjemalloc2 liblzfl redis-server redis-tools
Once the installation is complete, you can confirm the version with:
redis-server --version
OutputRedis server v=7.0.15 sha=00000000:0 malloc-jemalloc-5.3.0 bits=64 build=62c7a5d52c72f4cd
This command shows the Redis version, in this case version 7.0.15. If a number appears, then yes, Redis is on your system.
#Step 3: Verify Redis installation
After installing Redis, it is helpful to know where the files ended up. The server binary is not hidden. You can find it easily. On Ubuntu, the system typically places Redis in a standard location; however, knowing exactly where it is can save you time later. Use the command below to check the path.
which redis-server
Output/usr/bin/redis-server
You can also check the installed Redis package details:
dpkg -l | grep redis
Let’s take a look at the status of the Redis server.
systemctl status redis
Outputredis-server.service - Advanced key-value store
Loaded: loaded (/usr/lib/systemd/system/redis-server.service; enabled; preset: enabled)
Active: active (running) since Sat 2025-11-08 03:30:08 UTC; 1min 37s ago
Docs: http://redis.io/documentation,
man: redis-server(1)
Main PID: 3274 (redis-server)
Status: "Ready to accept connections"
Tasks: 5 (limit: 4603)
Memory: 3.2M (peak: 3.7M)
CPU: 286ms
CGroup: /system.slice/redis-server.service
3274 "/usr/bin/redis-server 127.0.0.1:6379"
Nov 08 03:30:08 redis systemd[1]: Starting redis-server.service - Advanced key-value store...
Nov 08 03:30:08 redis systemd[1]: Started redis-server.service - Advanced key-value store.
This confirms Redis is running as expected and ready to accept incoming connections.
#Step 4: Start and enable the Redis service
Redis typically starts automatically after installation, but you can start it manually if needed.
Start Redis:
sudo systemctl start redis
Set Redis to start during system boot:
sudo systemctl enable redis-server.service
OutputSynchronizing state of redis-server.service with SysV service script w
Executing: /usr/lib/systemd/systemd-sysv-install enable redis-server
Verify the service is active by checking its status again.
If the service is running, you will see an “active” state and no error messages.
#Step 5: Test Redis connection
After installation, you can test the Redis client.
Open the Redis CLI:
redis-cli
Run a simple test:
ping
You should get:
PONG
Output127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
Exit the CLI:
exit
This confirms that your Redis server is accepting commands.
#Configuring Redis
The main Redis settings are defined in /etc/redis/redis.conf. You can change memory limits, security options, and other options here. It’s a good idea to make a backup first. Always. Just in case.
Open the file:
sudo vim /etc/redis/redis.conf
#Bind Redis to localhost for security
By default, Redis listens on 127.0.0.1. This limits access to local applications only.
Look for the bind line. Make sure it includes your local IPV4 address 127.0.0.1 and the IPV6 address ::1:
bind 127.0.0.1 -::1
If it is commented, remove the # to uncomment it.
This prevents outside access and protects your data.
Exit the file and restart Redis:
sudo systemctl restart redis
#Setting a password for Redis access
Redis supports password protection using the “requirepass” setting. This prevents unwanted access.
In the "/etc/redis/redis.conf" config file, locate the following line:
# requirepass foobared
Uncomment it and replace “foobared” with your own password:
requirepass Your-Password
Restart the service:
sudo systemctl restart redis
After setting a password, you must authenticate:
redis-cli
auth Your-Password
Output127.0.0.1:6379> auth foobared
OK
If successful, you can run commands successfully.
#Changing the default port
The default Redis port is 6379. You can change it for extra security or to avoid conflicts.
Find this line:
port 6379
If you want, you can change it to something else:
port 6380
Restart Redis:
sudo systemctl restart redis
Connect with the new port:
redis-cli -p 6380
#Configuring Redis persistence
Redis supports two persistence methods: RDB snapshots and AOF logs. These help Redis recover data when the server restarts.
#RDB snapshot settings
Look for:
save 900 1
save 300 10
save 60 10000
These lines control how often Redis saves data. You can keep these or change them based on your needs.
#AOF log settings
Enable AOF by finding:
appendonly no
Change to:
appendonly yes
AOF is safer, but it requires more disk writes.
Restart Redis:
sudo systemctl restart redis
#Securing Redis
Redis should not be exposed directly to the internet. Here are the most common security settings.
#Firewall configuration
If you use UFW, you can restrict access to only local applications.
Allow local traffic only:
sudo ufw allow from 127.0.0.1 to any port 6379
You can also block outside requests completely:
sudo ufw deny 6379
#Protected mode
Redis has a protected mode that blocks outside access when no password is set.
Verify it is on:
Open the config file and find:
protected-mode yes
Leave it as “yes” to keep the protection active.
Restart Redis:
sudo systemctl restart redis
#Restricting access by IP
If Redis must be accessed from another machine, avoid making it available to the whole network. Allow only trusted IP addresses.
In the config file, update as shown below:
bind 127.0.0.1 enter_trusted_IP
This allows one specific machine.
Restart the service.
#Tuning Redis for performance
Redis provides high performance by default, but you can customize memory rules and background settings to enhance stability.
#Adjusting max memory and eviction policies
Set a memory limit to avoid system overload.
In the config file, search for:
# maxmemory <bytes>
Replace <bytes> with the memory limit you want.
Then choose an eviction method, such as:
maxmemory-policy allkeys-lru
This means that Redis removes the least recently used keys when space is exhausted.
Restart Redis.
#Setting up Redis as a background service
Redis usually runs in the background on Ubuntu. To run it manually in daemon mode, set the following in the configuration file.
daemonize yes
This makes Redis run silently in the background.
Restart Redis after editing.
#Monitoring Redis performance
You can track Redis performance using built-in commands. These commands should be run directly from the Bash terminal using redis-cli. If your Redis server requires a password, you must include authentication when running them.
View real-time activity:
redis-cli monitor
Check memory usage:
redis-cli info memory
Check CPU usage:
redis-cli info cpu
View general server statistics:
redis-cli info
These commands help you understand how Redis behaves under load.
#Uninstalling Redis
When you no longer need Redis, you can uninstall it. The first step is to stop the Redis service so it doesn’t stay active:
sudo systemctl stop redis
Once the service is stopped, you can remove the Redis package from your system:
sudo apt remove redis -y
This removes the main program, but some configuration files and stored data may still be present on the disk. To remove those as well, run:
sudo apt purge redis -y
After that, you can delete any extra data directories:
sudo rm -rf /etc/redis
If you want to clean up unused package files, you can also run:
sudo apt autoremove -y
With these steps, Redis and all related files will be cleaned from your Ubuntu system.
#Where to host Redis
How you host Redis depends on what your project needs. Some opt for the cloud to reach a wider audience, while others prefer local deployment for convenience and control.
For testing or learning purposes, local deployment is a suitable option. You have complete control and may easily experiment with new features or settings at no additional expense. Developers often pick this option when they want quick access during development.
For larger projects, cloud hosting is a strong option. It offers more room for growth and better stability for production systems. You can scale resources as your traffic increases, and your data remains accessible from various parts of the world. This makes it suitable for apps that serve many users or handle frequent requests.
Among cloud options, Cherry Servers is a solid pick for hosting Redis. We offer fast hardware and reliable network speeds. Our servers provide strong performance, which is crucial for Redis, as it relies on rapid data access. You also get flexible plans that fit both small and large projects.
#Why pick Cherry Servers?
Here are a few key advantages of hosting your Redis instance with them:
- Wide Range of Server Types: Choose from dedicated, instant, custom, GPU, Web3 and virtual servers.
- High-Performance Options: Premium VDS, Performance VDS, and Cloud ARM VDS provide the necessary resources to handle any workload efficiently.
- Specialized Solutions: Web3 servers, Solana servers, and cloud repatriation options allow you to run niche applications efficiently.
- Cloud Services: Cloud VPS, Storage VPS, and Cloud VDS options are beneficial for both testing and production environments.
- Multiple Locations: With data centers in Europe, the US, and Asia, they can provide fast response times for users worldwide.
Hosting is simple with Cherry Servers. Need more power? Scale up easily. Want to experiment? Try different server types.
#Conclusion
You can create quick and responsive apps by installing and configuring Redis on Ubuntu 24.04. Redis provides fast data access, while Ubuntu offers a stable environment that easily manages daily tasks. You may install the server, test its capabilities, update and customize its settings, and add basic protection by following the instructions in this guide. You also learned how to manage its features and remove them when you're done using it. You now have a solid understanding of how to utilize Redis in development, learning, or production environments.
FAQs
What is Redis used for?
Redis is used for fast data storage, caching, session handling, and real-time tasks.
Is Redis a cache or a DB?
Redis can work as both a cache and a lightweight database.
Is Redis SQL or NoSQL?
Redis is a NoSQL data store.
How do I choose the right plan on Cherry Servers?
Pick a Cherry server plan based on your project size, traffic needs, and budget.
Are Cherry Servers good for gaming?
Yes, Cherry Servers can run gaming workloads if you pick a plan with strong hardware and low latency.
Starting at just $3.24 / month, get virtual servers with top-tier performance.