1.下载
[root@bogon redis-6.2.5]# cd /usr/local [root@bogon local]# wget http://download.redis.io/releases/redis-6.2.5.tar.gz
2.解压:
[root@bogon local]# tar -zxvf redis-6.2.5.tar.gz
3.编译、安装:
[root@bogon local]# cd /usr/local/redis-6.2.5 [root@bogon redis-6.2.5]# make [root@bogon redis-6.2.5]# make install
4.拷贝配置文件,方便以后使用
[root@localhost redis-6.2.5]# mkdir /usr/local/redis [root@localhost redis-6.2.5]# mkdir /usr/local/redis/etc [root@localhost redis-6.2.5]]# cp redis.conf /usr/local/redis/etc/
5.修改配置:
[root@bogon local]# cd /usr/local/redis/etc/ [root@bogon redis-6.2.5]# vim redis.conf daemonize yes #表示后台运行 logfile /usr/local/redis/log #日志文件,目录必须存在
6.服务端启动,指定配置文件redis.conf启动
[root@bogon redis]# redis-server /usr/local/redis/etc/redis.conf
7.客户端启动:
[root@bogon redis]# redis-cli 127.0.0.1:6379>
8.验证
127.0.0.1:6379> set age 26 OK
127.0.0.1:6379> get age 26
"26"
参考:https://www.cnblogs.com/expiator/p/9915774.html