Last active
August 29, 2015 13:59
-
-
Save chrono-meter/10458949 to your computer and use it in GitHub Desktop.
Build redis on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget http://download.redis.io/releases/redis-2.8.8.tar.gz -O - | tar xz | |
$ pushd redis-2.8.8 && make && sudo make install && popd | |
$ sudo adduser --system --no-create-home --disabled-password --disabled-login redis | |
$ sudo tee /etc/init/redis-server.conf | |
description "redis server" | |
start on runlevel [23] | |
stop on shutdown | |
exec sudo -u redis redis-server /etc/redis.conf | |
respawn | |
$ sudo wget http://download.redis.io/redis-stable/redis.conf -O /etc/redis.conf | |
$ sudo sed --in-place \ | |
-e 's/^dir.*$/dir \/var\/lib\/redis/' \ | |
-e 's/^# syslog-enabled no/syslog-enabled yes/' \ | |
-e 's/^# \(unixsocket.*\)/\1/g' \ | |
-e 's/^# \(bind 127.0.0.1\)/\1/' \ | |
/etc/redis.conf | |
$ sudo mkdir /var/lib/redis && sudo chown redis /var/lib/redis/ | |
$ sudo start redis-server | |
$ sudo pip3.4 install redis | |
$ python3.4 | |
>>> import redis | |
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0) | |
>>> r.set('foo', 'bar') | |
True | |
>>> r.get('foo') | |
b'bar' | |
# OMG. It's not str... | |
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=True) | |
>>> r.get('foo') | |
'bar' | |
# Yeah! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment