1,下载redis安装包
wget http://download.redis.io/releases/redis-3.2.9.tar.gz
2,解压Redis安装包
tar -zxvf redis-3.2.9.tar.gz
3,安装
cd redis-3.2.9
make
cd src
make install PREFIX=/usr/local/redis
3,移动配置文件到安装目录下
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
4,配置redis为后台启动并设置连接密码
vi /usr/local/redis/etc/redis.conf
修改下面两个地方
daemonize yes
requirepass 123456
5,开启redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
6,连接Redis客户端
./redis-cli -h 127.0.0.1 -p 6379 -a "123456"
7,关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
8,停止Redis服务
./redis-cli -h 127.0.0.1 -p 6379 -a "123456" shutdown
9,开启外网访问
vi /usr/local/redis/etc/redis.conf
注释掉
#bind 127.0.0.1