/ #Redis #tooling 

Install just redis-cli on Ubuntu, Debian, Jessie

As part of adding integration tests to an app on CircleCI I ran into the following issues:

  • redis-cli’s API has changed from version 2 to 3 to 4
    • ie. this works in v4 redis-cli -u ${REDIS_URL} but doesn’t in v2
  • the “only way” to install redis-cli is through a redis-tools or redis-server install and I only need redis-cli not the server or any other tools

What follows is how not to install redis-cli and then how to install redis-cli latest, properly.

This was sent out on the Code with Hugo newsletter last Monday. Subscribe to get the latest posts right in your inbox (before anyone else).


apt-get install redis-tools

This installs an outdated version, 2.8.x where stable is 4.x.x.


apt-get install redis-server

Maybe we don’t need the full redis-server install if we only need the CLI. Sometimes it also installs the old redis-cli… not the best.


cd /tmp
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
cp src/redis-cli /usr/local/bin/
chmod 755 /usr/local/bin/redis-cli

You’ll need libjemalloc1 libjemalloc-dev gcc make most of which should already be installed. We’re building from source… which takes about a minute on the CircleCI containers (so I would expect less everywhere else), which is fine.

Credit: DevOps Zone, install redis-cli without installing server. I shamelessly took the snippet from there, because hey, it works.

Installing redis-cli latest on CircleCI

Same as above except:

sudo cp src/redis-cli /usr/local/bin/
sudo chmod 755 /usr/local/bin/redis-cli

CircleCI runs the jobs with a non-root user by default, and kudos to them for that, more tools should make you think about what privileges you have.

I’m not exactly sure what distribution CircleCI images run, some sort of Debian? Let me know at [email protected], or @hugo__df.

Installing redis-cli latest on Alpine in Docker

apk --upgrade redis

If you know why this works but apt-get install redis-server sometimes installs old redis-cli drop me a line at [email protected], or Twitter @hugo__df.

unsplash-logoNils Stahl


Hugo Di Francesco

A developer, working out of London writing CSS, JavaScript and Python.

Subscribe for Enterprise Node.js and JavaScript Guides

Build your web platform with modern Node.js/JavaScript best-practices, tools and patterns