How to install Redis on a Centos 6.4 Server

From Brian Nelson Ramblings
Revision as of 03:12, 1 September 2013 by Brian (Talk | contribs) (How to install redis on a Centos Server)

Jump to: navigation, search

How to install redis on a Centos Server

yum install redis
service redis start
chkconfig redis on

Now verify its set to start at boot

chkconfig --list redis
redis           0:off   1:off   2:on    3:on    4:on    5:on    6:off

Now that was pretty simple, but lets say you want to add a second instance to your server on a different port

Add a second instance of Redis

cp redis.conf redis2.conf && cp /etc/init.d/redis /etc/init.d/redis2
vim /etc/init.d/redis2

Change

pidfile="/var/run/redis/redis.pid" to pidfile="/var/run/redis/redis2.pid"
REDIS_CONFIG="/etc/redis.conf" to REDIS_CONFIG="/etc/redis2.conf"
vim /etc/redis2.conf

Change

port 6379 to port 6380
unixsocket /tmp/redis.soc to unixsocket /tmp/redis2.sock
service redis2 start

To install a web interface for redis

cd /downloads/
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin/includes
cp config.sample.inc.php config.inc.php

Make sure the setting are correct

vim config.inc.php

Lets add the RedisAdmin configuration file to Apache

vim /etc/httpd/conf.d/redisadmin.conf

Now add the following

#
#  Web Interface for RedisAdmin
# 

<Directory "/downloads/phpRedisAdmin/">
  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1
  Allow from <your ipaddress>
</Directory>

Alias /redisAdmin /downloads/phpRedisAdmin
Alias /redisadmin /downloads/phpRedisAdmin

View your RedisAdmin Section

http://example.tld/redisadmin