下载redis 源码包
[root@redis soft]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz
安装依赖包
[root@redis soft]#yum -y install gcc jemalloc-devel
编译安装redis
[root@redis soft]# tar xvf redis-4.0.9.tar.gz
[root@redis soft]# cd redis-4.0.9/
[root@redis redis-4.0.9]# make install prefix=/apps/redis
[root@redis redis-4.0.9]# echo ‘PATH=/apps/redis/bin:$PATH‘ > /etc/profile.d/redis.sh
[root@redis redis-4.0.9]# source /etc/profile.d/redis.sh
[root@redis redis-4.0.9]# tree /apps/redis/
/apps/redis/
└── bin
├── redis-benchmark
├── redis-check-aof
├── redis-check-rdb
├── redis-cli
├── redis-sentinel -> redis-server
└── redis-server
1 directory, 6 files
[root@redis redis-4.0.9]# mkdir /apps/redis/{etc,logs,data,run} #创建配置文件、日志、数据等目录
[root@redis redis-4.0.9]# cp redis.conf /apps/redis/etc/ #拷贝配置文件
修改配置文件redis.conf,设置为后台运行
启动redis服务
[root@Quhz redis-4.0.9]# redis-server /apps/redis/etc/redis.conf
10348:C 18 Jul 22:37:33.063 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10348:C 18 Jul 22:37:33.063 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=10348, just started
10348:C 18 Jul 22:37:33.063 # Configuration loaded
[root@Quhz redis-4.0.9]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:6379 *:*
连接测试
[root@redis ~]#redis-cli
127.0.0.1:6379> ping
PONG