centos7安装redis
1.环境配置
[root@localhost ~]# yum install gcc-c++
2.安装redis
[root@localhost redis]# wget https://download.redis.io/releases/redis-6.2.1.tar.gz
[root@localhost redis]# tar -zvxf redis-6.2.1.tar.gz
[root@localhost redis]# cd redis-6.2.1 [root@localhost redis-6.2.1]# ll
#编译源码
[root@localhost redis-6.2.1]# make
#编译成功
#安装编译后的redis代码到指定目录
[root@localhost redis-6.2.1]# make install PREFIX=/usr/local/redis
#安装成功
#查看
[root@localhost local]# cd /usr/local/redis/bin/ [root@localhost bin]# ll
#复制配置文件到当前目录
[root@localhost bin]# cp /root/redis/redis-6.2.1/redis.conf .
#修改配置文件为后台启动
[root@localhost bin]# vim redis.conf
#启动redis
[root@localhost bin]# ./redis-server redis.conf
#测试
[root@localhost bin]# ./redis-cli -h 192.168.5.3 -p 6379
开启远程访问
#再次测试
[root@localhost bin]# ./redis-server redis.conf [root@localhost bin]# ./redis-cli -h 192.168.5.3 -p 6379
3.redis设置密码
[root@localhost bin]# vim redis.conf