Friday, June 26, 2015

How to install Redis On CentOs


You can download the source code for Redis latest version and build it.
As of this writing, latest version of Redis is 3.0.2.

These are the steps to follow:

1. Download the source code.

   $wget http:// download.redis.io/releases/redis-3.0.2.tar.gz

2.Extract the archive.

    $tar xzf redis-3.0.2.tar.gz

3. Build it.
    $cd redis-3.0.2
  $make

Note that Redis is written in C, so you need C Compiler on your machine in order to build the code.
If you don't have C compiler, use following command to install it:
$yum groupinstall 'Development Tools'

Sometimes, compilation may fail with this error:
"newer version of jemalloc required centos"
To resolve this issue, you should use make command with following switch:
$make MALLOC=libc

Test the installation:
1. Go to redis-3.0.2/src folder and start Redis server.
   $./redis-server
2. Open Redis client on separate terminal.
   $./redis-cli
3. Now, try some commands:
   $set "catalog:product:id" 1234
   $get "catalog:product:id"
   If you get same value as set then everything seems fine.

No comments:

Post a Comment