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 ~
本文出自 “不求最好,只求更好” 博客,请务必保留此出处http://yujianglei.blog.51cto.com/7215578/1727884
原文地址:http://yujianglei.blog.51cto.com/7215578/1727884