1.linux先安装wget
yum -y install wget
2.安装具体操作
shell> cd /usr/local
shell> mkdir soft #如果没有这个文件夹就创建
shell> cd /usr/local/soft
shell> wget http://download.redis.io/releases/redis-5.0.7.tar.gz#从网上下载包
shell> redis-5.0.7.tar.gz #解压到当前目录下
shell> cd redis-5.0.7
shell> make #安装
shell> mkdir /usr/local/redis #创建redis文件夹
shell> cp redis.conf /usr/local/redis
shell> cd src
shell> cp redis-server /usr/local/redis
shell> cp redis-benchmark /usr/local/redis
shell> cp redis-check-rdb /usr/local/redis
shell> cp redis-sentinel /usr/local/redis
shell> cp redis-cli /usr/local/redis
3.修改启动的配置文件
shell> vi /usr/local/redis/redis.conf #编辑配置文件
shell> :set nu #显示行数
-
在redis.conf第89行,将protected-mode no
-
在redis.conf第71行修改下bind 192.168.42.128 (ip为你linux的ip);
-
在redis.conf第507行,加上 requirepass “1234567890”, 登录密码
4.启动服务端
shell> cd /usr/local/redis
shell> ./redis-server redis.conf &
5.连接redis
shell> cd /usr/local/redis
shell> ./redis-cli -h 192.168.42.128 -p 6379 -a 1234567890
./redis-cli -h 192.168.42.128 -p 6379 -a 1234567890
![在这里插入图片描述](https://img-blog.csdnimg.cn/8c19cc98119546a8985625228684bb88.png#pic_center)