- Published on
Install Redis on Different Operating Systems
- Authors
- Name
- Hieu Cao
Introduction
Redis is a versatile NoSQL database used for caching, session storage, and real-time analytics. This guide explains how to install Redis on macOS, Linux, and Windows for local and server environments.
Installation on macOS
Using Homebrew
Update Homebrew:
brew update
Install Redis:
brew install redis
Start Redis Server:
brew services start redis
Verify Installation:
redis-cli ping
The response should be
PONG
.
Installation on Ubuntu
Using APT Package Manager
Update Package Index:
sudo apt update
Install Redis:
sudo apt install redis-server
Enable Redis to Start on Boot:
sudo systemctl enable redis
Start Redis Server:
sudo systemctl start redis
Check Status:
sudo systemctl status redis
Verify Installation:
redis-cli ping
Installation on Windows
Using Windows Subsystem for Linux (WSL)
Enable WSL:
- Open PowerShell as Administrator and run:
wsl --install
- Open PowerShell as Administrator and run:
Install a Linux Distribution (e.g., Ubuntu):
- Launch the Microsoft Store and install Ubuntu.
Install Redis on Ubuntu (WSL): Follow the Ubuntu instructions above.
Start Redis:
redis-server
Connect Using Redis CLI:
redis-cli ping
Common Commands to Start and Stop Redis
Starting Redis Server
- On macOS:
brew services start redis
- On Linux:
sudo systemctl start redis
Stopping Redis Server
- On macOS:
brew services stop redis
- On Linux:
sudo systemctl stop redis
Conclusion
Installing Redis on your local or server environment is straightforward and supports various operating systems. Whether you’re using macOS, Linux, or Windows, these steps will help you set up Redis efficiently.
Redis is now ready to be used for caching, real-time analytics, and more. Explore its features and build powerful applications!