Redis is a kind of data structure storage and is used as a message broker, key-value database, and also cache system. It is written in C language and supports a large amount of data types like strings, lists, hashes, and many others. Here, we are going to analyze this applicable data store and learn 2 ways to install Redis on Ubuntu 22.04.
Installing Redis is an easy process that may take just a few minutes. But first, you should prepare some requirements.
– A Linux VPS with Ubuntu 22.04 OS
– A root user or non-root user with sudo privileges
Before you start the installation part, your system should be up to date. So, use the following command:
sudo apt update
This section will show how you can add the PPA repository to the Ubuntu operating system.
sudo add-apt-repository ppa:redislabs/redis
As you add the PPA repository, use the following command to start the installation process:
sudo apt-get install redis
If you desire to see the version of the installed Redis, you can run the following command:
redis-server -v
After the installation, It’s time to do the configuration part.
Here, you can use step-by-step instructions to Configure Redis on your Ubuntu system.
If you want to configure Redis, first of all, you should enable the Redis service by running the following command:
sudo systemctl enable --now redis-server
In this section, you should open the Redis configuration file in your desired editor to make changes:
Tip: Here, we will use nano editor.
Sudo nano/etc/redis/redis.conf
Here is what the configuration file looks like:
Now, you should find the Bind address line (127.0.0.1) and replace it with the (Bind 0.0.0.0):
You will need a password for the configuration part which must be specified with the “Requirepass” attribute. Then hit the Ctrl+O keys to apply the changes and return to the terminal:
In this section, you can use the command below to restart the Redis:
sudo systemctl restart redis-server
Use the command below to check the IP and Port number which is used by this service:
ss -tunelp | grep 6379
Tip: To have a TCP connection you can use port: (6379)
sudo ufw allow 6379/tcp
Run the related command to test the Redis server and connect locally:
redis-cli
Now, you should run the “AUTH” command and specify the password you set in the configuration part:
AUTH specify_the_password
For a stable connection and positive output (Ok), you should enter the correct password.
Use the Info command to get detailed information about Redis:
INF0
You can use the ping command to ping the Redis:
ping
To exit Redis, use the “quit” command:
quit
If you decide to uninstall Redis from your Ubuntu operating system, you can run the following command:
sudo apt remove --autoremove redis-server -y
This method was the best and easiest way to install and use Redis on Ubuntu OS.
You can install Redis on any server. But here we decided to focus on the Ubuntu operating system. Here, you learned how to install Redis on Ubuntu 22.04. We thought about the way of installation and configuration of this service. Also, we showed how you can uninstall Redis. Hope you enjoyed this article.
There can be up to 10000 connections on Redis or 4 simultaneous connections per MB of your memory.
As Redis is single-threaded, it can not use multiple cores of the server’s CPU.
How useful was this post?
Click on a star to rate it!
Average rating 5 / 5. Vote count: 1
No votes so far! Be the first to rate this post.
Decompiling APK files on Ubuntu can be useful if you want to reverse-engineer or analyze Android app...
Endlessh is an SSH tarpit that sends an endless, random SSH banner, keeping SSH clients locked out f...
What is your opinion about this Blog?