Centos编译安装redis4.0.14

一、下载源码包
必备条件:最小化centos 安装基础命令

 yum install  vim iotop bc gcc gcc-c++ glibc glibc-devel pcre \
pcre-devel openssl  openssl-devel zip unzip zlib-devel  net-tools \
lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel \
bc  systemd-devel bash-completion traceroute -y
[root@node1 src]# wget http://download.redis.io/releases/redis-4.0.14.tar.gz
#解压
[root@node1 src]#tar xvf redis-4.0.14.tar.gz 
#编译安装
[root@node1 redis-4.0.14]#make PREFIX=/apps/redis install
..........
Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
#创建目录
[root@node1 src]#mkdir -pv /apps/redis/{etc,log}
#拷贝配置文件
[root@node1 redis-4.0.14]#cp redis.conf /apps/redis/etc/

二、准备启动文件

[root@node1 redis-4.0.14]#vi /usr/lib/systemd/system/redis.service
  1 [Unit]
  2 Description=Redis persistent key-value database
  3 After=network.target
  4 After=network-online.target
  5 Wants=network-online.target
  6 [Service]
  7 ExecStart=/apps/redis/bin/redis-server /apps/redis/etc/redis.conf --supervised sy    stemd
  8 ExecReload=/bin/kill -s HUP $MAINPID 
  9 ExecStop=/bin/kill -s QUIT $MAINPID
 10 Type=notify
 11 User=redis
 12 Group=redis
 13 RuntimeDirectory=redis
 14 RuntimeDirectoryMode=0755
 15 [Install]
 16 WantedBy=multi-user.target
#配置文件生效
[root@node1 redis-4.0.14]#systemctl daemon-reload 
#创建redis用户
[root@node1 redis-4.0.14]#useradd -r redis -s /sbin/nologin
#修改目录权限
[root@node1 redis-4.0.14]# chown -R redis.redis /apps/redis

#启动service
[root@node1 redis-4.0.14]#systemctl start redis
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN      0      128    127.0.0.1:631                        *:*                  
LISTEN      0      100    127.0.0.1:25                         *:*                  
LISTEN      0      128            *:33657                      *:*                  
LISTEN      0      128    127.0.0.1:6010                       *:*                                  
LISTEN      0      128    127.0.0.1:6379                       *:*  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值