1. 下載編譯安裝c++
wget http://download.redis.io/releases/redis-3.0.7.tar.gz tar xzf redis-3.0.7.tar.gz cd redis-3.0.7 make
make 報錯redis
(1) gcc not foundshell
解決方法spa
yum -y install gcc gcc-c++ autoconf make
(2)rest
解決方法code
make MALLOC=libc
2. 安裝並配置orm
make install vi redis.conf
修改redis.conf文件daemonize no改爲yesserver
cp redis.conf /etc cd /etc/init.d/ #編寫redis服務啓動和關閉腳本 vi redis
########################### #chkconfig: 2345 10 90 #description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 EXEC=/usr/local/bin/redis-server REDIS_CLI=/usr/local/bin/redis-cli PIDFILE=/var/run/redis.pid CONF="/etc/redis.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists,process is already running or crashed" else echo "Starting Redisserver..." $EXEC $CONF fi if [ "$?"="0" ] then echo "Redis isrunning..." fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does notexist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $REDIS_CLI -p $REDISPORTSHUTDOWN while [ -x ${PIDFILE} ] do echo "Waiting forRedis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/redis{start|stop|restart|force-reload}" >&2 exit 1 esac ##############################
chmod +x redis #添加可執行權限 chkconfig redis on #設置開機自動啓動
啓動服務ip
service redis start
關閉服務get
service redis stop