1.新建redis文件夹
mkdir /home/redis
2.进入redis目录
cd /home/redis
3.下载 redis-5.0.8
wget http://download.redis.io/rele...
4.解压redis
tar zxvf redis-5.0.8.tar.gz
5.进入 redis-5.0.8
cd /home/reids/redis-5.0.8/src
6.编译(编译前确定根据装置了gcc,如果没有装置则yum install gcc)
make
7.配置redis
8.设置redis为开机启动
新建开机启动脚本
vi /etc/init.d/redis
输出开机脚本:
#chkconfig: 2345 10 90# description: Start and Stop redis# Simple Redis init.d script conceived to work on Linux systems# as it does use of the /proc filesystem.REDISPORT=6379EXEC=/home/redis/redis-5.0.8/src/redis-serverCLIEXEC=/home/redis/redis-5.0.8/src/redis-cliPIDFILE=/var/lib/redis/redis_${REDISPORT}.pid#CONF="/etc/redis/${REDISPORT}.conf"CONF="/home/redis/redis-5.0.8/redis.conf"case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF & fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; restart) "$0" stop sleep 3 "$0" start ;; *) echo "Please use start or stop or restart as first argument" ;;esac
9.增加redis服务
chkconfig --add redis
10.设置为开机启动
chkconfig redis on
11.启动服务
nohup service redis start