Appearance
Redis Installation
To experience Redis, you need a Linux or Mac environment. If you're on Windows, consider using a virtual machine. There are four main installation methods:
- Using Docker.
- Compiling from GitHub source.
- Direct installation via package managers (apt-get install for Ubuntu, yum install for RedHat, or brew install for Mac).
- Using the web version of Web Redis for a direct experience.
Specific Operations
Docker Method
bash
# Pull the Redis image
> docker pull redis
# Run the Redis container
> docker run --name myredis -d -p6379:6379 redis
# Execute redis-cli inside the container for command line operations
> docker exec -it myredis redis-cli
GitHub Source Compilation Method
bash
# Download the source code
> git clone --branch 2.8 --depth 1 git@github.com:antirez/redis.git
> cd redis
# Compile
> make
> cd src
# Run the server (daemonize means to run in the background)
> ./redis-server --daemonize yes
# Run the command line interface
> ./redis-cli
Direct Installation Method
bash
# For Mac
> brew install redis
# For Ubuntu
> apt-get install redis
# For RedHat
> yum install redis
# Run the client
> redis-cli