Ubuntu/Debian-based systems:
- Update Package Lists: Bash
sudo apt update
- Install Redis: Bash
sudo apt install redis-server
- Start Redis: Bash
sudo systemctl start redis-server
- Enable Automatic Startup: Bash
sudo systemctl enable redis-server
CentOS/RHEL-based systems:
- Enable EPEL Repository: Bash
sudo yum install epel-release
- Install Redis: Bash
sudo yum install redis
- Start Redis: Bash
sudo systemctl start redis
- Enable Automatic Startup: Bash
sudo systemctl enable redis
macOS:
- Install Homebrew (if not already installed): Bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Redis: Bash
brew install redis
- Start Redis: Bash
brew services start redis
Windows:
- Download Pre-compiled Redis:
- Obtain the latest stable version from https://redis.io/download
- Extract Files:
- Unzip the downloaded file.
- Run Redis Server:
- Navigate to the extracted directory and open a command prompt.
- Execute
redis-server.exe
.
Verification:
- Check Status: Bash
redis-cli ping
- A successful response will display “PONG”.
Security Considerations:
- Bind Redis to a Specific IP:
- Edit the Redis configuration file (
redis.conf
) and modify thebind
directive to restrict access.
- Edit the Redis configuration file (
- Implement Password Protection:
- Set a password using the
requirepass
directive inredis.conf
.
- Set a password using the
- Enable Firewall Rules:
- Configure firewall rules to allow only authorized connections.