Virtual Event
Join us for the next HashiConf Digital October 12-15, 2020 Register for Free


Vault Deployment Guide with Integrated Storage

You should also review and apply the recommendations provided in the Vault Production Hardening guide during the installation.

We recommend that the Vault service be deployed to more than one host to provide a highly-available, single cluster architecture as shown in the Vault with Integrated Storage Reference Architecture.

Reference Diagram

The following setup steps should be completed on all of the Vault hosts:

  1. Download Vault Binaries
  2. Install Vault
  3. Configure Vault Service
  4. Configure Vault Process
  5. Start Vault Service

»Step 1: Download Vault Binaries

Precompiled Vault OSS and Enterprise binaries are available for download at Find the appropriate package for your system an download it. Vault is packaged as a ZIP file.

You should perform checksum verification of the zip packages to validate your package using the SHA256SUMS and SHA256SUMS.sig files available for the specific release version. HashiCorp provides a guide on checksum verification for precompiled binaries.

First, export some environment variables to specify the Vault download base URL and preferred Vault version for convenience and concise commands. Then use curl to download the package and SHA256 summary files.

$ export VAULT_URL="" \
$ curl \
      --silent \
      --remote-name \

$ curl \
      --silent \
      --remote-name \

$ curl \
      --silent \
      --remote-name \

You should now have the 3 files present locally:

$ ls -1

»Step 2: Install Vault

Unzip the downloaded package, move the vault binary to /usr/local/bin/, and check that vault is available on the system path.

$ unzip vault_${VAULT_VERSION}
$ sudo chown root:root vault
$ sudo mv vault /usr/local/bin/
$ vault -version
Vault v1.4.0+ent

The vault command features opt-in autocompletion for flags, subcommands, and arguments (where supported).

$ vault -autocomplete-install
$ complete -C /usr/local/bin/vault vault

Give vault the ability to use the mlock syscall without running the process as root. The mlock syscall prevents memory from being swapped to disk.

$ sudo setcap cap_ipc_lock=+ep /usr/local/bin/vault

Create a unique, non-privileged system user to run vault.

$ sudo useradd --system --home /etc/vault.d --shell /bin/false vault

»Step 3: Configure Vault Service

Vault uses documented defaults so only non-default values should be set in the configuration file.

Create a configuration file at /etc/vault.d/vault.hcl:

$ sudo mkdir --parents /etc/vault.d
$ sudo touch /etc/vault.d/vault.hcl
$ sudo chown --recursive vault:vault /etc/vault.d
$ sudo chmod 640 /etc/vault.d/vault.hcl

»Listener stanza

The listener stanza configures the addresses and ports on which Vault will respond to requests.

Add the below configuration to the Vault configuration file:

listener "tcp" {
  address       = ""
  tls_cert_file = "/path/to/fullchain.pem"
  tls_key_file  = "/path/to/privkey.pem"

The following parameters are set for the tcp listener stanza:

  • address (string: "") - Changing from the loopback address to allow external access to the Vault UI
  • tls_cert_file (string: <required-if-enabled>, reloads-on-SIGHUP) - Must be set when using TLS
  • tls_key_file (string: <required-if-enabled>, reloads-on-SIGHUP) - Must be set when using TLS

More information about tcp listener configuration.

»Seal stanza

The seal stanza in the Vault configuration specifies the seal type to use for additional data protection such as using hardware security module (HSM) or Cloud KMS solutions to encrypt and decrypt the Vault master key to automatically unseal Vault. This stanza is optional, and if this is not configured, Vault will use the Shamir algorithm to cryptographically split the master key.

Review the seal configuration documentation for more detail.

An example PKCS #11 compatible HSM example is:

seal "pkcs11" {
  lib            = "/usr/vault/lib/"
  slot           = "0"
  pin            = "AAAA-BBBB-CCCC-DDDD"
  key_label      = "vault-hsm-key"
  hmac_key_label = "vault-hsm-hmac-key"

»Storage stanza

Vault will store state and its encrypted data to the configured directory in the storage stanza in the Vault configuration file. The path below is a sample and suggestion and can be changed to another location if necessary.

The following parameters are set for the raft storage stanza:

  • path - The file system path where all the Vault data gets stored
  • node_id - The identifier for the node in the Raft cluster

It is recommended that this directory be created as follows:

$ sudo mkdir /opt/raft
$ sudo chown -R vault:vault /opt/raft

Add the below configuration to the /etc/vault.d/vault.hcl file:

storage "raft" {
  path = "/opt/raft"
  node_id = "raft_node_1"

»Telemetry stanza

The telemetry stanza specifies various configurations for Vault to publish metrics to upstream systems.

If you decide to configure Vault to publish telemetry data, you should review the telemetry configuration section of our documentation.

»High Availability Parameters

The api_addr parameter configures the API address used in high availability scenarios, when client redirection is used instead of request forwarding. Client redirection is the fallback method used when request forwarding is turned off or there is an error performing the forwarding. As such, a redirect address is always required for all HA setups.

This parameter value defaults to the address specified in the listener stanza, but Vault will log a [WARN] message if it is not explicitly configured.

Add the below configuration to the Vault configuration file:

api_addr = "{{ full URL to Vault API endpoint }}"

More information about high availability configuration.

»Vault UI

Vault features a web-based user interface, allowing you to easily create, read, update, and delete secrets, authenticate, unseal, and more using a graphical user interface, rather than the CLI or API.

Vault should not be deployed in a public internet facing environment, so enabling the Vault UI is typically of benefit to provide a more familiar experience to administrators who are not as comfortable working on the command line, or who do not have alternative access.

Optionally, add the below configuration to the Vault configuration file to enable the Vault UI:

ui = true

More information about configuring the Vault UI.

»Step 4: Configure Vault Process

»Configure systemd

Systemd uses documented defaults so only non-default values must be set in the configuration file.

Create a Vault service file at /etc/systemd/system/vault.service.

$ sudo touch /etc/systemd/system/vault.service

Add the below configuration to the Vault service file:

Description="HashiCorp Vault - A tool for managing secrets"

CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
ExecStart=/usr/local/bin/vault server -config=/etc/vault.d/vault.hcl
ExecReload=/bin/kill --signal HUP $MAINPID


The following parameters are set for the [Unit] stanza:

  • Description - Free-form string describing the vault service
  • Documentation - Link to the vault documentation
  • Requires - Configure a requirement dependency on the network service
  • After - Configure an ordering dependency on the network service being started before the vault service
  • ConditionFileNotEmpty - Check for a non-zero sized configuration file before vault is started
  • StartLimitIntervalSec, StartLimitBurst - Limit vault to three start attempts in 60 seconds (support for systemd version 230+)

The following parameters are set for the [Service] stanza:

The following parameters are set for the [Install] stanza:

  • WantedBy - Creates a weak dependency on vault being started by the multi-user run level

»Step 5: Start Vault Service

Enable and start Vault using the systemctl command responsible for controlling systemd managed services. Check the status of the vault service using systemctl.

$ sudo systemctl enable vault
$ sudo systemctl start vault
$ sudo systemctl status vault

The Vault UI and API should be accessible and running once the above steps have been completed. Browse to and view the Vault UI to confirm success.

Once Vault is started on the leader node you will need to:

  1. Unseal Vault on leader
  2. Join followers to raft cluster by running the following command on each follower cluster instance you wish to join to Vault cluster
$ vault operator raft join https://<IP of Leader>:8200

Key       Value
---       -----
Joined    true

»Help and Reference