01 Overview
Consul keeps a real-time registry of what services are running where, checks their health, and can enforce mTLS between them as a service mesh — so applications look services up by name instead of hardcoded addresses.
→ official documentation02 Installation
Pick a platform. Each step is copy-pasteable on its own.
01 Install prerequisites
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl
02 Add the HashiCorp GPG key and repo
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
03 Install Consul
sudo apt-get update && sudo apt-get install -y consul
04 Verify
consul version
01 Add the HashiCorp repo
sudo dnf install -y dnf-plugins-core sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
02 Install Consul
sudo dnf install -y consul
03 Verify
consul version
01 Install via Homebrew
brew tap hashicorp/tap brew install hashicorp/tap/consul
02 Verify
consul version
Note — commands assume sudo privileges and an up-to-date package index. Pin a specific version in production rather than tracking latest.
03 Install script
The steps above bundled into a single idempotent shell script for provisioning boxes unattended.
install-consul.sh
Ubuntu/Debian target · safe to re-run · exits non-zero on failure
04 Cheatsheet
The commands reached for most often once Consul is installed.
| Command | What it does |
|---|---|
| consul agent -dev | Run a single-node dev agent |
| consul members | List cluster members and their status |
| consul catalog services | List registered services |
| consul kv put key value | Write to Consul's key/value store |
| consul connect proxy -sidecar-for app | Run a mesh sidecar proxy for a service |
| consul operator raft list-peers | Inspect the Raft consensus peers |