Download Redis installation files
wget http://download.redis.io/releases/redis-3.0.3.tar.gz
650) this.width=650; "title=" clip_image002 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/70/03/ Wkiol1wvg2-jihiiaacmcl3gzs0300.jpg "width=" 604 "height=" 444 "/>
Unzip the file redis-3.0.3.tar.gz
Tar xzf redis-3.0.3.tar.gz
650) this.width=650; "title=" clip_image004 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M00/70/03/ Wkiol1wvg3crd5q5aaekeynpnju140.jpg "width=" 604 "height=" 234 "/>
compiling source files
Make
650) this.width=650; "title=" clip_image006 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M01/70/03/ Wkiol1wvg3cau99daaektiaukjw876.jpg "width=" 604 "height=" 323 "/>
Hint error GCC not found
sudo yum-y intall gcc
650) this.width=650; "title=" clip_image008 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M02/70/03/wKioL1Wvg3GA-K_ Saae2yjgs8dm805.jpg "width=" 604 "height=" 324 "/>
Then delete the pressurized file
RM-RF redis-3.0.3
650) this.width=650; "title=" clip_image010 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M00/70/03/ Wkiol1wvg3lalqwgaadrrlsutii836.jpg "width=" 604 "height=" 403 "/>
Tar xzf redis-3.0.3.tar.gz
CD redis-3.-0.3
Make
650) this.width=650; "title=" clip_image012 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M01/70/03/ Wkiol1wvg3lrzpdxaaddivk9sug746.jpg "width=" 604 "height=" 337 "/>
Input./src/redis-server
Start Redis
650) this.width=650; "title=" clip_image014 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image014 "src=" http://s3.51cto.com/wyfs02/M02/70/03/ Wkiol1wvg3pbewogaaftorfgges021.jpg "width=" 604 "height=" 336 "/>
Open a new terminal input sudo./redis-3.0.3/src/redis-cli
Enter set Foo bar
Enter get foo
Test Normal installation success
650) this.width=650; "title=" clip_image016 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image016 "src=" http://s3.51cto.com/wyfs02/M00/70/03/ Wkiol1wvg3st7xwfaactj46uiro352.jpg "width=" 604 "height=" 340 "/>
Modify redis-3.0.3 under Configuration file
Vim./redis-3.0.3/redis.conf
Find Daemonize No this change is yes
Make the server run in the background
New Redis Service Script
sudo touch/etc/rc.d/init.d/redis
650) this.width=650; "title=" clip_image018 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image018 "src=" http://s3.51cto.com/wyfs02/M01/70/03/ Wkiol1wvg3tjnsodaacnzwspt0e072.jpg "width=" 604 "height=" 337 "/>
Edit File
sudo vim/etc/rc.d/init.d/redis
Enter the following file
From the network
#!/bin/sh
#chkconfig: 2345 86 14
#description: Startup and shutdown script for Redis
PROGDIR=/OPT/REDIS-3.0.3/SRC #安装路径
Progname=redis-server
daemon= $PROGDIR/$PROGNAME
Config=/opt/redis-3.0.3/redis.conf
Pidfile=/var/run/redis.pid
desc= "Redis Daemon"
Scriptname=/etc/rc.d/init.d/redis
Start ()
{
If Test-x $DAEMON
Then
Echo-e "Starting $DESC: $PROGNAME"
If $DAEMON $CONFIG
Then
Echo-e "OK"
Else
Echo-e "Failed"
Fi
Else
Echo-e "couldn ' t find Redis Server ($DAEMON)"
Fi
}
Stop ()
{
If Test-e $PIDFILE
Then
Echo-e "Stopping $DESC: $PROGNAME"
If kill ' cat $PIDFILE '
Then
Echo-e "OK"
Else
Echo-e "Failed"
Fi
Else
Echo-e "No Redis Server ($DAEMON) Running"
Fi
}
Restart ()
{
Echo-e "Restarting $DESC: $PROGNAME"
Stop
Start
}
List ()
{
PS aux | grep $PROGNAME
}
Case $ in
Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
List
List
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|list}" >&2
Exit 1
;;
Esac
Exit 0
Increase execution permissions
650) this.width=650; "title=" clip_image020 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image020 "src=" http://s3.51cto.com/wyfs02/M02/70/03/ Wkiol1wvg3wteik0aadre00uxeo791.jpg "width=" 604 "height=" 342 "/>
Add Service
sudo chkconfig--add Redis
Error
650) this.width=650; "title=" clip_image022 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image022 "src=" http://s3.51cto.com/wyfs02/M00/70/03/ Wkiol1wvg3biioiwaafr7v0pi50926.jpg "width=" 604 "height=" 439 "/>
Modify the/etc/rc.d/init.d/redis, check #chkconfig: 2345 86 14 this line.
650) this.width=650; "title=" clip_image024 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image024 "src=" http://s3.51cto.com/wyfs02/M00/70/06/ Wkiom1wvgzliuhveaafopdsyq5k862.jpg "width=" 604 "height=" 409 "/>
Set boot up
sudo chkconfig--level 2345 Redis on
650) this.width=650; "title=" clip_image026 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image026 "src=" http://s3.51cto.com/wyfs02/M01/70/06/ Wkiom1wvgzoj2hr3aaeqmxyakxy759.jpg "width=" 604 "height=" 339 "/>
Last sudo cp-r/home/william/redis-3.0.3/opt/redis-3.0.3
Start Redis
sudo service Redis start
Turn off Redis
sudo service Redis stop
Restart Redis
sudo service Redis restart
CentOS Installation redis3.0.3