Finding it difficult to install Redis in your Ubuntu 18.04 server? We’ll help you through it.
Redis stores data in memory and literally serve data faster. It works as a database, caching mechanism, and a communication medium for apps.
At Bobcares, we often receive requests to fix Redis installation errors as part of our Server Management Services.
Today, let’s take a look at how our Support Engineers easily install it for our customers.
More about Redis
Before getting into the installation part, let’s discuss Redis.
Basically, Redis is a server that stores data. It works as a data storage space that can store, retrieve and manage data.
And, Redis which is primarily a key-value store, can function as a database, cache and a message broker.
Redis gains its popularity due to its additional datatype support and persistence.
Though it functions like a database, we cannot run complicated queries in Redis. We can just perform easy key lookups.
How we install Redis in Ubuntu 18.04?
Recently, one of our customers approached us with a query. He had Ubuntu 18.04 server with many e-commerce sites hosted on it.
One of his customers complained about the slow loading of a site on his Ubuntu server.
So, to improve the site performance, our Support Engineers suggested using Redis as an application cache server. Here, the Redis server reduces the time required to serve content from external resources. We installed Redis on his server with the following steps.
1. Firstly, we updated the apt package and installed Redis and its dependencies using the command,
apt update apt install redis-server
2. Then we open the Redis configuration file, /etc/redis/redis.conf.
And, in that file, the supervised directive was set to no by default. We changed it to systemd, since we were using the Ubuntu server.
3. Finally, to reflect the changes made, we restarted the Redis service using:
systemctl restart redis.service
That completed the Redis installation. Now, to check whether Redis works properly, we get into the redis-cli and try ping.
If we get a pong message as output, it shows the proper working of Redis.
Common error while installing Redis in Ubuntu 18.04
Though the steps to install appears pretty simple, errors can creep in during the install process. Let’s now see a common error and its fix that we did for one of our customers.
The customer was getting the error NOAUTH Authentication required while accessing data from the database.
This is a security feature in the Redis server that prompts the clients to authenticate before accessing data.
Redis allows configuring Redis password in the requirepass directive under the SECURITY section of the /etc/redis/redis.conf file.
To fix the error, we modified the auth command as follows.
127.0.0.1:6379> auth your_redis_password
So, this started to authenticate with the password specified in the Redis configuration file.
[Need more assistance with Redis installation?- We’re here to help you.]
In today’s article, we discussed how our Support Engineers easily installed Redis in Ubuntu 18.04 server.