Redis stores data in memory and is often used by applications for caching or queues. This guide explains the installation choices for CentOS and Ubuntu and the checks needed before an application connects to it.
Why install Redis on CentOS and Ubuntu?
Install Redis when your application supports it and you have enough memory for the expected data. Check whether the application requires a particular Redis version and whether it uses Redis as a cache or as persistent storage.
Install Redis on CentOS
CentOS Linux 7 and 8 are retired. Their old yum instructions should not be used for a new production installation.
On a supported CentOS Stream release, check that the chosen Redis repository explicitly supports your release. Follow its package, configuration and service instructions. The Redis installation guide lists supported installation methods; a package intended for another distribution is not automatically compatible.
Install Redis on Ubuntu
These commands install Ubuntu’s distribution package, rather than a separate vendor repository. Check the package available for your supported Ubuntu release first:
sudo apt update
apt show redis-server
sudo apt install redis-serverReview /etc/redis/redis.conf. For an application on the same server, keep Redis restricted to loopback addresses with protected mode enabled. Do not expose port 6379 publicly.
Enable and check the service:
sudo systemctl enable --now redis-server
sudo systemctl status redis-server
redis-cli pingA working local connection normally returns PONG. If authentication is configured, use the credentials and connection method set for that installation.
Secure and optimise Redis
Redis traffic is not automatically encrypted. Remote access needs an explicit network policy, appropriate authentication and, where required, TLS configuration.
Set memory limits and eviction behaviour to suit the application. If Redis stores data that must survive a restart, configure persistence and backups, then test recovery. A cache and a persistent data store have different recovery requirements.