VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04?comment=73623

⇱ How To Install and Secure Redis on Ubuntu | DigitalOcean


Not using Ubuntu 18.04?
Choose a different version or distribution.
Ubuntu 18.04
πŸ‘ How To Install and Secure Redis on Ubuntu

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

πŸ‘ Mark Drake
Mark Drake
Author
Manager, Developer Education
See author profile

Former Technical Writer at DigitalOcean. Focused on SysAdmin topics including Debian 11, Ubuntu 22.04, Ubuntu 20.04, Databases, SQL and PostgreSQL.

Former Senior Technical Writer at DigitalOcean, specializing in DevOps topics across multiple Linux distributions, including Ubuntu 18.04, 20.04, 22.04, as well as Debian 10 and 11.

πŸ‘ Vinayak Baranwal
Vinayak Baranwal
Editor
Technical Writer II
See author profile

Building future-ready infrastructure with Linux, Cloud, and DevOps. Full Stack Developer & System Administrator. Technical Writer @ DigitalOcean | GitHub Contributor | Passionate about Docker, PostgreSQL, and Open Source | Exploring NLP & AI-TensorFlow | Nailed over 50+ deployments across production environments.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I encountered this towards the end of step 1 when attempting to reload the service:

systemctl reload redis.service
Failed to reload redis.service: Job type reload is not applicable for unit redis-server.service.
See system logs and 'systemctl status redis.service' for details.

In addition to the invalid job type

systemctl reload redis.service
Failed to reload redis.service: Job type reload is not applicable for unit redis-server.service.
See system logs and 'systemctl status redis.service' for details.

I also had a problem with the PID even though it exists. I ran sudo chown redis:redis /var/run/redis and the problem still persists

sudo systemctl status redis

● redis-server.service - Advanced key-value store
 Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
 Active: active (running) since Wed 2018-09-26 08:34:25 UTC; 1min 14s ago
 Docs: http://redis.io/documentation,
 man:redis-server(1)
 Process: 13975 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
 Process: 13978 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
 Main PID: 13992 (redis-server)
 Tasks: 4 (limit: 1152)
 CGroup: /system.slice/redis-server.service
 └─13992 /usr/bin/redis-server 127.0.0.1:6379

Sep 26 08:34:25 tomify systemd[1]: Starting Advanced key-value store...
Sep 26 08:34:25 tomify systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Sep 26 08:34:25 tomify systemd[1]: Started Advanced key-value store.

Hi, even without making a change for supervisor keyword in /etc/redis/redis.conf, I can see output for sudo systemctl status redis. So, do I need to make this change? The key reason I am asking this is, I have to install Redis as part of an automated installed. And, I would like to avoid this type of one-off editing.

Might be dumb to ask but I’ll give it a shot because i’m interested in the answer.

How can I authenticate a ping/pong request to redis using cURL and nc.

I’m hitting redis on port 6379 using nc like this

(printf "PING\r\n";) | nc localhost 6379 

It’s supposed to return PONG, but since i have the password set on, it is asking for authentication

-NOAUTH Authentication required.

I’m only interested and want to play with curl and nc in here.

Thanks in advance @mdrake

Hello,

in the past for Ubuntu 14.04 you suggested to use the chris-lea repository to get the latest stable version of Redis. I wonder if there is any good reason now to prefer the official Ubuntu ppa.

I don’t know whats the issue but at very start when install redis-server and change redis.conf fie and run

sudo systemctl restart redis.service

its says β€œFailed to restart redis.service: Unit redis.service not found.”

Very nice and detail explanation. Thanks!

I set the password as you mentioned! I thought it was really secure. I quit the shell. Then I asked my friend to hack into the redis shell. He entered into the shell using

$ redis-cli

Then he checked the recent commands (using the up arrow key), and it also showed my previous auth command containing the entire password!

> auth your_redis_password_here

Is there any way so that I can hide my password from command history as well?

Awesome, detailed, clean explanation. Congrats!

Solid tutorial! The behavioral verification at each step is hugely useful.

For what it’s worth, I was able to follow this tutorial, to the letter, on Ubuntu 16.04 LTS, too.

πŸ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow β€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Β© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.