2018-02-22 09:48:39 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-05-07 11:08:13 +08:00
|
|
|
cat << EOF
|
2019-05-07 12:07:59 +08:00
|
|
|
|
2018-02-24 14:16:40 +08:00
|
|
|
###################################################################################
|
|
|
|
# 安装 Redis 脚本
|
|
|
|
# Author: Zhang Peng
|
|
|
|
###################################################################################
|
2019-05-07 12:07:59 +08:00
|
|
|
|
2019-05-07 11:08:13 +08:00
|
|
|
EOF
|
2018-02-22 09:48:39 +08:00
|
|
|
|
2019-05-07 11:08:13 +08:00
|
|
|
version=5.0.4
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
version=$1
|
|
|
|
fi
|
2018-02-22 09:48:39 +08:00
|
|
|
|
2018-09-29 10:16:24 +08:00
|
|
|
root=/opt/redis
|
2019-05-07 11:08:13 +08:00
|
|
|
if [[ -n $2 ]]; then
|
|
|
|
root=$2
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n>>>>>>>>> install libs"
|
|
|
|
yum install -y zlib zlib-devel gcc-c++ libtool openssl openssl-devel tcl
|
|
|
|
|
|
|
|
echo -e "\n>>>>>>>>> download redis"
|
2018-02-24 14:16:40 +08:00
|
|
|
mkdir -p ${root}
|
|
|
|
wget -O ${root}/redis-${version}.tar.gz http://download.redis.io/releases/redis-${version}.tar.gz
|
|
|
|
|
2019-05-07 11:08:13 +08:00
|
|
|
echo -e "\n>>>>>>>>> install redis"
|
|
|
|
tar zxvf ${root}/redis-${version}.tar.gz -C ${root}
|
|
|
|
cd ${root}/redis-${version}
|
|
|
|
make & make install
|
|
|
|
cd -
|