Redis Automatic Installation script: Installation directory:/usr/local/redis binaries:/usr/local/bin config file:/usr/local/redis/etc, config file itself according to its own business to configure, here is just an empty file. log file :/usr/local/redis/logs data file:/usr/local/redis/dump#!/bin/bashsoft_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 1fi}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 - ycheck_result $?wget $Download _urlcheck_result $?tar xf redis-${redis_ Version}.tar.gzcheck_result $?cd redis-${redis_version}check_result $? makecheck_result $?make installcheck_result $?mkdir -p /usr/ Local/redis/{etc,dump,logs}check_result $?touch /usr/local/redis/etc/redis.confcheck_result $?echo -e "\e[1;44m <======please configure redis.conf ==== ===> \e[0m "}root_or_notinstall_or_not~
This article from the "Do not ask for the best, only better" blog, please be sure to keep this source http://yujianglei.blog.51cto.com/7215578/1727884
Redis Automated Installation Scripts