解压

1
tar -xvf redis-6.2.7.tar.gz

进入解压目录

1
cd /usr/local/redis/

安装到指定目录

1
make install PREFIX=/usr/local/redis

如编译过程中出现问题: /bin/sh: cc: 未找到命令

1
yum install gcc

如编译过程中出现问题:zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录

1
make MALLOC=libc

添加环境变量

1
2
3
4
5
cat > /etc/profile.d/redis.sh << EOF
PATH=/usr/local/redis/bin:$PATH
EOF
chmod +x /etc/profile.d/redis.sh
source /etc/profile

启动 redis

1
/usr/local/redis/bin/redis-server