Centos8安装Redis

1.安装

1  wget https://download.redis.io/releases/redis-6.0.9.tar.gz
2  tar xzf redis-6.0.9.tar.gz
3  cd redis-6.0.9
4  make
5  make install PREFIX=/usr/local/redis

2.管理配置文件

1  mkdir /usr/local/redis/conf
2  cp redis.conf /usr/local/redis/conf/

编辑redis.conf文件

cd /usr/local/redis/conf
1 //后台运行
2 daemonize yes
3 //注释掉
4 bind 127.0.0.1  
5 //关闭受保护模式
6 protected-mode no
7 //设置密码
8 requirepass qwer1234.0

3.开机启动文件

vi /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target

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

[Install]
WantedBy=multi-user.target
systemctl enable redis.service

4.启动

systemctl start redis.service

 5.测试

netstat -lntp|grep 6379

posted @ 2020-12-28 13:49  b̶i̶n̶g̶.̶  阅读(102)  评论(0编辑  收藏  举报