// 进入到压缩包存放的位置
[root@iZbp175cip8bokvmkgg7zjZ /]# cd /opt/// 解压文件
[root@iZbp175cip8bokvmkgg7zjZ opt]# tar -zxvf redis-6.2.6.tar.gz// 进行文件编译
[root@iZbp175cip8bokvmkgg7zjZ opt]# cd redis-6.2.6/[root@iZbp175cip8bokvmkgg7zjZ redis-6.2.6]# make// 如果出现编译异常,先确认环境有没有装好
[root@iZbp175cip8bokvmkgg7zjZ redis-6.2.6]# gcc --version// 不行就清理掉重新编译
[root@iZbp175cip8bokvmkgg7zjZ redis-6.2.6]# make distclean// 进行安装
[root@iZbp175cip8bokvmkgg7zjZ redis-6.2.6]# make install
cd src && make install
make[1]: Entering directory '/opt/redis-6.2.6/src'
CC Makefile.dep
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
make[1]: Leaving directory '/opt/redis-6.2.6/src'
// 复制配置文件到etc文件夹下,以便管理(当然不复制也可以)
[root@iZbp175cip8bokvmkgg7zjZ /]# cd /opt/redis-6.2.6/[root@iZbp175cip8bokvmkgg7zjZ redis-6.2.6]# cp ./redis.conf /etc/redis.conf// 修改配置文件(redis.conf),使得其支持后台启动
[root@iZbp175cip8bokvmkgg7zjZ etc]# vi /etc/redis.conf// 修改前
################################# GENERAL ###################################### By default Redis does not run as a daemon. Use 'yes' if you need it.# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.# When Redis is supervised by upstart or systemd, this parameter has no impact.
daemonize no
// 修改后
################################# GENERAL ###################################### By default Redis does not run as a daemon. Use 'yes' if you need it.# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.# When Redis is supervised by upstart or systemd, this parameter has no impact.
daemonize yes
// 启动
[root@iZbp175cip8bokvmkgg7zjZ etc]# cd /usr/local/bin/[root@iZbp175cip8bokvmkgg7zjZ bin]# ./redis-server /etc/redis.conf