shell-Redis一键部署脚本

Redis一键部署

#!/bin/bash

systemctl stop firewalld
setenforce 0
echo -e "\033[36m安装环境已初始化!\033[0m"
[ -e /etc/redis/6379.conf ]
if [ $? -eq 0 ]
then
echo -e "\033[36m已安装Redis,退出安装!\033[0m"
exit
else
echo -e "\033[36m开始安装,请等待\033[0m"
fi

yum install -y gcc gcc-c++ make &>/dev/null
echo -e "\033[36m依赖包已安装完毕!\033[0m"

cd /opt
wget https://download.redis.io/releases/redis-5.0.7.tar.gz &>/dev/null
[ -e redis-5.0.7.tar.gz ]
if [ $? -eq 0 ]
then 
echo -e "\033[36m下载成功,等待解压\033[0m"
else
echo -e "\033[36m下载失败,检查网络等配置\033[0m"
exit
fi
tar zxf redis-5.0.7.tar.gz
cd redis-5.0.7/
make &>/dev/null
make PREFIX=/usr/local/redis install 
echo -e "\033[36m编译安装完成\033[0m"

cd utils/
./install_server.sh <<EOF




/usr/local/redis/bin/redis-server
EOF

ln -s /usr/local/redis/bin/* /usr/local/bin/
num=`ss -natp|grep 6379|wc -l`
if [ $num -ge 1 ]
then
echo -e "\033[36mredis 已启动\033[0m" 
else
echo -e "\033[36m启动失败,检查配置\033[0m"
fi

redis-cli
上一篇:VNC远程控制客户端和服务端下载(VNC可跨平台)


下一篇:树莓派学习笔记1-系统安装