redis自动安装脚本

cd /root
wget XXXXXXXX/redis-3.2.5.tar.gz


if [ -f /root/redis-3.2.5.tar.gz ];then

tar zxvf redis-3.2.5.tar.gz -C /opt
mv /opt/redis-3.2.5 /usr/local/redis

cd /usr/local/redis
make
make install
else
echo "文件不存在!"
exit;
fi

sed -i "s/bind 127.0.0.1/bind 0.0.0.0/g" /usr/local/redis/redis.conf
sed -i 's/appendonly no/appendonly yes/g' /usr/local/redis/redis.conf
sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/redis.conf
sed -i 's/# requirepass foobared/requirepass 1234@abcd/g' /usr/local/redis/redis.conf
mkdir -p /etc/redis
ln -s /usr/local/redis/redis.conf /etc/redis/6379.conf #(在默认的配置文件路劲中放置配置文件)
ln -s /usr/local/redis/utils/redis_init_script /etc/init.d/redisd #(将初始化文件配置到系统自启动的文件夹内,redisd为服务名,可自行修改)
service redisd start #(开启redis服务,服务名为:redisd)
#redis-cli
netstat -ntpl|grep redis
echo "Redis 部署完成!"

posted @ 2019-01-29 13:58  Rayja-gyeong  阅读(85)  评论(0)    收藏  举报