编译安装redis

获取redis源码安装包

[root@mycat ~]#  wget http://download.redis.io/releases/redis-6.2.5.tar.gz
--2021-09-05 06:19:57--  http://download.redis.io/releases/redis-6.2.5.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: 2465302 (2.4M) [application/octet-stream]
Saving to: ‘redis-6.2.5.tar.gz’

100%[===========================================================================================================================>] 2,465,302    696KB/s   in 3.5s

2021-09-05 06:20:01 (696 KB/s) - ‘redis-6.2.5.tar.gz’ saved [2465302/2465302]

2.安装相关依赖包

[root@mycat ~]# yum install gcc jemalloc-devel -y

3.解压源码包

[root@mycat ~]# tar -xvf redis-6.2.5.tar.gz

4.编译安装

[root@mycat ~]# cd redis-6.2.5
[root@mycat redis-6.2.5]# ls
00-RELEASENOTES  CONDUCT       COPYING  INSTALL   MANIFESTO  redis.conf  runtest-cluster    runtest-sentinel  src    TLS.md
BUGS             CONTRIBUTING  deps     Makefile  README.md  runtest     runtest-moduleapi  sentinel.conf     tests  utils
[root@mycat redis-6.2.5]# make PREFIX=/apps/redis install

[root@mycat redis-6.2.5]# tree /apps/redis/
/apps/redis/
└── bin
    ├── redis-benchmark
    ├── redis-check-aof -> redis-server
    ├── redis-check-rdb -> redis-server
    ├── redis-cli
    ├── redis-sentinel -> redis-server
    └── redis-server

1 directory, 6 files

5.配置环境变量与准备相关目录和配置文件

[root@mycat redis-6.2.5]# echo 'PATH=/apps/redis/bin:$PATH' >/etc/profile.d/redis.sh
[root@mycat redis-6.2.5]# . /etc/profile.d/redis.sh
[root@mycat redis-6.2.5]# mkdir /apps/redis/{etc,log,data,run}
[root@mycat redis-6.2.5]# cp redis.conf /apps/redis/etc/

6.前台启动redis

[root@mycat ~]# redis-server /apps/redis/etc/redis.conf
1450:C 05 Sep 2021 06:30:45.283 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1450:C 05 Sep 2021 06:30:45.283 # Redis version=6.2.5, bits=64, commit=00000000, modified=0, pid=1450, just started
1450:C 05 Sep 2021 06:30:45.283 # Configuration loaded
1450:M 05 Sep 2021 06:30:45.284 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1450:M 05 Sep 2021 06:30:45.284 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.2.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1450
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1450:M 05 Sep 2021 06:30:45.285 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1450:M 05 Sep 2021 06:30:45.285 # Server initialized
1450:M 05 Sep 2021 06:30:45.285 # 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.
1450:M 05 Sep 2021 06:30:45.286 * Loading RDB produced by version 6.2.5
1450:M 05 Sep 2021 06:30:45.286 * RDB age 32 seconds
1450:M 05 Sep 2021 06:30:45.286 * RDB memory usage when created 0.77 Mb
1450:M 05 Sep 2021 06:30:45.286 * DB loaded from disk: 0.001 seconds
1450:M 05 Sep 2021 06:30:45.286 * Ready to accept connections

7.查看端口是否正常启动

[root@mycat ~]# ss -ntl
State       Recv-Q Send-Q                                     Local Address:Port                                                    Peer Address:Port
LISTEN      0      128                                            127.0.0.1:6379                                                               *:*
LISTEN      0      128                                                    *:22                                                                 *:*
LISTEN      0      100                                            127.0.0.1:25                                                                 *:*
LISTEN      0      128                                                [::1]:6379                                                            [::]:*
LISTEN      0      128                                                 [::]:22                                                              [::]:*
LISTEN      0      100                                                [::1]:25                                                              [::]:*
[root@mycat ~]#

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值