The first thing you need to do in order to use Consul is install it. In a production deployment you would install Consul on every node where you want to register services, but in this guide you will install it locally so that you can use it to explore Consul's core capabilities. Consul is distributed as a binary package.
If you need to compile Consul from source instead, see the documentation.
To install Consul, find the appropriate package for your system and download it. Consul is packaged as a zip archive.
After downloading Consul, unzip the package. Consul runs as a single binary
consul. Any other files in the package can be safely removed and Consul
will still function.
Make sure that the
consul binary is available on your
PATH. You can check
the locations available on your path by running this command.
echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
The output is a list of locations separated by colons. You can make Consul
available by moving the binary to one of the listed locations, or by adding
Consul's location to your
Tip (Linux-based or Mac): Permanently add a new location to your path by
editing your shell's settings file (usually called something like
where the part of the file name after the
. and before
rc is the name of
your shell). In that file you will see a line that starts with
followed by a colon-separated list of locations. Add the location of the Consul
binary to that list and save the file. Then reload your shell's configuration
with the command
source ~/.bashrc, replacing
bash with the name of your
Tip (Windows): Add a location to your path via the GUI by navigating to
Environment Variables in your system settings, and looking for the variable
PATH. You will see a semicolon-separated list of locations. Add the
Consul binary's location to that list and then launch a new console window.
Verifying the Installation
After installing Consul, verify that the installation worked by opening a new
terminal session and running the command
consul usage: consul [--version] [--help] <command> [<args>] Available commands are: agent Runs a Consul agent event Fire a new event ...
If you get an error that
consul could not be found, your
variable was not set up properly. Make sure that your
PATH variable contains
the directory where you installed Consul.
In this guide you installed Consul on your local machine. Continue to the next guide where you will learn how to run the Consul agent.