Script Valley
Redis: Complete Course
Redis FundamentalsLesson 1.2

How to install Redis on Linux, macOS, and Docker

apt install, Homebrew install, Docker run, redis-server, redis-cli, default port 6379, config file location

Installing Redis

Pick the method that matches your environment. All three result in a server listening on port 6379.

Linux (Ubuntu / Debian)

sudo apt update
sudo apt install redis-server -y
sudo systemctl start redis
sudo systemctl enable redis
redis-cli ping   # โ†’ PONG

macOS (Homebrew)

brew install redis
brew services start redis
redis-cli ping   # โ†’ PONG

Docker (any platform)

# Pull and run the official image
docker run -d \
  --name redis-dev \
  -p 6379:6379 \
  redis:7-alpine

redis-cli -h 127.0.0.1 -p 6379 ping   # โ†’ PONG

Verify your installation

After starting the server, open a terminal and run redis-cli. You land in an interactive shell. Type PING and you should see PONG. Type INFO server to see the Redis version, config file path, and uptime. The default config file lives at /etc/redis/redis.conf on Linux and /usr/local/etc/redis.conf on macOS. You rarely need to touch it in development.

Up next

Redis data types overview: strings, hashes, lists, sets, sorted sets

Sign in to track progress

How to install Redis on Linux, macOS, and Docker โ€” Redis Fundamentals โ€” Redis: Complete Course โ€” Script Valley โ€” Script Valley