Install and Configure Redis on Ubuntu 17.04 Zesty Zapus

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

It supports data structures such as strings, hashes, sets, sorted sets with range queries, bitmaps, hyper-log and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Redis features include:
– Transactions
– Pub/Sub
– Lua scripting
– Keys with a limited time-to-live
– LRU eviction of keys
– Automatic failover

With this tutorial, you are going to learn how you can install and configure Redis on your Ubuntu server 17.04 step by step.

Install Redis

1. As usual open “Terminal” and run the below command to update all your system packages.

sudo apt-get update

Update 17.04

2. Time to install “Redis” after you had updated the system packages, you can install “Redis” through “Terminal”, by the below command.

sudo apt-get -y install redis-server

install redi

3. Redis-Server is running now by default after its installation, you can check that by the below command.

sudo service redis-server status

redis status

4. Use the below command to check if Redis is listening on its port or not, Redis is using port “6379”.

sudo netstat -naptu | grep LISTEN

netstat cmd

Configure Redis

Redis configuration file is located in the directory “/etc/redis/redis.conf”, In this part of our tutorial we’ll edit on Redis configuration directive so it can listen to every network interfaces instead of localhost only.

1. Open the configuration file that located on “/etc/redis/redis.conf” with nano editor, use the command below to open it.

sudo nano /etc/redis/redis.conf

nano conf redis

2. Replace the line “bind 127.0.0.1” with “bind 0.0.0.0”, then save and exit.

bind line

3. After you are done with editing the configuration file, restart “Redis” service by the command below.

sudo service redis-server restart

restart redis

4. Let’s repeat the listening step again to check that “Redis” is listening on all ports.

sudo netstat -naptu | grep LISTEN

redis listen

Conclusion

In this tutorial, we had explained how you can install and configure Redis on Ubuntu 17.04 from the Ubuntu repository. We also explained how to manage the Redis service, configuring the service, if there is any inquiry you have please comment it below and I shall reply you ASAP.

Leave a Reply