Installing Vaultwarden on your VPS

vaultwarden logo

It’s pretty simple. Seriously.

Alright. You have finally chosen to self-host. And you realize that you’ll never have pay for a secure password manager again now that you’ve discovered Vaultwarden. All you need now is an easy-breezy install guide.

Well lucky you! Here it is. Let’s get started installing Vaultwarden on your VPS. You’ll be living the self-hoster’s dream in no time. A quick explanation from Vaultwarden’s README:

Vaultwarden—An alternative server implementation of the Bitwarden Client API, written in Rust and compatible with official Bitwarden clients [disclaimer], perfect for self-hosted deployment where running the official resource-heavy service might not be ideal.


So there you have it. When this install is done, you’ll have your own self-hosted install, and you’ll be able to point to it via the Bitwarden mobile app. Double win.

Ok, so first, log into your VPS. If you’re logging in as root, remove the sudo part from the commands. Install the following dependency:

Argon2 is a rock-solid password hashing algorithm. We want it for the install. Give it a moment to install. See the next steps just below.

Just fyi, if you want to do the install elsewhere on your server, feel free. I’m just doing it from $HOME since it’s convenient and easy to follow.

Configuring our docker-compose.yml

Now that we’re in our install directory, let’s vim into a docker-compose.yml with the following command:

Paste the following:

You might be asking “why on earth is SIGNUPS_ALLOWED set to false?” Well, the reason lies in the ADMIN_TOKEN value. That token will allow you admin access at /admin, and inside you can invite users to create an account. This is the way to go to keep weirdos from flat-out creating accounts.

Let’s create that token, shall we?

Copy the hashed value that shows. Now let’s create the .env file so our docker-compose.yml knows where to find the ADMIN_TOKEN.

Then add the following into the .env (and yes, the quotes are needed!):

With that, Docker runtime configurations are complete. Let’s move along.

If you remember in the docker-compose.yml above, we’re serving container port 80 to host port 9273 with the - "9273:80" configuration. In Nginx, we now need to set up a reverse proxy that will serve host port 9273 to our url. We also need to tell Nginx where to find ssl certificates for the site, so that you can serve it over https correctly. Let’s go.


For now, paste the following:

Heads-up: you’ll notice above that I’m pointing to the snakeoil temporary ssl certificates. This is strictly to pass the nginx -t config test later. You’ll need to change this out later with your actual certs. Otherwise, if you’re using Certbot, the cert paths will be overwritten automatically. I talk about how to set up certifications via Certbot in this post.

Next, we need to create our symbolic link between sites-available and sites-enabled in Nginx.

The nginx -t command should return a successful result. If it doesn’t, go back and fix your shit bro. Otherwise, let’s reload Nginx:

You should still be in your working directory that contains your .env and docker-compose.yml file. Confirm with a quick pwd and/or ls -lart. At this point, we can turn on Vaultwarden, finally!

In a browser, head to https://vault.yourdomain.here/admin. Enter the ADMIN_TOKEN value (not the hash value damnit!), and log in.

All Systems Go! …Right?

After logging into /admin, click on “Diagnostics”. You should see all-green indicators like the ones in the image below.

An image from the diagnostics tab of the admin panel that shows the results of a successful install.
Diagnostic results of a successful install

After confirming, you can head to the “Users” section, where you can invite users (including yourself duh) to create an account via email.

Conclusion

We’ve been through a lot together, I know. And in the end, installing Vaultwarden on your VPS really is simple. Now go forth, and never pay for a password manager again!