Redis 安装

在 Linux / macOS / Windows 上安装并启动 Redis。

Beginner
Key PointsLinux 用 apt/yum 装 redis-server;macOS 用 brew;Windows 用 WSL 或微软移植版。

Linux

Shell
sudo apt install -y redis-server     # Debian/Ubuntu
sudo systemctl enable --now redis-server
Output
Created symlink ...redis-server.service
Active: active (running)

macOS

Shell
brew install redis
brew services start redis
Output
(redis) successfully started

Windows

There is no official native Windows build; use WSL (install Ubuntu, then install as on Linux). A legacy Microsoft port (Redis 3.x) exists for local learning only.

验证启动

Shell
redis-cli ping
Output
PONG
redis-cli ping returning PONG means the server is alive. A fresh instance has no password and may bind 0.0.0.0 — a public Redis with no auth is a major risk; set requirepass before production.

Friends & Partners