How To Install Redis CLI on Ubuntu
Posted on May 1, 2021 (Last modified on July 14, 2022) • 2 min read • 313 wordsIn 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.
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 update
```bash
As alternative command to update apt database, you can also run the command below
```bash
sudo apt-get update
After updating apt database we can install redis-cli
using the command below:
sudo apt install redis-tools
```bash
## Install Redis CLI from PPA Repository {#h-install-redis-cli-from-ppa-repository}
In 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:
```bash
sudo add-apt-repository ppa:redislabs/redis
Next step is to update apt metadata using the command below:
sudo apt update
```bash
We can also use apt-get command to update apt metadata using the command below:
```bash
sudo apt-get update
After updating apt database we can install Redis CLI using the command below:
sudo apt-get install redis-tools
```bash
As alternative, we can also use apt command to install Redis CLI using the command below:
```bash
sudo apt install redis-tools
To use redis cli we can use the command below
redis-cli -h <redis-server> -p <redis-port>
```bash
Replace `<redis-server>` with the hostname or IP address of your redis server and `<redis-port>` with the redis port. Redis default port is `6379`.
## Video Tutorial
## Summary {#h-summary}
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.