1、下载redis
wget http://download.redis.io/releases/redis-4.0.0.tar.gz
make test(报错:yum install tcl)
wget http://download.redis.io/releases/redis-4.0.0.tar.gz
2、编译安装:
# 安装gcc依赖
yum -y install gcc
# tcl依赖
yum install tcl
# redis安装
cd redis-4.0.0/src
makemake test(报错:yum install tcl)
make install
3、转移可执行文件:
mkdir /usr/local/redis
mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-sentinel redis-server /usr/local/redis
mv redis.conf /usr/local/redis
cd /usr/local/redis
./redis-server /usr/local/redis/redis.conf
开启之后我们执行netstat -tunpl | grep 6379命令来查看6379端口使用情况
关闭redis:redis-cli shutdown
4.修改配置文件
# 修改安装目录下的配置文件
cd /usr/local/redis/vim redis.conf
# 注释掉,可以让其他ip访问
bind127.0.0.1
# 改为 protected-mode no(启用公网可以访问)
protected-mode yes
# 改为daemonize yes ,启用后台启动
daemonize no