Installing Redis
4. Installing Redis
Section titled “4. Installing Redis”Windows
Section titled “Windows”Redis does not officially support Windows natively. You have two options:
Option 1: WSL2 (Recommended)
# Install WSL2 first, then inside Ubuntu terminal:sudo apt updatesudo apt install redis-server -ysudo service redis-server startOption 2: Use Docker (see Section 17)
Ubuntu / Debian Linux
Section titled “Ubuntu / Debian Linux”# Update package listsudo apt update
# Install Redissudo apt install redis-server -y
# Start Redis servicesudo systemctl start redis-server
# Enable Redis to start on bootsudo systemctl enable redis-server
# Check statussudo systemctl status redis-server# Install via Homebrewbrew install redis
# Start Redis as a background servicebrew services start redis
# Or start manually in the foregroundredis-serverDocker
Section titled “Docker”# Pull and run Redisdocker run --name my-redis -p 6379:6379 -d redis
# Verify it's runningdocker ps
# Connect to Redis CLI inside the containerdocker exec -it my-redis redis-cliVerifying Your Installation
Section titled “Verifying Your Installation”# Start Redis serverredis-server
# Open a new terminal and connect with CLIredis-cli
# Test connection — Redis should reply PONG127.0.0.1:6379> PINGPONG
# Set a test key127.0.0.1:6379> SET hello "Redis is working!"OK
# Get the value back127.0.0.1:6379> GET hello"Redis is working!"Tip: Redis CLI connects to
127.0.0.1:6379by default. For a remote host, useredis-cli -h <host> -p <port>.