0、前提条件
(1)已安装wget
(2)已安装gcc
若未安装,可参见链接找到对应命令进行安装即可:Centos7 安装完需要安装相关命令_ling1998的博客-CSDN博客
1、下载安装包
下载地址:http://download.redis.io/releases/redis-7.0.0.tar.gz
此版本为当前最新版本,如下载历史版本可访问 Index of /releases/
[root@Tracy local]# wget http://download.redis.io/releases/redis-7.0.0.tar.gz
2、解压
[root@Tracy local]# tar -zxvf redis-7.0.0.tar.gz
3、编译
(1)进行解压目录
[root@Tracy local]# cd redis-7.0.0
(2)编译
提前条件:已安装gcc
yum -y install gcc automake autoconf libtool make
[root@Tracy redis-7.0.0]# make
4、安装
[root@Tracy redis-7.0.0]# make install
cd src && make install
make[1]: Entering directory `/usr/local/redis-7.0.0/src'
CC Makefile.dep
make[1]: Leaving directory `/usr/local/redis-7.0.0/src'
make[1]: Entering directory `/usr/local/redis-7.0.0/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
make[1]: Leaving directory `/usr/local/redis-7.0.0/src'
发现安装的服务端、客户端脚本放到了src目录下
5、启动服务端
(1)进入src目录
[root@Tracy redis-7.0.0]# cd src
(2)启动服务端
[root@Tracy src]# ./redis-server
4455:C 16 May 2022 12:05:16.459 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4455:C 16 May 2022 12:05:16.459 # Redis version=7.0.0, bits=64, commit=00000000, modified=0, pid=4455, just started
4455:C 16 May 2022 12:05:16.459 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
4455:M 16 May 2022 12:05:16.459 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.0.0 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 4455
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
4455:M 16 May 2022 12:05:16.460 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4455:M 16 May 2022 12:05:16.460 # Server initialized
4455:M 16 May 2022 12:05:16.460 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
4455:M 16 May 2022 12:05:16.461 * The AOF directory appendonlydir doesn't exist
4455:M 16 May 2022 12:05:16.461 * Loading RDB produced by version 7.0.0
4455:M 16 May 2022 12:05:16.461 * RDB age 202 seconds
4455:M 16 May 2022 12:05:16.461 * RDB memory usage when created 0.82 Mb
4455:M 16 May 2022 12:05:16.461 * Done loading RDB, keys loaded: 0, keys expired: 0.
4455:M 16 May 2022 12:05:16.461 * DB loaded from disk: 0.000 seconds
4455:M 16 May 2022 12:05:16.461 * Ready to accept connections
6、启动客户端
(1)再打开一个终端,进入src目录中
[root@Tracy ~]# cd /usr/local/redis-7.0.0/src
(2)启动客户端
[root@Tracy src]# ./redis-cli
127.0.0.1:6379>
(3)测试
127.0.0.1:6379> set name tracy
OK
127.0.0.1:6379> get name
"tracy"
127.0.0.1:6379>