ISPT
发布于 2023-08-21 / 1 阅读
0
0

Redis 安装方式

体验 Redis 需要使⽤ Linux 或者 Mac 环境,如果是 Windows 可以
考虑使⽤虚拟机。主要⽅式有四种:

  1. 使⽤ Docker 安装。

  2. 通过 Github 源码编译。

  3. 直接安装 apt-get install(Ubuntu)、yum install(RedHat) 或者 brew install(Mac)。

  4. 如果读者懒于安装操作,也可以使⽤⽹⻚版的 Web Redis(https://try.redis.io/) 直接体验。

具体操作如下:

Docker⽅式

# 拉取 redis 镜像
> docker pull redis
# 运⾏ redis 容器
> docker run --name myredis -d -p6379:6379 redis
# 执⾏容器中的 redis-cli,可以直接使⽤命令⾏操作 redis
> docker exec -it myredis redis-cli

Github 源码编译⽅式

# 下载源码
> git clone --branch 2.8 --depth 1
git@github.com:antirez/redis.git
> cd redis
# 编译
> make
> cd src
# 运⾏服务器,daemonize表示在后台运⾏
> ./redis-server --daemonize yes
# 运⾏命令⾏
> ./redis-cli

直接安装⽅式

# mac
> brew install redis
# ubuntu
> apt-get install redis
# redhat
> yum install redis
# 运⾏客户端
> redis-cli


评论