Install Redis 2.6 as a Service on Ubuntu

This is a complete guide to installing and configuring Redis 2.6 as a service on Ubuntu. While these steps have been tested on Ubuntu Server 12.04, they should apply in general to other versions as well. Also, for a tutorial on installing Redis 2.6 as a service on Amazon EC2 Linux/CentOS and Windows, please click here and here respectively. Another tutorial on installing and using the C- client library for Redis, Hiredis is provided here.


1. Install Ubuntu updates, set time zones, followed by GCC and Make

sudo apt-get update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
sudo apt-get -y install build-essential


2. Install tcl8.5 for Redis

sudo apt-get -y install tcl8.5


3. Download, Untar and Make Redis 2.6

tar xzf redis-2.6.0-rc3.tar.gz
cd redis-2.6.0-rc3
make install
make test


4. Create Directories and Move Redis Config File

sudo mkdir /etc/redis
sudo mv redis.conf /etc/redis/redis.conf


5. Configure Redis.Conf

sudo nano /etc/redis/redis.conf
daemonize yes
dir /var/lib/redis


6. Download init Script, and Move Redis Server

From the Redis Directory:
cd src
sudo mv redis-server /etc/init.d/redis-server
sudo mv redis-cli /etc/init.d/redis-cli
sudo chmod +x /etc/init.d/redis-server


7. Change Redis-Server Settings

nano /etc/init.d/redis-server


8. Create Redis User and Log Files

sudo useradd redis
sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis


9. Auto-Enable Redis-Server

sudo update-rc.d redis-server defaults


10. Start Redis Server

sudo /etc/init.d/redis-server start
In general, the following commands can be used to start, stop, or restart redis-server:
sudo /etc/init.d/redis-server start (stop) (restart)
sudo service redis-server start (stop) (restart)


11. And Finally, to Use Redis Command Line

cd /etc/init.d

So that should get you started with Redis, Redis-Server, and Redis Command Line. As always, if this tutorial was helpful to you, then please do not forget to leave a comment, or two. :)

  • Pingback: Install Redis 2.6 on Amazon EC2 Linux AMI or CentOS - Coding Steps

  • Pingback: Install Redis on Windows - Coding Steps

  • Guest

    v handy cheers. in step 6 redis-cli seemed to be missing?

  • Matt

    Step 6: You mention pulling the github startup script, but if you are in the ./src folder, the redis-server binary is already there, so it creates redis-server.1 (this is ok). Just keep following the steps as list and it will still work ok, just be sure to copy redis-server.1 instead.

  • tommy chheng

    Why put the redis-cli in the /etc/init.d/ directory? init.d is meant for services.

  • Henrique

    In Step 7: nano /etc/init.d/redis-server

    How exactly do you change this settings? Isn’t redis-server a binary file?

    • Henrique

      Never mind, it’s referencing the downloaded script, not the binary redis-server.

  • German Larrain M

    Readers: replace all ‘sudo /etc/init.d/redis-server’ with ‘sudo service redis-server’. That’s the proper way in the last versions of Ubuntu (at least since 12.04).

  • Nazim Zeeshan

    Will this work on Ubuntu EC2?

  • Jamie MacIsaac

    Just installed using 2.6.9 on Ubuntu 12.04 rather than redis-2.6.0-rc3 – seems to work just fine.

  • CopyrightX

    Nice guide. Thanks for sharing.

  • Pingback: Installing & Using Hiredis, C Client Library for Redis - Coding Steps

  • Arjumand Bonhomme

    Great install guide! I’ve used this several times without any issues.