1,安装编译环境
yum install -y make zlib zlib-devel openssl openssl-devel gcc-c++ libtool ncurses-devel
2,下载源码包
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
3,解压编译安装
tar xf redis-4.0.9.tar.gz
cd redis-4.0.9
make
4,启动Redis
./src/redis-server
./src/redis-server ../redis.conf //指定配置文件位置启动服务
关闭服务
./src/redis-cli shutdown
5,将服务放到后台运行
vim redis.conf //将daemonize的值改为yes
···
daemonize yes
···
6,验证
[root@web-2 redis-4.0.9]# ./src/redis-cli
127.0.0.1:6379> set name hahahha
OK
127.0.0.1:6379> get name
"hahahha"
127.0.0.1:6379>