Install Nomad
Nomad is available as a pre-compiled binary or as a package for several operating systems. You can also build Nomad from source.
If you are interested in trialing Nomad without installing it locally, see the Quickstart for options to get started with Nomad.
Install the required packages.
Add the HashiCorp GPG key.
Add the official HashiCorp Linux repository.
Update and install.
Linux post-installation steps
These steps are optional but can be helpful for running Nomad and to take advantage of additional Nomad functionalities.
You need to run client agents as root (or with sudo
) so that cpuset accounting and network namespaces work correctly.
Install CNI reference plugins
Nomad uses CNI plugins to configure network namespaces when using the bridge
network mode. You must install the CNI plugins on all Linux Nomad client nodes
that use network namespaces. Refer to the CNI Plugins external
guide for details on individual plugins.
The following series of commands determines your operating system architecture,
downloads the CNI 1.5.1
release,
and then extracts the CNI plugin binaries into the /opt/cni/bin
directory.
Update the CNI_PLUGIN_VERSION
value to use a different release version.
Nomad looks for CNI plugin binaries by default in the /opt/cni/bin
directory.
However, you may install in the binaries in a different directory and then
configure using the cni_path
attribute.
Install consul-cni plugin
When you use the transparent_proxy
block for Consul service mesh,
you must also install the consul-cni
plugin on each client node for
Consul to properly redirect inbound and outbound traffic for services to the
Envoy proxy. For more information, refer to Enable the Consul CNI
plugin
in the Consul documentation.
You must install the CNI plugins before you install the Consul CNI plugin. The following commands assume that you already installed the CNI plugins.
Install the consul-cni
plugin on each client node.
Configure bridge network to route traffic through iptables
Nomad's task group networks integrate with Consul's service mesh using bridge networking and iptables to send traffic between containers.
Warning: New Linux versions, such as Ubuntu 24.04, may not enable bridge
networking by default. Use sudo modprobe bridge
to load the bridge module if
it is missing.
The Linux kernel bridge module has three tunable parameters that control whether iptables processes traffic crossing the bridge. Some operating systems, including RedHat, CentOS, and Fedora, might have iptables rules that are not correctly configured for guest traffic because these tunable parameters are optimized for VM workloads.
Ensure your Linux operating system distribution is configured to allow iptables to route container traffic through the bridge network. Run the following commands to set the tunable parameters to allow iptables processing for the bridge network.
To preserve these settings on startup of a client node, add a file to
/etc/sysctl.d/
or remove the file your Linux distribution puts in that
directory. The following example configures the tunable parameters for a client
node.
Verify cgroup controllers
On Linux, Nomad uses cgroups to control access to resources like CPU and memory.
Nomad supports both cgroups
v2 and the
legacy cgroups
v1.
When Nomad clients start, they determine the available cgroup controllers and
include the attribute os.cgroups.version
in their fingerprint.
On cgroups v2, you can run the following command to verify that you have all required controllers.
On legacy cgroups v1, this same list of required controllers appears as a series
of sub-directories under the directory /sys/fs/cgroup
.
Refer to the cgroup controller requirements for more details and to enable missing cgroups.
Verify the Installation
To verify Nomad was installed correctly, try the nomad
command.
You should see help output, similar to the following.
Compiling from Source
To compile from source, you will need Go installed at the
version described by the .go-version file. You should properly
configure your Go environment, including setting a GOPATH
environment variable
and ensuring GOPATH/bin
is within your PATH
. A copy of
git
is also needed in your PATH
.
Clone the Nomad repository from GitHub into your
GOPATH
:Bootstrap the project. This will download and compile libraries and tools needed to compile Nomad:
Build Nomad for your current system and put the binary in
./bin/
(relative to the git checkout). Themake dev
target is just a shortcut that buildsnomad
for only your local build environment (no cross-compiled targets).