Skip to main content
Home/Blog/Install Vault CLI: HashiCorp Vault on Windows, Mac, Linux
Secrets Management

Install Vault CLI: HashiCorp Vault on Windows, Mac, Linux

Copy-paste commands to install HashiCorp Vault CLI and GUI on Windows, macOS, and Linux. Verified 2026 setup guide with security best practices included.

Install Vault CLI: HashiCorp Vault on Windows, Mac, Linux

Complete step-by-step installation guide for HashiCorp Vault CLI and GUI client setup on Windows, macOS, and Linux In today's digital landscape, securing sensitive data like API keys, passwords, and encryption keys is more critical than ever. HashiCorp Vault is a powerful secrets management tool designed to securely store and access secrets, ensuring that sensitive information is protected from unauthorized access. This comprehensive guide will walk you through the installation of the HashiCorp Vault CLI and show you how to set up a GUI client for easier management. Whether you're a system administrator or developer, you'll learn everything needed to get Vault running securely. 💡 What You'll Learn: Install Vault CLI on all major operating systems, verify installation, set up GUI clients, configure authentication, and implement security best practices.

Prerequisites

Before installing HashiCorp Vault's CLI or setting up a GUI client, ensure your system meets the following requirements.

System Requirements

  • Windows: Windows 10 or later
  • macOS: macOS 10.15 (Catalina) or later
  • Linux: Ubuntu 18.04+, CentOS 7+, or any major Linux distribution

Required Software & Dependencies

  • Admin or root access to install software and modify system paths
  • A terminal or command prompt (PowerShell for Windows, Terminal for macOS/Linux)
  • A web browser (if using a GUI client)
  • Docker (Optional) if you prefer running the Vault GUI via a container

Installing the Vault CLI

HashiCorp Vault's Command Line Interface (CLI) allows users to interact with the Vault server, manage secrets, configure authentication, and perform administrative tasks. Follow the installation steps for your operating system below.

Installing Vault CLI on macOS

  1. Open the terminal and run:
brew tap hashicorp/tap
brew install hashicorp/tap/vault
  1. Verify the installation:
vault -v

This should return the installed Vault version.

Manual Installation

  • Download the latest macOS binary from the official Vault download page
  • Extract the downloaded ZIP file
  • Move the binary to /usr/local/bin/:
sudo mv vault /usr/local/bin/

Installing Vault CLI on Windows

  1. Open PowerShell as an administrator and run:
choco install vault
  1. Verify the installation:
vault -v

Installing Vault CLI on Linux

Using a Package Manager (Ubuntu/Debian)

Run the following commands:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt update && sudo apt install vault

Verifying the Installation

After installing the Vault CLI, it's important to verify that everything is set up correctly before proceeding with further configurations.

Check the Installed Version

To ensure Vault was installed successfully, open a terminal or command prompt and run:

vault -v

This should return output similar to: Vault v1.x.x (latest version) ⚠️ Troubleshooting: If this command does not work, ensure that Vault is correctly added to your system's PATH environment variable.

Start the Vault Development Server

To quickly check if Vault runs correctly, start a development server:

vault server -dev

You should see output indicating that Vault is running in development mode. The server will also display a Root Token, which is needed for authentication.

Installing a GUI Client

While the Vault CLI provides powerful functionality, a Graphical User Interface (GUI) client offers a more user-friendly way to interact with HashiCorp Vault, especially for those who prefer visual management of secrets, policies, and authentication settings.

HashiCorp provides an official web-based UI that is included with Vault. To enable it, follow these steps:

Step 1: Start Vault with the UI Enabled

Run the following command to launch Vault with the web UI:

vault server -dev -dev-ui

The output should indicate that the UI is enabled and accessible at: http://127.0.0.1:8200/ui

Step 2: Access the Web UI

  • Open a web browser and go to http://127.0.0.1:8200/ui
  • Log in using the Root Token displayed when starting the Vault development server
  • Once logged in, you'll see the Vault dashboard where you can manage secrets, policies, and authentication settings 💡 Pro Tip: You can also run Vault UI via Docker for containerized environments. This is useful for development and testing scenarios.

Security Best Practices

HashiCorp Vault is designed to secure sensitive data, but improper configuration can leave it vulnerable. Follow these best practices to enhance security and minimize risks. ⚠️ Critical: The -dev mode is convenient for testing but should NEVER be used in production. Always run Vault in server mode with proper configurations for production environments.

Enable TLS Encryption

By default, Vault runs over HTTP, which is insecure. To enable HTTPS:

  • Obtain an SSL certificate (self-signed or from a trusted CA)
  • Modify the Vault configuration file (config.hcl)
  • Restart Vault to apply the changes

Enable Audit Logging

To track access and changes in Vault:

vault audit enable file path=/var/log/vault_audit.log

This helps detect unauthorized access attempts and maintain compliance.


Production Deployment Architecture

Production Vault deployments require careful planning around high availability, storage backends, and security configurations. Never use -dev mode in production.

A production-ready Vault deployment typically includes:

  • 3-5 Vault nodes for high availability (odd number for consensus)
  • Integrated Raft storage or external storage backend
  • Load balancer for client traffic distribution
  • TLS certificates from a trusted Certificate Authority
  • Auto-unseal using cloud KMS or HSM

Vault Configuration File (config.hcl)

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

# Storage Backend - Integrated Raft (Recommended)
storage "raft" {
  path    = "/opt/vault/data"
  node_id = "vault-node-1"

  retry_join {
    leader_api_addr = "https://vault-node-2.example.com:8200"
  }
  retry_join {
    leader_api_addr = "https://vault-node-3.example.com:8200"
  }
}

# Listener Configuration with TLS
listener "tcp" {
  address       = "0.0.0.0:8200"
  cluster_address = "0.0.0.0:8201"
  tls_cert_file = "/opt/vault/tls/vault-cert.pem"
  tls_key_file  = "/opt/vault/tls/vault-key.pem"
}

# API Address (for client communication)
api_addr = "https://vault-node-1.example.com:8200"
cluster_addr = "https://vault-node-1.example.com:8201"

# UI Configuration
ui = true

# Telemetry (Optional - for monitoring)
telemetry {
  prometheus_retention_time = "30s"
  disable_hostname          = true
}

Alternative Storage Backends

Consul Storage (for existing Consul infrastructure):

storage "consul" {
  address = "127.0.0.1:8500"
  path    = "vault/"
  token   = "consul-acl-token"

  # TLS to Consul
  tls_ca_file   = "/opt/vault/tls/consul-ca.pem"
  tls_cert_file = "/opt/vault/tls/consul-cert.pem"
  tls_key_file  = "/opt/vault/tls/consul-key.pem"
}

PostgreSQL Storage (for database-backed storage):

storage "postgresql" {
  connection_url = "postgres://vault:password@db.example.com:5432/vault?sslmode=verify-full"
  table          = "vault_kv_store"
  ha_enabled     = true
  ha_table       = "vault_ha_locks"
}

Amazon S3 with DynamoDB (AWS-native):

storage "s3" {
  bucket     = "my-vault-bucket"
  region     = "us-east-1"
  access_key = "AWS_ACCESS_KEY"  # Or use IAM role
  secret_key = "AWS_SECRET_KEY"
}

ha_storage "dynamodb" {
  ha_enabled = "true"
  region     = "us-east-1"
  table      = "vault-ha-table"
}

Starting Vault in Production

# Create systemd service file
sudo cat > /etc/systemd/system/vault.service << 'EOF'
[Unit]
Description=HashiCorp Vault
Documentation=https://www.vaultproject.io/docs/
Requires=network-online.target
After=network-online.target

[Service]
User=vault
Group=vault
ExecStart=/usr/bin/vault server -config=/etc/vault.d/vault.hcl
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGINT
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
LimitMEMLOCK=infinity

[Install]
WantedBy=multi-user.target
EOF

# Enable and start service
sudo systemctl enable vault
sudo systemctl start vault

# Check status
sudo systemctl status vault

Auto-Unseal Configuration

By default, Vault starts in a sealed state and requires manual unsealing with Shamir key shares. Auto-unseal delegates the unsealing process to a trusted cloud KMS or HSM, enabling automatic recovery after restarts.

AWS KMS Auto-Unseal

Add to your vault.hcl:

seal "awskms" {
  region     = "us-east-1"
  kms_key_id = "alias/vault-unseal-key"  # Or ARN

  # Optional: Use specific credentials (default uses instance profile)
  # access_key = "AWS_ACCESS_KEY"
  # secret_key = "AWS_SECRET_KEY"
}

AWS IAM Policy (minimum required permissions):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:DescribeKey"
      ],
      "Resource": "arn:aws:kms:us-east-1:123456789012:key/your-key-id"
    }
  ]
}

Azure Key Vault Auto-Unseal

seal "azurekeyvault" {
  tenant_id      = "your-tenant-id"
  client_id      = "your-client-id"
  client_secret  = "your-client-secret"  # Or use managed identity
  vault_name     = "vault-unseal-keyvault"
  key_name       = "vault-unseal-key"
}

Azure Managed Identity (recommended for Azure VMs):

seal "azurekeyvault" {
  vault_name = "vault-unseal-keyvault"
  key_name   = "vault-unseal-key"
  # No credentials needed - uses VM managed identity
}

Google Cloud KMS Auto-Unseal

seal "gcpckms" {
  project     = "my-project"
  region      = "global"
  key_ring    = "vault-keyring"
  crypto_key  = "vault-unseal-key"

  # Optional: Use specific credentials (default uses instance metadata)
  # credentials = "/path/to/service-account.json"
}

GCP IAM Role (minimum required):

  • roles/cloudkms.cryptoKeyEncrypterDecrypter

HSM Auto-Unseal (PKCS#11)

For on-premises HSM devices:

seal "pkcs11" {
  lib            = "/usr/lib/softhsm/libsofthsm2.so"
  slot           = "0"
  pin            = "your-hsm-pin"
  key_label      = "vault-unseal-key"
  hmac_key_label = "vault-hmac-key"
}

Migration from Shamir to Auto-Unseal

To migrate an existing Vault from Shamir keys to auto-unseal:

# 1. Add seal configuration to vault.hcl

# 2. Stop Vault
sudo systemctl stop vault

# 3. Start migration (requires existing unseal keys)
vault operator unseal -migrate

# 4. Enter existing Shamir key shares when prompted
# Repeat for threshold number of keys

# 5. Verify seal type changed
vault status

High Availability Setup

Vault supports active/standby high availability where one node handles all requests while standby nodes maintain warm copies of the data.

HA Architecture with Raft

With integrated Raft storage, HA is built-in:

                    ┌─────────────────┐
                    │  Load Balancer  │
                    │   (TCP/443)     │
                    └────────┬────────┘
                             │
        ┌────────────────────┼────────────────────┐
        │                    │                    │
        ▼                    ▼                    ▼
┌───────────────┐    ┌───────────────┐    ┌───────────────┐
│   Vault-1     │    │   Vault-2     │    │   Vault-3     │
│   (Leader)    │◄──►│  (Standby)    │◄──►│  (Standby)    │
│               │    │               │    │               │
│  Port: 8200   │    │  Port: 8200   │    │  Port: 8200   │
│  Cluster:8201 │    │  Cluster:8201 │    │  Cluster:8201 │
└───────────────┘    └───────────────┘    └───────────────┘

Health Check Endpoints

Configure your load balancer to use Vault's health endpoints:

EndpointUse CaseResponse
/v1/sys/healthGeneral health check200 if active, 429 if standby
/v1/sys/health?standbyok=trueInclude standbys200 for active or standby
/v1/sys/health?sealedcode=200Check sealed statusCustom response codes

Example Health Check Configuration (HAProxy):

frontend vault_frontend
    bind *:443 ssl crt /etc/haproxy/certs/vault.pem
    default_backend vault_backend

backend vault_backend
    balance roundrobin
    option httpchk GET /v1/sys/health?standbyok=true
    http-check expect status 200

    server vault-1 vault-1.example.com:8200 check ssl verify required ca-file /etc/haproxy/certs/ca.pem
    server vault-2 vault-2.example.com:8200 check ssl verify required ca-file /etc/haproxy/certs/ca.pem
    server vault-3 vault-3.example.com:8200 check ssl verify required ca-file /etc/haproxy/certs/ca.pem

Example Health Check (NGINX):

upstream vault_cluster {
    server vault-1.example.com:8200 max_fails=3 fail_timeout=30s;
    server vault-2.example.com:8200 max_fails=3 fail_timeout=30s;
    server vault-3.example.com:8200 max_fails=3 fail_timeout=30s;
}

server {
    listen 443 ssl;
    server_name vault.example.com;

    ssl_certificate /etc/nginx/certs/vault.crt;
    ssl_certificate_key /etc/nginx/certs/vault.key;

    location / {
        proxy_pass https://vault_cluster;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Checking Cluster Status

# Check cluster members
vault operator raft list-peers

# View leader information
vault status

# Force leadership transfer (planned maintenance)
vault operator step-down

Disaster Recovery Considerations

For production deployments, implement disaster recovery:

# Enable DR replication (Enterprise only)
vault write -f sys/replication/dr/primary/enable

# Get secondary activation token
vault write sys/replication/dr/primary/secondary-token id="dr-secondary"

# On secondary cluster
vault write sys/replication/dr/secondary/enable token="..."

For open-source Vault, use Raft snapshots for disaster recovery:

# Create snapshot
vault operator raft snapshot save backup.snap

# Restore snapshot (on new cluster)
vault operator raft snapshot restore backup.snap

Elevate Your IT Efficiency with Expert Solutions

Transform Your Technology, Propel Your Business

Ready to implement HashiCorp Vault securely? InventiveHQ specializes in cybersecurity implementations and can help you deploy Vault with enterprise-grade security configurations, monitoring, and best practices. Explore Our Services

Frequently Asked Questions

Find answers to common questions

Install Vault on macOS using Homebrew: run 'brew tap hashicorp/tap' followed by 'brew install hashicorp/tap/vault'. Verify installation with 'vault -v'. Alternatively, download the binary from HashiCorp's website and move it to /usr/local/bin/.

Install Vault on Windows using Chocolatey: run 'choco install vault' in an administrator PowerShell window. Verify with 'vault -v'. You can also download the Windows binary from HashiCorp's website and add it to your PATH.

On Ubuntu/Debian, add the HashiCorp repository with 'curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -' and 'sudo apt-add-repository deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main', then run 'sudo apt update && sudo apt install vault'.

Run 'vault -v' in your terminal to verify installation. This displays the installed version. To test functionality, run 'vault server -dev' to start a development server, which will display a root token for authentication.

The Vault Web UI is a browser-based interface for managing secrets, policies, and authentication. Start it with 'vault server -dev -dev-ui' and access it at http://127.0.0.1:8200/ui. Log in using the root token displayed in your terminal.

Never use dev mode (-dev flag) in production. Dev mode stores data in memory, uses HTTP instead of HTTPS, and automatically unseals with a known key. Production deployments require proper configuration with TLS, persistent storage, and secure unsealing.

Configure TLS in your Vault config.hcl file by specifying tls_cert_file and tls_key_file paths under the listener stanza. Obtain certificates from a trusted CA or generate self-signed certificates for testing. Restart Vault to apply changes.

Enable file-based audit logging with 'vault audit enable file file_path=/var/log/vault_audit.log'. This logs all Vault operations in JSON format, essential for security monitoring, compliance, and troubleshooting.

Vault runs on Windows 10+, macOS 10.15+, and most Linux distributions (Ubuntu 18.04+, CentOS 7+). It requires minimal resources for dev mode but production deployments need adequate CPU, memory, and fast storage for the backend.

Yes, run Vault in Docker with 'docker run -d --cap-add=IPC_LOCK -p 8200:8200 hashicorp/vault'. The IPC_LOCK capability prevents sensitive data from being swapped to disk. Use docker-compose for more complex configurations.

Secrets Sprawl Is a Breach Waiting to Happen

Hardcoded credentials, leaked API keys, and exposed tokens cause breaches. Our team implements enterprise secrets management.