Ubuntu – How to install the latest stable version of Redis

redisUbuntu

I am new to redis. and I just followed cli to install redis sudo apt-get install redis.
but the install server version is 2.2.12 . If I want to update this version and I want to install redis 2.7 + then how can I do this thing, please help. I am working on ubuntu 12.04

Best Answer

Either compile from source or build a .deb package via fpm:

Install fpm with gem:

# apt-get install rubygems
# gem install fpm

Compile Redis:

# cd /usr/local/src/
# wget http://redis.googlecode.com/files/redis-2.4.16.tar.gz
# tar zxvf redis-2.4.16.tar.gz 
# cd redis-2.4.16/
# make

Build .deb package:

# mkdir -p /tmp/redis-$VERSION.$$/usr/bin
# mkdir -p /tmp/redis-$VERSION.$$/etc

# cp src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-server} /tmp/redis-$VERSION.$$/usr/bin

# cp redis.conf /tmp/redis-$VERSION.$$/etc/redis.conf
# cd ..

# fpm -s dir -t deb -n redis-server -v 2.4.16 -C /tmp/redis-2.4.16.18597/ -p redis-server-2.4.16_amd64.deb usr/bin/

Upgrade Redis:

# dpkg -i redis-server-2.4.16_amd64.deb
dpkg: warning: downgrading redis-server from 2:2.2.12-1build1 to 2.4.16.
(Reading database ... 148744 files and directories currently installed.)
Preparing to replace redis-server 2:2.2.12-1build1 (using redis-server-2.4.16_amd64.deb) ...
Stopping redis-server: redis-server.
Unpacking replacement redis-server ...
dpkg: warning: unable to delete old directory '/var/log/redis': Directory not empty
dpkg: warning: unable to delete old directory '/etc/redis': Directory not empty
Setting up redis-server (2.4.16) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...

Examine the version:

# /usr/bin/redis-server -v
Redis server version 2.4.16 (00000000:0)

Source: https://gist.github.com/944216