CentOS7安装Redis

CentOS7安装Redis

安装

##安装
yum install -y wget
cd /usr/local/
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -zxvf redis-5.0.3.tar.gz
cd redis-5.0.3
yum install -y gcc*
make && make install


防火墙

##使用
## 关闭防火墙
systemctl stop firewalld
##开机不启动
systemctl disable firewalld
##查看状态
systemctl status firewalld
## 启动
systemctl start firewalld

启动服务

##进入redis src文件
cd src/
find . -name redis-server
## 启动redis
cd ..
redis-server redis.conf 

## 查看状态
ps -ef |grep redis

修改配置

vim redis.conf 

永久关闭SELinux

##查看
sestatus
## 修改配置文件
vim /etc/selinux/config
  
SELINUX=disabled
:wq

reboot

创建redis服务并实现开机自启动

##修改redis配置文件
vim redis.conf

daemonize yes

## 
cd /usr/lib/systemd/system
vim redis.service

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis-5.0.3/src/redis-server /usr/local/redis-5.0.3/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target

## 保存退出
##
systemctl daemon-reload

systemctl start redis.service

systemctl status redis

## 开机自启动
systemctl enable redis


你可能感兴趣的:(其他,redis)