您的位置:首页 > 数据库 > Redis

Redis自动化安装脚本

2015-12-24 15:08 579 查看
redis自动安装脚本:
安装目录:/usr/local/redis
二进制文件:/usr/local/bin
配置文件:/usr/local/redis/etc,配置文件自己根据自身的业务去配置,这里只是一个空文件.
日志文件:/usr/local/redis/logs
数据文件:/usr/local/redis/dump

#!/bin/bash
Soft_dir="/home/tools"
Download_URL="http://download.redis.io/releases/redis-2.8.19.tar.gz"
Redis_Version="2.8.19"
root_or_not(){
if [ `id -u` != 0 ] ; then
echo -e "\e[1;44m  <====You are not root,Please login in root!====> \e[0m"
exit 1
fi
}
install_or_not(){
read -p "Install redis, Input Y ; Do not install  redis,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-${Redis_Version}.tar.gz
check_result  $?
cd  redis-${Redis_Version}
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 <======Please  Configure redis.conf =======> \e[0m"
}
root_or_not
install_or_not
~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  redis install