;

How to Install Redis on Ubuntu 14

Try it in our public cloud & Get $5 Credit
CLAIM NOW

How to Install Redis on Ubuntu 14

Redis (Remote Dictionary Server) is an open-source NoSQL data structure server. Redis functions simultaneously as a database, a cache, and a message broker. As a database, the key-value store model used by Redis allows it to store and access very large amounts of data more efficiently than do relational databases. As a cache, Redis generally holds the entire database in memory, so complex analytical operations can be completed very quickly. As a message broker, Redis supports a number of popular protocols for job queues. Bindings for Redis are available for most widely-used programming languages. The present tutorial will guide you through the basics of installing and configuring Redis on Ubuntu 14.04.

Getting Started

In order to follow this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) running Ubuntu 14.
• Root access to the server or a user with sudo privileges.

All commands in this tutorial are written as if they are executed by root.

Tutorial

Always makes sure your Ubuntu 14.04 system is fully up to date before you install any new packages. Use the following apt-get commands to update your server’s system.

apt-get update && apt-get upgrade -y

Install Redis

We recommend you use the Redis server package provided in the base repositories to install Redis on Ubuntu 14.04. To do so, simply enter the following command:

apt-get install redis-server -y

Make Redis Secure

The default security settings on Redis allow users to connect to it from any IP address. Unless Redis is meant to be deployed on a cluster or you intend to connect to Redis from an external site, the safest option is to bind Redis to the local IP address. Doing so will prevent unauthorized users from gaining access to your Redis Keystore.

To bind Redis to the local IP address, open the configuration file in the nano text editor:

nano /etc/redis/redis.conf

Search for the line that starts with bind. Make sure the line is uncommented (no # at the beginning) and that it reads as follows:

bind 127.0.0.1

Save and close the configuration file.

Getting Started With Redis

You are now ready to start Redis. Enter this command:

service redis-server start

To save yourself the trouble of having to start Redis manually in the future, set it to start automatically when your Ubuntu 14.04 server boots:

update-rc.d redis-server enable
update-rc.d redis-server defaults

Finally, test that Redis is working. Go ahead and enter your first data into the Redis server using the SET command:

root@redis-node:~# redis-cli
127.0.0.1:6379> set besthost "Globo.Tech"
OK

To check that you have successfully entered the data, use the command GET to retrieve your first entry.

127.0.0.1:6379> get besthost
"Globo.Tech"

Conclusion

You have installed, secured, and tested Redis on your Ubuntu 14.04 server. Whether you need to analyze a small amount of data or perform complex analytical tasks with an enormous dataset, Redis can now help you get the job done. Whatever languages you prefer to program in, there are almost certainly bindings available that will enable you to program Redis to do what you want it to do. If this guide was helpful to you, kindly share it with others who may also be interested.