#!/bin/bash
#zhouyihua
#v0.2
#2021-08-12
# set work dir
cd /opt
echo nameserver 8.8.8.8 > /etc/resolv.conf
rpm -qa | grep wget
if [ $? != "0" ] ; then
yum -y install wget
else
echo "wget already exist"
fi
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
tar -zxvf /opt/redis-5.0.0.tar.gz
cd /opt/redis-5.0.0
rpm -qa | grep make
if [ $? != "0" ]; then
yum -y install gcc automake autoconf libtool make
else
echo "make already exist"
fi
make
sed -i 's/daemonize no/daemonize yes/' /opt/redis-5.0.0/redis.conf
sed -i 's/# requirepass foobared/requirepass 123456/' /opt/redis-5.0.0/redis.conf
/opt/redis-5.0.0/src/redis-server /opt/redis-5.0.0//redis.conf &
echo "redis install & config success!!!"
rm -rf /opt/redis-5.0.0.tar.gz
exit