May 1, 2021 in Tutorial2 minutes

In this tutorial, we learn how to install Redis CLI on Ubuntu. This tutorial can be used in any version of Ubuntu including but not limited to Ubuntu 20.04/18.04/16.04.
We can install redis-cli from Ubuntu repository using the following commands. First, we need to update the Ubuntu apt database using the command below.
sudo apt updateAs alternative command to update apt database, you can also run the command below.
sudo apt-get updateAfter updating apt database we can install redis-cli using the command below:
sudo apt install redis-toolsIn the previous step, we learned how to install redis-cli from the Ubuntu repository. If you need a newer version of redis-cli you can install a newer redis-tools package from the PPA repository.
First let’s add the PPA repository using the command below:
sudo add-apt-repository ppa:redislabs/redisNext step is to update apt metadata using the command below:
sudo apt updateWe can also use apt-get command to update apt metadata using the command below:
sudo apt-get updateAfter updating apt database we can install Redis CLI using the command below:
sudo apt-get install redis-toolsAs alternative, we can also use apt command to install Redis CLI using the command below:
sudo apt install redis-toolsTo use redis cli we can use the command below.
redis-cli -h <hostname> -p <port>Replace <hostname> with the hostname or IP address of your redis server and <port> with the redis port. Redis default port is 6379.
In this tutorial we learn how to install Redis CLI from Ubuntu repository and redislabs team PPA repository. Installing redis-cli might be necessary when you need to connect to a remote redis instance without having to install the redis server package. Until next time.