1. Installing TCL support
Yum Install Tcl
2. Installing Redis We take the latest 2.8.9 as an example
$ wget http://download.redis.io/releases/redis-2.8.9.tar.gz$ tar xzf redis-2.8. 9 . tar.gz$ CD Redis-2.8. 9 $ make$ Make test$ make install
After the test is installed, the Redis-server,redis-cli,redis-benchmark,redis-check-aof,redis-check-dump is automatically copied to the/usr/local/bin directory after installation.
Edit the redis.conf file, which is inside the unpacked package
VI redis.conf
Change Daemonize No to Yes.
We manually copy the redis.conf to/etc directory
CP Redis.conf/etc
Set boot up
Under the/etc/init.d/directory, create a Redis file
########################### #chkconfig:2345 Ten -#description: Start and Stop Redispath=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf" Case " $" inchstart)if[ -F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed" ElseEcho"starting Redis Server ..."$EXEC $CONF fiif["$?"="0"] then echo"Redis is running ..."fi;; Stop)if[ ! -F $PIDFILE] then echo"$PIDFILE does not exist, process was not running" ElsePID=$ (cat $PIDFILE) echo"stopping ..."$REDIS _cli-P $REDISPORT SHUTDOWN while[ -x ${pidfile}] DoEcho"waiting for Redis to shutdown ..."Sleep1Done Echo"Redis stopped"fi;; Restart|force-Reload) ${0} stop ${0} start; *) echo"Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2Exit1esac##############################
Modify permissions, you can run
chmod +x/etc/init.d/redis
Set up start-up service automatically
sudo chkconfig redis on
Start the service:
Service Redis Start
Stop service:
Service Redis Stop
Reference article: Http://www.cnblogs.com/duyinqiang/p/5696490.html & http://www.cnblogs.com/hanyinglong/p/5036558.html
Centos installation Redis