centos安装redis脚本

写的比较粗糙,欢迎交流,有问题直接找我

 

#!/bin/bash
Soft_dir="/home/***"
Download_URL="http://download.redis.io/releases/redis-2.8.19.tar.gz"
Redis_Version="3.0.2"
root_or_not(){
if [ `id -u` != 0 ] ; then
    echo -e "\e[1;44m  <====no root, gun!====> \e[0m"
    exit 1
fi
}
install_or_not(){
    read -p "zhuang, Input Y ; bu zhuang,Input N:" INSTALL_OR_NOT
    case $INSTALL_OR_NOT in
    Y|y)
        install_redis
    ;;
    N|n)
        echo -e "\e[0;44m <====Stop  install  Redis====> \e[0m"
        exit 1
    ;;
    *)
        echo -e "\e[1;44m  Only Input  Y or N  \e[0m"
        install_or_not
    ;;
    esac
}
check_result(){
    if [ $1 != 0 ];then
        echo -e "\e[1,44m  <==== Error,Exit install redis ====> \e[0m"
        exit 1
    fi
}
install_redis(){
[ ! -d ${Soft_dir} ] && mkdir ${Soft_dir}
cd ${Soft_dir}
check_result  $?
yum  install  wget - y
check_result  $?
#wget  $Download_URL
check_result  $?
tar xf redis-stable.tar.gz
check_result  $?
cd  redis-stable
check_result  $?
make
check_result  $?
make  install
check_result  $?
mkdir  -p /usr/local/redis/{etc,dump,logs}
check_result  $?
touch /usr/local/redis/etc/redis.conf
check_result  $?
echo -e "\e[1;44m <======cp conf /usr/local/redis/etc =======> \e[0m"
}
root_or_not
install_or_not
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值