Skip to content

Instantly share code, notes, and snippets.

@brandonhamric
Last active December 20, 2015 01:09
Show Gist options
  • Save brandonhamric/6047256 to your computer and use it in GitHub Desktop.
Save brandonhamric/6047256 to your computer and use it in GitHub Desktop.
Installing Redis on Ubuntu 12.04

Installing Redis on Ubuntu 12.04

Introduction

This is a quick guide to setting up the latest redis version on Ubuntu 12.04. I'm actually working on an Ubuntu 12.04 64 bit Amazon EC2 instance (ami-dof89fb0), but this should work on most Ubuntu and Linux flavors.

Dependencies

Redis doesn't have many dependencies, just Make, gcc, and TCL:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5 

Compile

The makers of Redis recommend building from source since you'll get the latest stable version and it's a very quick compile time. After running make, they suggest running 'make test':

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make test

Install

Copy the Redis files to their proper locations:

sudo cp src/redis-server /usr/local/bin
sudo cp src/redis-cli /usr/local/bin
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis/redis.conf

Add an Upstart script so Redis can run automatically. The upstart script creates the file '/var/run/redis-server.pid' if you're using monit to monitor your processes.

wget https://gist.github.com/brandonhamric/6047256/raw/9fafacf874ea8c3a8d43fc054e5b0fd47862d3d4/redis-server.conf
sudo cp redis-server.conf /etc/init

Start up the server:

sudo start redis-server
#!upstart
description "Redis Server"
start on startup
stop on shutdown
respawn
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/redis-server.pid --exec /usr/local/bin/redis-server /etc/redis/redis.conf >> /var/log/redis/redis.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment