【redis6】cento7 安装redis 6源码编译安装 最新版本安装 linux 命令详解

redis服务端口默认为6379,redis默认包含16个库。可以通过配置文件 redis.conf 修改,安装好后,先启动服务器端,在启动服务端进行连接。

安装环境:
源码编译需要用到gcc,如果尚未安装gcc,使用yum命令直接安装即可。安装gcc命令:yum install make gcc gcc-c++ build-essential openssl openssl-devel unixODBC unixODBC-devel kernel-devel m4 ncurses-devel

#VMware 16 pro虚拟机
[root@tim_liunx ~]#  uname -a
Linux tim_liunx 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@tim_liunx bin]# yum list gcc  #查看服务器是否已安装gcc
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * extras: mirror.lzu.edu.cn
 * updates: mirror.lzu.edu.cn
已安装的软件包
gcc.x86_64                                                                                4.8.5-44.el7   

下载源码,安装命令:

cd /home/software  #压缩包存放目录

wget http://download.redis.io/releases/redis-6.2.7.tar.gz  #下载源码安装包

tar -zxvf redis-6.2.7.tar.gz   #解压缩

cd redis-6.2.7  #进入源码目录

make PREFIX=/usr/local/redis install  #源码编译并安装,编译安装到指定的目录:usr/local/redis中

cp  /home/software/redis-6.2.7/redis.conf /usr/local/redis/bin/  #将配置文件复制到安装目录下,保留配置文件名称为redis.conf

cd /usr/local/redis/bin  #进入安装目录,redis的bin目录

# 不指定配置文件
./redis-server #启动 redis服务 ,也可以指定配置文件  

#指定配置文件启动服务
./redis-server redis.conf

./redis-server 
17332:C 02 Oct 2022 21:55:13.932 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
17332:C 02 Oct 2022 21:55:13.932 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=17332, just started
17332:C 02 Oct 2022 21:55:13.932 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
17332:M 02 Oct 2022 21:55:13.933 * Increased maximum number of open files to 10032 (it was originally set to 1024).
17332:M 02 Oct 2022 21:55:13.933 * monotonic clock: POSIX clock_gettime
17332:M 02 Oct 2022 21:55:13.935 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 17332
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

17332:M 02 Oct 2022 21:55:13.935 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
17332:M 02 Oct 2022 21:55:13.935 # Server initialized
17332:M 02 Oct 2022 21:55:13.935 # 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.
17332:M 02 Oct 2022 21:55:13.935 * Ready to accept connections

启动客户端:

#新建一个终端,启动客户端
[root@tim_liunx bin]# ./redis-cli 
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值