Redis
Deployment
Bare-Metal (Linux)
To install Redis OSS on Linux, follow this official guide.
- Add the Redis repository, update APT, and install Redis:
sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis
- Redis should start automatically and be configured to start at boot. If it doesn't start on reboot, enable it manually:
sudo systemctl enable redis-server
sudo systemctl start redis-server
- Verify the status of the Redis service:
sudo systemctl status redis-server
- Check the Redis server binary location:
which redis-server
/usr/bin/redis-server is the Redis server executable, installed system-wide.
Usage
Connect to Redis
Once Redis is running, test the connection using redis-cli:
redis-cli
Then run the PING command:
127.0.0.1:6379> ping
PONG
By default, Redis runs on port 6379.