CentOS 6.8 installs with yum sometimes without a newer version, so install it manually. Here are the steps.
Download the latest version
Take 3.2.8 as an example. Attach the address: redis-3.2.8.tar.gz http://download.redis.io/releases/redis-3.2.8.tar.gz
1. Download Redis 3.2.8 installation package
wget -C http://download.redis.io/releases/redis-3.2.8.tar.gz
2. Decompress, compile and install redis-3.2.8
tar -zxvf redis-3.2.8.tar.gz -C /usr/src/ cd /usr/src/redis-3.2.8/ make && make install
3. Create redis related directories:
mkdir -p /home/redis/bin mkdir -p /home/redis/log mkdir -p /home/redis/pid mkdir -p /home/redis/db
4. Copy the executable file to your installation directory: / home/redis/
ln -s /usr/local/bin/redis-* /home/redis/bin/
5. Copy the configuration file to your installation directory: / home/redis/
cp /usr/src/redis-3.2.8/redis.conf /home/redis/
6. Enter your installation directory and edit redis.conf configuration file
cd /home/redis/ vim /home/redis/redis.conf
Other configurations can be defaulted and modified as necessary.pidfile /home/redis/pid/redis.pid logfile /home/redis/log/redis.log dir /home/redis/db
7. Create redis service startup scripts and grant privileges
vim /etc/init.d/redis #!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. PATH=/home/redis/bin:/sbin:/usr/bin:/bin REDISPORT=6379 EXEC=/home/redis/bin/redis-server CLIEXEC=/home/redis/bin/redis-cli PIDFILE=/home/redis/pid/redis.pid CONF="/home/redis/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 ;; *) echo "Please use start or stop as first argument" ;; esac
8. Set permissions and add redis service to boot up:
chmod a+x /etc/init.d/redis
9. Start redis service:
service redis start ps -ef | grep redis netstat -anptu | grep 6379
10. Testing OK
redis-cli set key1 hello get key1 quit
(Firewall enabled port 6379: iptables-A INPUT-p tcp-dport 6379-j ACCEPT)
http://www.cnblogs.com/jimmy-lin/p/6426925.html
http://www.cnblogs.com/ahjx1628/p/6496529.html