How to install and configure Redis server on Pop!_OS: A step-by-step guide
Table of contents
Redis
Redis, which stands for Remote Dictionary Server, is an open-source, in-memory data structure store. It is often referred to as a data structure server because it supports a variety of data structures such as strings, hashes, lists, sets, and more. Redis is designed to be fast and efficient, providing high-performance data storage and retrieval.
Let's get down to business
Shall we?
Check your OS (optional)
This step is just to make sure you have Pop!_OS
installed.
uname -a
hostnamectl
lsb_release -a
cat /etc/os-release
Output
Prerequisites
sudo apt install lsb-release curl gpg
Download the Redis GPG key
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
Output
This command downloads the Redis GPG key from the specified URL using curl
, and then it uses gpg
to dearmor the key and save it to the specified location with superuser privileges.
This GPG key is likely used for verifying the authenticity of the Redis packages when they are later installed or updated on the system.
Create a new repository
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
Output
This command creates a new APT repository source file (/etc/apt/sources.list.d/redis.list
) with the Redis repository information.
The repository is configured to use a GPG key for package verification, and the URL includes the distribution codename dynamically obtained from the lsb_release -cs
command.
This new source entry allows the system to fetch and install Redis packages from the specified repository.
Update the local package index
sudo apt-get update
Running apt-get update
is typically the first step before installing or upgrading packages on a system. It ensures that the local package index is up-to-date, allowing you to install the latest versions of packages or check for updates to existing packages.
Install Redis
sudo apt-get install redis -y
Output
When you run sudo apt-get install redis -y
, the system will download and install the Redis server package along with any necessary dependencies.
Check installation
redis-server -v
which redis-server
which
This command is used to determine the path to the executable binary for the Redis server.
It prints the full path to the Redis server executable, helping you identify where the Redis server binary is located in your system.
version
- This command is used to check the version of the Redis server that is installed on your system.
Status of Redis server service
sudo systemctl status redis-server
Output
The output will provide information about whether the Redis server is active, the current process ID (PID), recent logs, and more. It's a way to check if the Redis service is running and to get details about its current state.
The sudo systemctl status redis-server
command provides information about the status of the Redis server service, including whether it is active and details about its current state.
Check if server is responsive
redis-cli ping
Output
ping
is a simple command that can be used to check if the Redis server is reachable and responsive. If the server is responsive, it will return "PONG."
Done
Celebrate
Reach me out
Final thoughts
Thank you for reading this article.
If you have any questions, thoughts, suggestions, or corrections, please share them with us.
We appreciate your feedback and look forward to hearing from you.
Feel free to suggest topics for future blog articles. Until next time!
Subscribe to my newsletter
Read articles from Alexandre Calaça directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Alexandre Calaça
Alexandre Calaça
I'm a passionate software developer.