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 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"$"InchStartif [-F$PIDFILE] then Echo"$PIDFILE exists, process is already running or crashed"ElseEcho"Starting Redis Server ..."$EXEC$CONFFiif ["$?"="0"] then Echo"Redis is running ..."fi;; Stopif [!-F$PIDFILE] then Echo"$PIDFILE does not exist, process was not running"Elsepid=$ (cat$PIDFILE) echo"Stopping ..."$REDIS _cli-p$REDISPORTSHUTDOWNWhile [-X${pidfile}]DoEcho"Waiting for Redis to shutdown ... " sleep 1 done Echo "redis stopped" fi;; Restart|force-reload) ${0} stop ${0} start;; *< Span style= "color: #000000;" >) echo usage:/etc/init.d/redis {start|stop|restart| Force-reload} ">&2 exit 1esac##############################
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 Restar
Installing Redis on CentOS