Documented here are steps to getting Redis 2.6.x running on Ubuntu 12.04 onwards using an init script (previous versions of Ubuntu should work too). The setup is intended to be used on a developer desktop/laptop rather than production infrastructure.
As ever, first download and unzip Redis from here.
cd /tmp wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz tar -zxf redis-2.6.9.tar.gz cd redis-2.6.9 make sudo make install
Your Redis binaries should now be located in /usr/local/bin.
To get an init script and Redis config working cleanly with this setup, download my init and config files from my Github ‘dotfiles’ repo. My init script and redis.conf are pretty standard – intended for general development purposes.
wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf sudo mv redis-server /etc/init.d/redis-server sudo chmod +x /etc/init.d/redis-server sudo mv redis.conf /etc/redis.conf
Before you can fire up the Redis server for the first time, you’ll need add a redis user and prep a data and logging folder.
sudo mkdir -p /var/lib/redis sudo mkdir -p /var/log/redis sudo useradd --system --home-dir /var/lib/redis redis sudo chown redis.redis /var/lib/redis sudo chown redis.redis /var/log/redis
Also, you need to activate your Redis services init script by adding it to your system’s run-level configuration. That way the service will startup during the boot sequence and stop nicely during the OS’ shutdown procedure.
sudo update-rc.d redis-server defaults
You’re now ready to launch Redis server with
sudo /etc/init.d/redis-server start
Good luck!
Thnx, its work for me!
– ubuntu 11.04 i386
I updated the post to include the run-level config updates.
I think it’s better to add system user:
sudo adduser –system –group –home /var/lib/redis redis
…unless you sharing PC with redis man
Hi there! Thank you for this useful post. It worked out of the box for my dev env. I have one little problem with my production server. When I run /etc/init.d/redis-server start, it does startup the server, but not as a separate process and I have to interrupt it (CTRL+C) in order to use the terminal again. Do you know how can I fix this? Thanks again. Bye bye
Well written, thank you.
sudo useradd –home /var/lib/redis redis
- skips couple of steps
- avoids to have a possibly useless /home/redis
- makes an intuitive place for the dumps, configuratons and so on like – for example – postgreSQL is doing.
Pingback: Install redis as server in ubuntu | Darktalker
To [Giuseppe Modarelli] – i had the same problems. The trick is to change the /etc/init.d/redis-server start script.
What you then need to do is to add the “–background” option to the start command … et voilà – now the redis-server starts up in the background and your telnet server will get a chance to start too!
PS: Thank you Ijonas for taking the time to write the instructions of setting up redis – i found you through google and thought i leave this comment here for all the other people that come the same way and then run into trouble with the boot process hanging because redis isn’t started in background.
Thank you Ijonas for sharing your install experience with Redis. I just installed it on Ubuntu 11.04 and plan on playing around with it. One issue however… How do I stop the terminal echo “Client Connections”? Since the daemonize is set to true, I can’t get a commandline at all! Using VirtualBox as my VM on OS X.
Thanks, this worked really well, the only thing i changed was i used upstart
thank you so much for the post !!!! it helped a lot around people using MAC OS X and using homebrew on it for the install !!! thanks !!!
Thanks. It was very helpful for me.
Just in case, if you aren’t the admin of the server it’s much better to observe the below command to fire up the server else it may create issue while saving the db via a client like python-redis.
sudo redis-server /etc/redis.conf
Your redis.conf uses virtual memory however, it seems like the default configuration that ships with redis strongly discourages it and says it’s deprecated. Perhaps a little explanation will help make a better decision? Thanks for the instructions!
thanks jonas!, ah…check the .conf file to handle this problem:
yo@localhost:~/src/redis-2.4.8$ sudo /etc/init.d/redis-server start
Starting redis-server:
ARE YOU SURE YOU WANT TO USE VM?
Redis Virtual Memory is going to be deprecated soon,
we think you should NOT use it, but use Redis only if
your data is suitable for an in-memory database.
If you *really* want VM add this in the config file:
really-use-vm yes
failed
———-
set vm-enabled off in redis.conf
Works like a charm. Ubuntu 10.10 LTS.
thanks
helpful……
thanks, mate.
Thanks. It works well. I just used it in Ubuntu 12.04 LTS.
I am getting error as shown below when I am running /etc/init.d/redis-server
..
Starting redis-server:
ARE YOU SURE YOU WANT TO USE VM?
Redis Virtual Memory is going to be deprecated soon,
we think you should NOT use it, but use Redis only if
your data is suitable for an in-memory database.
If you *really* want VM add this in the config file:
really-use-vm yes
failed
It seems that redis is deprecating the use of virtual memory. As of redis 2.4.15, you must add
really-use-vm yes
to redis.conf if you wish to enable virtual memory, otherwise the server will not start.
Thanks, worked perfectly. Only note, on redis 2.4 virtual memory is deprecated, so the config file should be updated (either to confirm you really want to use vm, or to disable it).
Unfortunately did not work for me on Ubuntu 11.10
I already had redis installed and working ok
Just trying to get it starting automatically… – the way it does on my Mac.
I followed the instructions but it didn’t start after reboot and I still have to do redis-server
Crispy Installment steps..thanks..!!:)Worked on my ubuntu 11.04..!!
Pingback: Instalar Ultima versión de Redis.io « Alejandro Pirola
Awesome mate, thanks.
But the server wouldn’t start until I commented out this line in the redis.conf file:
vm-enabled yes
Thanks a lot…..It works without any problem.
Thanks a lot for this post, it worked for me with redis 2.6.9.