Installing Redis 2.8.7 under CentOS 6.5

Source: Internet
Author: User
Tags redis server

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:

    1. wget http://downloads.sourceforge.net/tcl/tcl8.5.10-src.tar.gz
    2. Tar xzvf tcl8.5.10-src.tar.gz
    3. CD tcl8.5.10/unix/
    4. ./configure
    5. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.