Skip to content

Instantly share code, notes, and snippets.

@jbgo
Created November 27, 2012 17:14
Show Gist options
  • Save jbgo/4155591 to your computer and use it in GitHub Desktop.
Save jbgo/4155591 to your computer and use it in GitHub Desktop.
Install latest redis from source (Ubuntu)
description "redis server"
start on runlevel [2345]
stop on runlevel [016]
exec sudo -u redis /opt/redis/redis-server /opt/redis/redis.conf
respawn
/opt/redis/redis.log {
daily
rotate 7
copytruncate
delaycompress
compress
notifempty
missingok
}
# This installs redis in /opt/redis/. This matches previous installations on our system.
# I don't know how it was installed initially, but it definitely wasn't via apt or the
# default source install.
# Download and extract
wget http://redis.googlecode.com/files/redis-2.6.5.tar.gz
tar -xzf redis-2.6.5.tar.gz
# Build
cd redis-2.6.5/
make
# Test (optional)
sudo apt-get install tcl8.5
make test
# Install
mkdir -p /opt/redis/
sudo cp src/redis-{server,benchmark,check-aof,check-dump,cli,sentinel} /opt/redis/
sudo cp redis.conf /opt/redis/redis.conf.default
# Update redis.conf as needed:
# Change paths to /opt/redis/ instead of /var/run/ or /usr/local/.
# Leave the daemonize setting to no or upstart will lose track of the pid.
# Create a redis user
sudo useradd --system --home-dir /opt/redis/ redis
sudo chown -R redis:redis /opt/redis/
# Make it run at boot:
# Create an upstart job config in /etc/init/redis.conf
# I included a simple version in this gist (etc-init-redis.conf).
# Start redis
sudo service redis start
# Process should be running as the redis user
ps aux | grep redis
redis 27192 3.0 0.0 36184 1872 ? Ssl 09:11 0:00 /opt/redis/redis-server /opt/redis/redis.conf
# Use CLI to actually issue commands to redis.
/opt/redis/redis-cli
redis 127.0.0.1:6379> ping
PONG
redis 127.0.0.1:6379> set foo bar
OK
redis 127.0.0.1:6379> get foo
"bar"
redis 127.0.0.1:6379> ^D
# Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment