Redis的下载与安装(Linux&Windows)单机版
前言
版本说明
linux.centos=7.7.1908
linux.redis=5.0.5
windows=10
windows.redis=3.2.100
相关链接
- Redis 官网:https://redis.io/
- Redis 官网下载地址:https://redis.io/download
- Redis windows 下载地址:https://github.com/MicrosoftArchive/redis/releases
- Redis DockerHub 网址:https://hub.docker.com/_/redis
- Redis Client 网址: https://github.com/caoxinyu/RedisClient/releases
Docker 下载安装
DockerHub 地址:https://hub.docker.com/_/redis
# 拉取
docker pull redis
# 运行
## 无密码运行
docker run -d --name redis-0 -p 6379:6379 redis
## 有密码运行
docker run -d --name redis-0 -p 6379:6379 redis --requirepass redisPassword
Linux 下载安装
环境准备
yum install -y gcc-c++
CentOS7 安装 Redis6 前提
# 查看 gcc 版本是否在5.3以上,centos7.6 默认安装 4.8.5
gcc -v
# 升级 gcc 到 5.3 及以上,如下:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
# 配置
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
# 生效
source /etc/profile
下载
Redis 官网下载地址:https://redis.io/download
mkdir -p /usr/local/redis
# 上传文件
cd /usr/local/redis
tar -zxvf redis-5.0.5.tar.gz
cd redis-5.0.5
编译与安装
cd /usr/local/redis/redis-5.0.5
# 编译
make
#安装成功之后 在redis目录下多出来一个bin目录
make PREFIX=/usr/local/redis install
启动
# 前台启动
cd /usr/local/redis/bin
./redis-server
# 后台启动
## 将 redis-5.0.5 目录下的 redis.conf 文件复制到 /usr/local/redis/bin 下
## 修改 /usr/local/redis/bin 目录下的 redis.conf 设置为后台启动, 修改 daemonize 值改成 yes 即可
## 后台启动
./redis-server redis.conf
redis.conf 设置
# 搜索 bind 127.0.0.1,注释 bind 127.0.0.1 即可远程登录访问
# 搜索 daemonize ,设置为 daemonize yes 即可后台访问
# 搜索 # requirepass foobared,去掉注释,foobared 为默认密码,可以设置其他密码
## 最终效果如下
# bind 127.0.0.1
daemonize yes
requirepass redisPassword
Redis-cli 启动验证
# 方式一,默认连接的本机6379端口
./redis-cli
# 方式二,连接指定主机 指定端口号
./redis-cli -h 192.168.8.50 -p 6379
Windows 下载安装
Redis windows 下载地址:https://github.com/MicrosoftArchive/redis/releases
zip 文件解压即安装,
msi 文件安装即可,可参考:https://blog.csdn.net/SIMBA1949/article/details/79845239
Redis 客户端
https://github.com/qishibo/AnotherRedisDesktopManager/releases