Centos7离线安装redis

Centos7离线安装redis
参考文档:https://www.cnblogs.com/yy3b2007com/p/10513752.html

1、下载redis安装包 在/opt/redis/ 如没有这个目录需要手动建立
[root@localhost redis]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz
[root@localhost redis]# tar -xf redis-4.0.11.tar.gz
[root@localhost redis]# cd redis-4.0.11/

2、查看是否安装了gcc 如没安装 需要安装gcc
[root@localhost redis]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright © 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

3、编译安装redis
[root@localhost redis]# make MALLOC=libc
cd src && make all
。。。。。。。。
CC rax.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof
Hint: It’s a good idea to run ‘make test’ 😉
make[1]: Leaving directory `/opt/redis/redis-4.0.11/src’

[root@localhost redis]# cd src && make install
CC Makefile.dep

Hint: It’s a good idea to run ‘make test’ 😉
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install

4、启动redis
[root@CDH-143 src]# ./redis-server
24496:C 11 Mar 13:49:56.298 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
24496:C 11 Mar 13:49:56.298 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=24496, just started
24496:C 11 Mar 13:49:56.298 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf

5、设置redis开机启动,并添加到系统服务
[root@CDH-143 src]# mkdir /etc/redis
[root@CDH-143 src]# cd …
[root@CDH-143 redis-4.0.11]# cp redis.conf /etc/redis/6379.conf
修改redis启动为后台启动:
[root@CDH-143 redis-4.0.11]# vi /etc/redis/6379.conf
在这里插入图片描述
将启动文件拷贝到init.d中
[root@CDH-143 redis-4.0.11]# cp utils/redis_init_script /etc/init.d/redisd
修改启动脚本参数
[root@CDH-143 redis-4.0.11]# vi /etc/init.d/redisd

添加

# chkconfig: 2345 10 90
# description: Start and Stop redisd
修改:

EXEC=/opt/redis/redis-4.0.11/src/redis-server
CLIEXEC=/opt/redis/redis-4.0.11/src/redis-cli
PIDFILE=/opt/redis/redis-4.0.11/redis_${REDISPORT}.pid 

在这里插入图片描述

6、增加脚本权限
[root@CDH-143 redis-4.0.11]# chmod +x /etc/init.d/redisd

7、增加系统服务
[root@CDH-143 redis-4.0.11]# chkconfig --add redisd
[root@CDH-143 redis-4.0.11]# chkconfig --list redisd

8、启动redis服务测试
[root@CDH-143 redis-4.0.11]# service redisd start
Starting Redis server…
9084:C 11 Mar 15:23:36.469 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9084:C 11 Mar 15:23:36.469 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=9084, just started
9084:C 11 Mar 15:23:36.469 # Configuration loaded
[root@CDH-143 redis-4.0.11]#
[root@CDH-143 redis-4.0.11]# ps -aux | grep redis
root 3575 0.0 0.0 38260 2140 ? Ssl 15:09 0:00 /opt/redis/redis-4.0.11/src/redis-server 127.0.0.1:6379
root 8870 0.0 0.0 112660 956 pts/2 S+ 15:22 0:00 grep --color=auto redis

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值