下载redis的linux版本压缩包
redis-7.0.11.tar.gz
安装gcc编译环境
yum install -y gcc-c++
解压redis压缩包,并进入
[root@iZ2ze6psmhg970tbycgrbpZ ~]# tar -zxvf redis-7.0.11.tar.gz
[root@iZ2ze6psmhg970tbycgrbpZ ~]# cd redis-7.0.11/
查看redis源码文件
[root@iZ2ze6psmhg970tbycgrbpZ redis-7.0.11]# ll
total 268
-rw-rw-r-- 1 root root 43972 Apr 17 2023 00-RELEASENOTES
-rw-rw-r-- 1 root root 51 Apr 17 2023 BUGS
-rw-rw-r-- 1 root root 5027 Apr 17 2023 CODE_OF_CONDUCT.md
-rw-rw-r-- 1 root root 2634 Apr 17 2023 CONTRIBUTING.md
-rw-rw-r-- 1 root root 1487 Apr 17 2023 COPYING
drwxrwxr-x 7 root root 4096 Apr 17 2023 deps
-rw-rw-r-- 1 root root 11 Apr 17 2023 INSTALL
-rw-rw-r-- 1 root root 151 Apr 17 2023 Makefile
-rw-rw-r-- 1 root root 6888 Apr 17 2023 MANIFESTO
-rw-rw-r-- 1 root root 22441 Apr 17 2023 README.md
-rw-rw-r-- 1 root root 106545 Apr 17 2023 redis.conf
-rwxrwxr-x 1 root root 279 Apr 17 2023 runtest
-rwxrwxr-x 1 root root 283 Apr 17 2023 runtest-cluster
-rwxrwxr-x 1 root root 1613 Apr 17 2023 runtest-moduleapi
-rwxrwxr-x 1 root root 285 Apr 17 2023 runtest-sentinel
-rw-rw-r-- 1 root root 1695 Apr 17 2023 SECURITY.md
-rw-rw-r-- 1 root root 14005 Apr 17 2023 sentinel.conf
drwxrwxr-x 4 root root 4096 Apr 17 2023 src
drwxrwxr-x 11 root root 4096 Apr 17 2023 tests
-rw-rw-r-- 1 root root 3055 Apr 17 2023 TLS.md
drwxrwxr-x 8 root root 4096 Apr 17 2023 utils
先进行编译
make
创建redis安装的目标文件夹,并安装到目标文件夹
mkdir /opt/redis -p
make install PREFIX=/opt/redis/
将源码包的配置文件 拷贝至安装文件夹/bin目录下
进入redis/bin 目录并查看
[root@iZ2ze6psmhg970tbycgrbpZ redis-7.0.11]# cp redis.conf /opt/redis/bin/
[root@iZ2ze6psmhg970tbycgrbpZ redis-7.0.11]# cd /opt/redis/bin/
[root@iZ2ze6psmhg970tbycgrbpZ bin]# ll
total 28888
-rwxr-xr-x 1 root root 7155368 Jan 5 22:34 redis-benchmark
lrwxrwxrwx 1 root root 12 Jan 5 22:34 redis-check-aof -> redis-server
lrwxrwxrwx 1 root root 12 Jan 5 22:34 redis-check-rdb -> redis-server
-rwxr-xr-x 1 root root 7454952 Jan 5 22:34 redis-cli
-rw-r--r-- 1 root root 106545 Jan 5 22:36 redis.conf
lrwxrwxrwx 1 root root 12 Jan 5 22:34 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 14854336 Jan 5 22:34 redis-server
根据配置文件启动redis
[root@iZ2ze6psmhg970tbycgrbpZ bin]# ./redis-server redis.conf
[root@iZ2ze6psmhg970tbycgrbpZ bin]# ./redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>