您好,登錄后才能下訂單哦!
vi redis_single_install.sh
#!/bin/bash
# install redis
yum install gcc gcc-c++ -y
mkdir -p /data/usr/src
tar -zxf redis-4.0.11.tar.gz -C /data/usr/src
cd /data/usr/src/redis-4.0.11
make PREFIX=/data/usr/redis-4.0.11 install MALLOC=libc? ??
mkdir /data/usr/redis-4.0.11/{run,conf,logs,data}?
cp /data/usr/src/redis-4.0.11/redis.conf /data/usr/redis-4.0.11/conf/
# config ENV
cat >>/etc/profile <<EOF
REDIS_HOME=/data/usr/redis-4.0.11
export PATH=\$PATH:\$REDIS_HOME/bin
EOF
source /etc/profile
# config redis
IP=`hostname -i | awk '{print $2}'`
sed -i "s/^bind 127.0.0.1/& ${IP}/" /data/usr/redis-4.0.11/conf/redis.conf
sed -i "s/^daemonize no/daemonize yes/" /data/usr/redis-4.0.11/conf/redis.conf
sed -i "s|^pidfile /var/run/redis_6379.pid|pidfile /data/usr/redis-4.0.11/run/redis_6379.pid|" /data/usr/redis-4.0.11/conf/redis.conf
sed -i "s|^logfile.*$|logfile /data/usr/redis-4.0.11/logs/redis.log|" /data/usr/redis-4.0.11/conf/redis.conf
sed -i "s|dir ./|dir /data/usr/redis-4.0.11/data|" /data/usr/redis-4.0.11/conf/redis.conf
sed -i "s/# requirepass foobared/requirepass Redis2019\!/" /data/usr/redis-4.0.11/conf/redis.conf
# config start-shell?
cp /data/usr/src/redis-4.0.11/utils/redis_init_script /etc/rc.d/init.d/redis
sed -i '/END INIT INFO/a# chkconfig: 2345 80 90' /etc/rc.d/init.d/redis
sed -i 's|EXEC=/usr/local/bin/redis-server|EXEC=/data/usr/redis-4.0.11/bin/redis-server|' /etc/rc.d/init.d/redis
sed -i 's|CLIEXEC=/usr/local/bin/redis-cli|CLIEXEC=/data/usr/redis-4.0.11/bin/redis-cli|' /etc/rc.d/init.d/redis
sed -i 's|PIDFILE=/var/run/redis_${REDISPORT}.pid|PIDFILE=/data/usr/redis-4.0.11/run/redis_6379.pid|' /etc/rc.d/init.d/redis
sed -i 's|CONF=\"/etc/redis/${REDISPORT}.conf\"|CONF=\"/data/usr/redis-4.0.11/conf/redis.conf\"|' /etc/rc.d/init.d/redis??
sed -i 's/$REDISPORT/&-a Redis2019!/' /etc/rc.d/init.d/redis
# start server
systemctl enable redis
systemctl start redis
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。