CentOS 7.5安装Redis 4.0.11

1.服务器版本

# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.5.1804 (Core)
Release:	7.5.1804
Codename:	Core

2.下载redis

# cd /home/install-files/
# wget http://download.redis.io/releases/redis-4.0.11.tar.gz

3.安装redis和依赖

# yum -y install gcc
# tar zxvf redis-4.0.11.tar.gz
# cd redis-4.0.11
# make MALLOC=libc
# cd src && make install
# ./redis-server
可直接启动测试

4.redis配置

# cp redis.conf /etc/
配置请参照:配置说明

5.创建目录和用户和更改拥有者

# mkdir -p /redis/data
# mkdir -p /redis/pid
# mkdir -p /redis/log
# groupadd redis
# useradd redis -g redis -d /redis/ -s /sbin/nologin
# chown -R redis.redis /redis/
# chown -R redis.redis /etc/redis.conf

6.安装启动

# cd /usr/local/bin/
# /usr/local/bin/redis-server /etc/redis.conf
# ps -ef |grep redis
root       741     1  0 17:23 ?        00:00:17 /usr/local/bin/redis-server *:6379
# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      741/redis-server *:
tcp6       0      0 :::6379                 :::*                    LISTEN      741/redis-server *:

7.测试redis

# redis-cli -h 192.168.0.168 -a 'T@S99ss:)'
Warning: Using a password with '-a' option on the command line interface may not be safe.
192.168.0.168:6379> set tony 12345
OK
192.168.0.168:6379> get tony
"12345"
192.168.0.168:6379> del tony
(integer) 1
192.168.0.168:6379>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值