wget http://download.redis.io/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
CD redis-stable
Make
The first 3 steps should be no problem, the main problem is that when you execute make, an exception occurs.
Exception One:
MAKE[2]: Cc:command not found
Exception reason: GCC is not installed
Solution: Yum Install gcc-c++
Exception Two:
Zmalloc.h:51:31:error:jemalloc/jemalloc.h:no such file or directory
Exception reason: Some compiler dependencies or original compilation legacy problems
Solution: Make Distclean. Clean it up and make it again.
After make is successful, make test is required. An exception occurred in make test.
Exception One:
Couldn ' t execute "tclsh8.5": No such file or directory
Exception reason: Tcl not installed
Solution: Yum install-y tcl. Or:
- wget http://downloads.sourceforge.net/tcl/tcl8.5.10-src.tar.gz
- Tar xzvf tcl8.5.10-src.tar.gz
- CD tcl8.5.10/unix/
- ./configure
- Make&&make Install
Run make Test
#cd/home/sandea/redis-stable
#make Test
After make test succeeds, make install
#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
#mkdir/etc/redis
#cp redis.conf/etc/redis/redis.conf
#vi/etc/redis/redis.conf
Daemonize Yes
Pidfile/var/run/redis.pid
Logfile/etc/redis/redis.log
Writing a self-init.d script
#vi/etc/init.d/redis
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/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
##############################
Save, Grant to Redis:
#chmod +x/etc/init.d/redis
Set up auto start service on boot:
#chkconfig Redis on
Start the service:
#service Redis Start
Stop service:
#service Redis Stop
Installing Redis 2.8.7 under CentOS 6.5