How to Install RethinkDB on Ubuntu 20.04 & 22.04
You’ll learn how to get the real‑time database running on both LTS releases, whether you want a quick apt install (works only on 20.04) or the more reliable Docker route that keeps your system clean.
Prerequisites: Get Your System Ready
sudo apt update && sudo apt upgrade -y sudo apt install curl gnupg lsb-release -y
Updating first guarantees you’re not chasing bugs in old packages, and those three utilities are the backbone for adding external repositories.
Option 1 – Native APT Install (Ubuntu 20.04 only)
I once tried this on 22.04 and hit a wall of broken dependencies—no good.
# Add RethinkDB’s official repository key curl -s https://download.rethinkdb.com/keys/rethinkdb.key | sudo apt-key add - # Create the list file echo "deb https://download.rethinkdb.com/apt $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list sudo apt update sudo apt install rethinkdb
If you’re on 20.04, this pulls a recent enough binary (4.x). On 22.04 the repo points to packages that expect libuv 1.46+, which Ubuntu 22.04 ships with 1.44, so you’ll hit dependency hell.
Option 2 – Docker: The Modern, Safe Path
Docker sidesteps all those quirks and keeps RethinkDB isolated from your OS.
# Install Docker if you don’t have it yet sudo apt install docker.io -y # Pull the official image docker pull rethinkdb # Run a container, expose ports, and mount data docker run -d \ --name rethinkdb \ -p 28015:28015 \ # API port -p 8080:8080 \ # Web UI -v $(pwd)/rethink-data:/data \ rethinkdb
Why expose both ports? 28015 is the driver port your apps talk to; 8080 serves the handy web dashboard.
Verify Everything’s Working
# Check container status docker ps | grep rethinkdb # Open a browser: http://localhost:8080/
You should see the “RethinkDB Web UI” with a green “Running” status. Try a quick query:
> r.dbList() => ["rethinkdb"]
That means the DB is alive and your driver can connect on 28015.
Troubleshooting Quick‑Fixes
- Port already in use? Change -p 8080:8080 to another host port.
- Container dies immediately: Check logs with docker logs rethinkdb. Most often it’s a data volume permission issue; ensure the directory you mount exists and is writable.
- Want persistent data across restarts: The -v $(pwd)/rethink-data:/data flag already does that. Just keep the host folder alive.
That’s all there is to it—pick your path, run a few commands, and you’ve got a live RethinkDB instance without wrestling with obsolete packages.