With Vault installed, the next step is to start a Vault server.
Vault operates as a client/server application. The Vault server is the only piece of the Vault architecture that interacts with the data storage and backends. All operations done via the Vault CLI interact with the server over a TLS connection.
In this tutorial, you will start and interact with the Vault server running in development mode.
»Starting the Dev Server
First, start a Vault dev server. The dev server is a built-in, pre-configured server that is not very secure but useful for playing with Vault locally. Later in the Deploy Vault tutorial, you will configure and start a non-dev server.
To start the Vault dev server, run:
$ vault server -dev ==> Vault server configuration: Api Address: http://127.0.0.1:8200 Cgo: disabled Cluster Address: https://127.0.0.1:8201 Listener 1: tcp (addr: "127.0.0.1:8200", cluster address: "127.0.0.1:8201", max_request_duration: "1m30s", max_request_size: "33554432", tls: "disabled") Log Level: info Mlock: supported: false, enabled: false Recovery Mode: false Storage: inmem Version: Vault v1.4.1 WARNING! dev mode is enabled! In this mode, Vault runs entirely in-memory and starts unsealed with a single unseal key. The root token is already authenticated to the CLI, so you can immediately begin using Vault. You may need to set the following environment variable: $ export VAULT_ADDR='http://127.0.0.1:8200' The unseal key and root token are displayed below in case you want to seal/unseal the Vault or re-authenticate. Unseal Key: 1+yv+v5mz+aSCK67X6slL3ECxb4UDL8ujWZU/ONBpn0= Root Token: s.XmpNPoi9sRhYtdKHaQhkHP6x Development mode should NOT be used in production installations! ==> Vault server started! Log data will stream in below: # ...
You should see output similar to that above. Notice that Unseal Key and Root Token values are displayed.
The dev server stores all its data in-memory (but still encrypted), listens
localhost without TLS, and automatically unseals and shows you the unseal
key and root access key.
With the dev server started, perform the following:
Launch a new terminal session.
Copy and run the
export VAULT_ADDR ...command from the terminal output. This will configure the Vault client to talk to the dev server.
$ export VAULT_ADDR='http://127.0.0.1:8200'
Vault CLI determines which Vault servers to send requests using the
Save the unseal key somewhere. Don't worry about how to save this securely. For now, just save it anywhere.
VAULT_TOKENenvironment variable value to the generated Root Token value displayed in the terminal output.
$ export VAULT_TOKEN="s.XmpNPoi9sRhYtdKHaQhkHP6x"
To interact with Vault, you must provide a valid token. Setting this environment variable is a way to provide the token to Vault via CLI. Later, in the Authentication tutorial, you will learn to use the
vault login <token_value>command to authenticate with Vault.
»Verify the Server is Running
Verify the server is running by running the
vault status command. If it ran
successfully, the output should look like the following:
$ vault status Key Value --- ----- Seal Type shamir Initialized true Sealed false Total Shares 1 Threshold 1 Version 1.7.0 Storage Type inmem Cluster Name vault-cluster-4d862b44 Cluster ID 92143a5a-0566-be89-f229-5a9f9c47fb1a HA Enabled false
If the output looks different, restart the dev server and try again. The only reason these would ever be different is if you're running a dev server from going through this tutorial previously.
You will learn more about the status output in the Deploy Vault tutorial.
Congratulations! You've started your first Vault server.