Linux - Install redis-cli only
Solution 1
Ubuntu (tested on 14.04) has package called redis-tools
which contains redis-cli
among other tools.
To install it type:
sudo apt-get install redis-tools
Note that on Ubuntu 16.04+ the command is a little bit different:
sudo apt install redis-tools
Solution 2
Instead of redis-cli
you can simply use nc
!
nc -v --ssl redis.mydomain.com 6380
Then submit the commands.
Solution 3
From http://redis.io/topics/quickstart
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make redis-cli
sudo cp src/redis-cli /usr/local/bin/
With Docker I normally use https://registry.hub.docker.com/_/redis/. If I need to add redis-cli to an image I use the following snippet.
RUN cd /tmp &&\
curl http://download.redis.io/redis-stable.tar.gz | tar xz &&\
make -C redis-stable &&\
cp redis-stable/src/redis-cli /usr/local/bin &&\
rm -rf /tmp/redis-stable
Solution 4
In my case, I have to run some more steps to build it on RedHat or Centos.
# get system libraries
sudo yum install -y gcc wget
# get stable version and untar it
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
# build dependencies too!
cd deps
make hiredis jemalloc linenoise lua geohash-int
cd ..
# compile it
make
# make it globally accesible
sudo cp src/redis-cli /usr/bin/
Solution 5
To install 3.0 which is the latest stable version:
$ git clone http://github.com/antirez/redis.git
$ cd redis && git checkout 3.0
$ make redis-cli
Optionally, you can put the compiled executable in your load path for convenience:
$ ln -s src/redis-cli /usr/local/bin/redis-cli
Related videos on Youtube
Oleg
Updated on April 10, 2022Comments
-
Oleg about 2 years
I have a Linux server with Redis installed and I want to connect to it via command line from my local Linux machine.
Is it possible to install
redis-cli
only (withoutredis-server
and other tools)?If I just copy
redis-cli
file to my local machine and run it, I have the following error:./redis-cli: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./redis-cli)
-
arkascha over 10 yearsWell, 1. it is not surprising that just copying the executable does not work: most likely you have different architecture and library versions, that cannot work. 2. you should consult the software management system your distribution provides and see what
redit
packages it provides. Then installing one of those shoudl only require a single click. You should never do a wild installation of stuff into a Linux system if you can use the software management instead. -
Oleg over 10 years@arkascha Thank you for your tip. I'm quite new to Linux so this information is very useful for me
-
arkascha over 10 yearsYou mean you are a developer working under a Linux environment, but you never used your systems software management system? What distribution do you use?
-
arkascha over 10 yearsYou might also be interested in a package called 'hiredis' which offers a minimalistic c client for redis. No ready-to-use cli client though.
-
Oleg over 10 yearsWell, actually I'm just playing with Redis. I'm on Ubuntu. I've installed Redis and it works fine. Then I installed Debian on VirtualBox, and now I'm trying to connect to Redis on Ubuntu from Debian virtual machine
-
arkascha over 10 yearsSo how did you install
redis
on that ubuntu system? -
Oleg over 10 yearsI've compiled the sources. I can do the same on Debian machine, but I'm just curious can I install just redis-cli without installing all redis components
-
Oleg over 10 yearsit seems that Debian doesn't support neither redis, nor redis-cli packages
-
arkascha over 10 yearsWhy invest so much effort? Just pick the redis package in your software management and install it. That takes two minutes most and you can start using it. What is the advantage in doing all that by hand and ignoring all the advantages of cleanly installed packages?
-
arkascha over 10 yearsDebian does not offer redis packages? LOL. One more reasons not to use Debian. (sorry, could not resist).
-
arkascha over 10 years
-
deltheil over 10 yearsWhat about
git clone [email protected]:antirez/redis.git
thencd src && make redis-cli
? -
Oleg over 10 years@deltheil It works nicely. Thank you!
-
febot about 6 yearsI recommend the Docker solution, see my answer. Can be disposed at any time and your system's packages are untouched in the process.
-
-
Oleg about 10 yearsThank you for your answer. I will try it as soon as I can
-
Oleg about 10 yearsFor me this command compiled the whole Redis, not only
redis-cli
-
dhamu over 9 years
git clone http://github.com/antirez/redis.git && cd redis && git checkout 2.8.6 && make redis-cli && cp src/redis-cli /usr/local/bin
- this works for me. -
Ariel Allon almost 8 yearsanything similar for centos?
-
James111 over 7 yearsTry
nc -v redis.mydomain.com 6379
(or your custom port) -
pyrospade about 7 yearsThis is the best answer since it requires absolutely no dependencies or external tools.
-
Matt Bucci about 7 yearsis it possible to use this with a redis password?
-
Bryan Cote-Chang almost 7 yearsPotentially stupid comment, but don't forget to install gcc
sudo yum install gcc
before runningmake
! -
Prashanth Chandra over 6 yearsYou can also use
rlwrap nc -v redis.mydomain.com 6379
if you haverlwrap
which lets you use keyboard shortcuts just as you would in a shell (e.g. cycle/search previous command, next word) -
Artistan over 6 yearstried to edit this. but here is a gist on how to do it now... gist.github.com/Artistan/d9288f8e12c4027096e66bd331d4e4fd
-
Artistan over 6 years@AlinPurcaru - gist.github.com/Artistan/d9288f8e12c4027096e66bd331d4e4fd
-
barath almost 6 yearsWorks on linux too.
-
hashlash over 5 yearsI can't find
--ssl
option fornc
. Did you meanncat
? -
Balázs Németh over 5 yearsnetcat - it depends on your OS what the binary exactly is. maybe it's called ncat. I don't know :(
-
yihuang almost 5 years@AlinPurcaru docker run --rm --network=host redis redis-cli info
-
Andrew Sneck over 4 yearsnow it isn't working
http://security.ubuntu.com/ubuntu bionic-updates/universe amd64 redis-tools amd64 5:4.0.9-1ubuntu0.1
returns 404 Not Found -
Vipresh about 4 yearsGetting this error on copy command, any idea how to fix it cp src/redis-cli /usr/local/bin/ cp: cannot stat 'src/redis-cli': No such file or directory
-
Govind Kailas about 3 yearsLiked your solution, the last update is 3 years ago. Did you try building with the new go version, will it make any difference?
-
manu muraleedharan almost 3 yearsWorked for me on Amazon Linux
-
Marc Shepherd over 2 years@MattBucci You can do the following:
(printf "AUTH <password> \r\n"; sleep 1) | nc -v redis.mydomain.com 6379
-
lboix about 2 yearsGreat snippet, I never thought of it ^^