0
点赞
收藏
分享

微信扫一扫

centos----安装redis

南陵王梁枫 2022-05-02 阅读 60

文章目录

安装redis

安装,启动

# 安装gcc编译器
yum install -y gcc
# 下载redis
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
# 解压
tar -zxvf redis-5.0.3.tar.gz
# 进入目录,编译
make
# 安装, 默认安装在/usr/local/bin
make install 

# 前台启动
redis-server

#后台启动
cp /home/laufing/redis-5.0.3/redis.conf /usr/local/bin

vim /usr/local/bin/redis.conf
# 将daemonize 改为yes
redis-server /usr/local/bin/redis.conf
redis-cli  # 客户端连接

开机启动

[root@localhost]# vi /etc/systemd/system/redis.service # 创建文件

复制代码
[Unit]
Description=redis-server
After=network.target

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

[Install]
WantedBy=multi-user.target

注意:ExecStart配置成自己的路径 


设置开机启动
[root@localhost]# systemctl daemon-reload
[root@localhost]# systemctl start redis.service
[root@localhost]# systemctl enable redis.service

ok

举报

相关推荐

0 条评论