Install Redis on Ubuntu 18.04

Install Redis on Ubuntu 18.04

Redis is an in-memory key-esteem store known for its adaptability, execution, and wide language support. This instructional exercise exhibits how to introduce, design, and secure Redis on a Ubuntu 18.04 server.

Prerequisites

You will have an Ubuntu 18.04 server with non-root and sudo privilege and a basic firewall configured.

Install Redis on Ubuntu 18.04 - prashantsuthar.com

Step 1 — Installing Redis

We need to update apt packages and install redis.

sudo apt-get update
sudo apt-get install redis-server

This will be download redis and install with their dependencies in Ubuntu 18.04
Now we make change in configuration file to start server on init. (systemd)

Open config file using below command.

sudo nano /etc/redis/redis.conf

Inside file find <strong>supervised</strong>, Right now Its <strong>no</strong> make it <strong>systemd</strong>
after this change statement looks like this.

supervised systemd

After making change restart the server and test it working properly or not.

sudo systemctl restart redis.service

Testing Redis

check redis service.

sudo systemctl status redis

Connect server using Cli.

redis-cli

After that, test connectivity use ping command.

ping

you will get <strong>pong</strong> as an output.

Now we try to strore and get it.

set test "It's working!"

Output will be OK.

get test

Output will be “It’s working!”

Restart redis you can use below command

sudo systemctl restart redis

Now Binding it to the localhost ( web server.)

Open its configuration file and bind to the localhost ( 127.0.0.1 )

sudo nano /etc/redis/redis.conf

Locate this line and make sure it is uncommented (remove the # if it exists):

bind 127.0.0.1 ::1

Then, restart the service to ensure that systemd reads your changes:

sudo systemctl restart redis

I hope you like this article. Keep visiting my website for more upcoming articles. If you need any help with Install redis on Ubuntu 18.04 you can contact me. You can ask me questions in comments also. You can connect me on social media as well links are below in the footer section. Keep connected. Happy Coding.

Prashant Sutharhttps://prashantsuthar.com
My self Prashant Suthar, I had experience worked with NodeJS, Core PHP, WordPress, CodeIgniter, Shopify, Prestashop, Opencart and many frameworks. I had some basic knowledge about server setup and maintenance. I also worked with third parties APIs like Twillio audio,video, SMS API, FB messenger API and many more. I am working as team lead & sr. developer in Ahmedabad, GJ, IN.

Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Similar Articles