只需一下,Redis 轻松安装成功 o(* ̄▽ ̄*)ブ

无需自己准备安装包,也不用切换到别的目录下,直接 sh 就可执行,如果版本不对请自习更改下方的版本号

#!/bin/bash

systemctl stop firewalld
systemctl disable firewalld
setenforce 0

yum -y install gcc gcc-c++ make

cd /opt
if [ ! -f " redis-5.0.7.tar.gz" ]; then
wget http://download.redis.io/releases/redis-5.0.7.tar.gz
fi

tar zxvf redis-5.0.7.tar.gz -C /opt/
cd redis-5.0.7/
make 
make PREFIX=/usr/local/redis install

yum -y install tcl expect
cd /opt/redis-5.0.7/utils/
/usr/bin/expect <<EOF
spawn ./install_server.sh
expect "instance" {send "\r"} 
expect "config" {send "\r"}
expect "log" {send "\r"}
expect "data" {send "\r"}
expect "executable" {send "/usr/local/redis/bin/redis-server\r"}
expect "abort" {send "\r"}
expect eof
EOF

ln -s /usr/local/redis/bin/* /usr/local/bin/

sed -i '/bind 127.0.0.1/c bind 0.0.0.0' /etc/redis/6379.conf
sed -i 's/appendonly no/appendonly yes/' /etc/redis/6379.conf

/etc/init.d/redis_6379 restart
/etc/init.d/redis_6379 status

netstat -natp | grep "redis"

pgrep "redis" &> /dev/null
if [ $? -eq 0 ];then
        echo -e "\033[46;37m Redis 服务运行正常 \033[0m"
else
        echo -e "\033[46;37m Redis 服务运行异常,请检查 \033[0m"
fi
sleep 2
echo ' '
echo -e "\033[46;37m Redis 未设置密码,执行 redis-cli 命令登录 \033[0m"
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

头发莫的了呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值