Centos7下安装Redis教程

一、安装Redis

1.下载redis安装包

cd /opt/software
# 下载安装包
wget http://download.redis.io/releases/redis-4.0.6.tar.gz

2.解压缩安装包

tar -zxvf redis-4.0.6.tar.gz

3.安装gcc依赖

yum install gcc

4.编译安装

cd redis-4.0.6
make
make install

5.查看redis版本

redis-server -v

二、启动redis三种方式

1.直接启动

redis-server

2.后台进程启动

# 拷贝redis.conf配置到/etc/redis
mkdir /etc/redis
cp redis.conf /etc/redis/

编辑配置文件,找到daemonize no改为daemonize yes

################################# GENERAL #####################################

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

指定配置文件启动redis

redis-server /etc/redis/redis.conf

设置密码,修改redis.conf文件

requirepass 你的密码

 

3.开机启动

待续

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值