How to install redis



In this article you will learn how to install redis server under Linux / UNIX environments.

 

Note: As of when this article was written (May 2013) we are using Debian based operating system Ubuntu 12.04 LTS.This works under Ubuntu 10.04 LTS, Ubuntu 13, CentOS / RHEL / Redhat Enterprise Linux, Debian 6 and Debian 7.

 

What is Redis?

 

Fist things first. What is Redis? Redis is a stable and high performance persistent key-value store server. It is usually intended as a data store solution for applications where performance, stability, scalability and flexibility is a critical factor than persistence and absolute data integrity.

 

Redis is also known as a part of the “NoSQL” movement and is an excellent tool for developers to achieve it.

In this article we will cover installation of redis server; you’ll also learn best practices for the production environment in order to achieve the best possible outcomes.

 

You either need to run commands as root and ignore sudo in below commands or if you are logged in with your user it should be a sudo user.

 

sudo apt-get update

sudo apt-get upgrade

 

The first command is updating you software update repositories; the second command is upgrading software packages installed against the updated repositories.

 

Next, install redis server using below command:

sudo apt-get install redis-server

 

Redis server default configuration file is “redis.conf” locate din “/etc/redis” directory.

 

Copy the default configuration file, as it is better to safe than sorry : -)

 

sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.backup

 

Do not edit “redis.conf” in the “/etc/redis” directory.

 

daemonize yes

pidfile /var/run/redis.pid

logfile /var/log/redis.log

 

port 6379

bind 127.0.0.1

timeout 300

 

loglevel notice

 

## Default configuration options

databases 16

 

save 900 1

save 300 10

save 60 10000

 

rdbcompression yes

dbfilename dump.rdb

 

appendonly no

 

The values of the above configuration files are the defaults.

 

Default runs the server locally on the system. The “bind” directive is pointed to the loop back address “127.0.0.1”. If you want it to be available over the network or internet, you can change this to your IP address. Default port for redis server is “6379”.

 

Restart the redis server for any changes that you may have made using the below command:

 

sudo /etc/init.d/redis-server restart

or

sudo service redis-server restart

 

You have successfully installed and configured redis server and you can view the cli by using the below command:

 

sudo redis-cli

 

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)