Original link: http://www.cnblogs.com/xsi640/p/3756130.html
My original installation: Http://www.cnblogs.com/wuling129/p/4647382.html this way a bit of trouble, the way this article is better.
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 redis.conf File
VI redis.conf
Change Daemonize No to Yes.
We manually copy the redis.conf to/etc directory
CP Redis.conf/etc
Write the self-init.d script.
The contents are as follows:
###########################
#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 "$" in
Start
If [-F $PIDFILE]
Then
echo "$PIDFILE exists, process is already running or crashed"
Else
echo "Starting Redis server ..."
$EXEC $CONF
Fi
If ["$?" = "0"]
Then
echo "Redis is running ..."
Fi
;;
Stop
if [!-F $PIDFILE]
Then
echo "$PIDFILE does not exist, process was not running"
Else
pid=$ (Cat $PIDFILE)
echo "Stopping ..."
$REDIS _cli-p $REDISPORT SHUTDOWN
While [-X ${pidfile}]
Do
echo "Waiting for Redis 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
##############################
Can be uploaded to the/etc/init.d/directory via WINSCP
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
Configure the firewall to open the corresponding port:
Vi/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT
Restarting the firewall
Service Iptables Restart
"Go" Install Redis on CentOS