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=6379
EXEC=/home/redis/redis-5.0.8/src/redis-server
CLIEXEC=/home/redis/redis-5.0.8/src/redis-cli
PIDFILE=/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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。