Created
August 29, 2018 12:14
-
-
Save blanklin030/e8436d269e1a912a919fa631123e20cb to your computer and use it in GitHub Desktop.
自动安装redis server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "=========install redis begin========" | |
if [ ! -d redis-3.0.0 ];then | |
wget http://download.redis.io/releases/redis-3.0.0.tar.gz | |
tar xzf redis-3.0.0.tar.gz | |
sleep 3 | |
fi | |
cd redis-3.0.0 | |
make | |
if [ ! -d /usr/local/redis ];then | |
mkdir -p /usr/local/redis | |
fi | |
make install PREFIX=/usr/local/redis | |
cp redis.conf /usr/local/redis/ | |
cd /usr/local/redis | |
if [ ! -d /usr/local/redis/data ];then | |
mkdir -p /usr/local/redis/data | |
fi | |
if [ ! -f /usr/local/redis/redis.log ];then | |
touch /usr/local/redis/redis.log | |
fi | |
sed -i 's/# requirepass foobared/requirepass uy123nil890/g' redis.conf | |
sed -i 's/daemonize no/daemonize yes/g' redis.conf | |
sed -i 's#logfile ""#logfile "/usr/local/redis/redis.log"#g' redis.conf | |
sed -i 's#dir ./#dir "/usr/local/redis/data"#g' redis.conf | |
./bin/redis-server redis.conf | |
num=`ps aux | grep redis | grep -v grep | wc -l` | |
if [ $num -gt 0 ];then | |
echo "redis启动成功。。。" | |
exit 1 | |
fi | |
echo "redis 启动失败。。。" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment