Run Vault as a service
Instead of starting your Vault server manually from the command line, you can configure a service to start Vault automatically.
Before you start
- You must install Vault. You can use a package manager or install a binary manually.
Step 1: Create a new service
Example tested on Ubuntu 22.04
The following service definition is a simpler version of the vault.service
example in the Vault GitHub repo: vault/.release/linux/package/usr/lib/systemd/system/vault.service
Set the
VAULT_CONFIG
environment variable to your Vault configuration directory. The default configuration directory is/etc/vault.d
:Confirm the path to your Vault binary: $ VAULT_BINARY=$(which vault)
Create a
systemd
service calledvault.service
that uses the Vault binary:Change the permissions on
/lib/systemd/system/vault.service
to644
:
Step 2: Start the new service
Reload the
systemd
configuration:Start the Vault service:
Verify the service status:
Step 3: Verify the service is running
To confirm the service is running and your Vault service is available, open the Vault GUI in a browser at the default address: http://localhost:8200
Related tutorials
The following tutorials provide additional guidance for installing Vault and production cluster deployment: