cd /usr/local/src //进入src目录
wget http://download.redis.io/releases/redis-4.0.1.tar.gz //下载到src
tar zxvf redis-4.0.1.tar.gz //解压
cd redis-4.0.1
make && make install //编译安装
cd src
mkdir /usr/local/redis
cp redis-cli redis-server /usr/local/redis
cp ../redis.conf /usr/local/redis
cd /usr/local/redis
vi ./redis.conf
//把参数daemonize no 改为 daemonize yes //设置为后台启动
./redis-server redis.conf //启动
//设置开机启动
find / -name redis_init_script //查找redis启动脚本,redis自带
cp /usr/local/src/redis-4.0.1/utils/redis_init_script /etc/init.d/redis //复制启动脚本到/etc/init.d/redis文件中
vi /etc/init.d/redis
//在/etc/init.d/redis文件的头部添加下面两行注释代码,也就是在文件中#!/bin/sh的下方添加
// #chkconfig: 2345 10 90
// #description: Start and Stop redis
//修改下面三个参数
//EXEC=/usr/local/bin/redis-server
//REDIS_CLI=/usr/local/bin/redis-cli
//CONF="/usr/local/reids/redis.conf"
//打开redis命令:service redis start
//关闭redis命令:service redis stop
//设为开机启动:chkconfig redis on
//设为开机关闭:chkconfig redis off
---------------------
作者:dreamweaver9_0
来源:CSDN
原文:https://blog.csdn.net/Dreamweaver9_0/article/details/76921305
完成如上配置后远程依然不能访问
1、只监听了本地
vim /usr/local/reids/redis.conf
将 bind 127.0.0.1 注释掉
2、DENIED Redis is running in protected mode because protected mode is enabled...
再将保护模式由yes变为no
protected mode:
no