CentOS7 安装Redis7.0

这篇博客详细指导了在 CentOS 7 上从头开始安装 Redis 7.0.0,包括wget和gcc的前置条件,下载、解压、编译、安装过程,以及启动服务端和客户端的步骤。重点介绍了如何在src目录下启动服务并进行基本操作测试。
摘要由CSDN通过智能技术生成

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> 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值