根据官方的快速开始安装指南, 官方推荐直接编译源码进行安装. 因为Redis没有很多依赖, 只需要GCC compiler 和 libc 即可. 而如果使用包管理器下载的可能不是最新的.
第一步下载最新的redis-stable
wget http://download.redis.io/redis-stable.tar.gz
结果如下
--2021-07-20 09:33:06-- http://download.redis.io/redis-stable.tar.gz
Resolving download.redis.io (download.redis.io)... 45.60.125.1
Connecting to download.redis.io (download.redis.io)|45.60.125.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2510889 (2.4M) [application/octet-stream]
Saving to: ‘redis-stable.tar.gz’
redis-stable.tar.gz 100%[======================================================================================================================>] 2.39M 4.93MB/s in 0.5s
2021-07-20 09:33:07 (4.93 MB/s) - ‘redis-stable.tar.gz’ saved [2510889/2510889]
解压
tar xvzf redis-stable.tar.gz
编译Redis
cd redis-stable
make
此时出现
Command 'make' not found, but can be installed with:
apt install make
apt install make-guile
因为我是新装的系统, 没有装make, 安装一下
> apt install make
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
make-doc
The following NEW packages will be installed:
make
0 upgraded, 1 newly installed, 0 to remove and 207 not upgraded.
Need to get 154 kB of archives.
After this operation, 381 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 make amd64 4.1-9.1ubuntu1 [154 kB]
Fetched 154 kB in 1s (120 kB/s)
Selecting previously unselected package make.
(Reading database ... 67085 files and directories currently installed.)
Preparing to unpack .../make_4.1-9.1ubuntu1_amd64.deb