How to Self-Host Vaultwarden on a VPS (Complete Guide)
Vaultwarden is a popular self-hosted password manager based on Bitwardenโs server architecture. It allows you to manage and secure your passwords on your own server, giving you complete control over your data. In this guide, we will go through the process of installing Vaultwarden on a Virtual Private Server (VPS) using Docker.
Choosing a VPS Provider
To get started, you will need to select a VPS provider. Below is a comparison of recommended VPS providers based on affordability and performance:
| Provider | Monthly Cost | RAM Size | Disk Space | Location Options |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR | 4 GB | 300 GB SSD | Europe |
| Hetzner Cloud | 4.15 EUR | 4 GB | 20 GB SSD | Europe |
| DigitalOcean | 6 USD | 1 GB | 25 GB SSD | Global |
| Vultr | 6 USD | 1 GB | 25 GB SSD | Global |
| Linode | 5 USD | 1 GB | 25 GB SSD | Global |
You can start with providers like Hetzner Cloud or Contabo for budget options. For a full VPS comparison, check out our full VPS comparison.
Prerequisites
- VPS Instance: Create a VPS instance running a Linux distribution such as Ubuntu 20.04 or later.
- Domain Name: Itโs highly recommended to have a domain name pointing to your VPS for secure HTTPS connections.
- Basic Knowledge of Linux: Familiarity with command-line usage and Docker.
Step 1: Connect to Your VPS
Once your VPS is set up, connect to it via SSH:
ssh root@your-vps-ip
Replace your-vps-ip with your actual VPS IP address.
Step 2: Install Docker and Docker Compose
Youโll need Docker to run Vaultwarden in a container. Execute the commands below to install Docker and Docker Compose:
apt update
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install -y docker-ce
apt install -y docker-compose
Check if Docker is running:
systemctl status docker
Step 3: Create a Vaultwarden Directory
Create a directory for Vaultwarden files:
mkdir ~/vaultwarden
cd ~/vaultwarden
Step 4: Create a Docker Compose File
Create a docker-compose.yml file in the ~/vaultwarden directory:
version: '3'
services:
vaultwarden:
image: vaultwarden/server:latest
restart: always
environment:
- WEBSOCKET_ENABLED=true
volumes:
- ./vw-data:/data
ports:
- "80:80"
This file defines our Vaultwarden service with the necessary configurations.
Step 5: Start Vaultwarden
Run the following command to start Vaultwarden:
docker-compose up -d
You can check if the container is running:
docker ps
Step 6: Configure Your Domain Name
To access Vaultwarden using your domain, configure your DNS records to point your domain to the VPS IP. Use an A record for this purpose. Obtain an SSL certificate to ensure encrypted connections. A simple way is using Letโs Encrypt with Certbot.
Install Certbot with the following commands:
apt install certbot
Then, run Certbot:
certbot --nginx -d your-domain.com
Follow the prompts to complete the SSL setup.
Step 7: Access Vaultwarden
Now that you have successfully installed Vaultwarden, access it via your browser by navigating to https://your-domain.com.
Frequently Asked Questions
1. What are the system requirements to self-host Vaultwarden?
Vaultwarden does not require extensive resources. A basic VPS with at least 1 GB of RAM and 25 GB of SSD storage is sufficient for home use. If you plan to manage multiple users or larger vaults, consider a VPS with 2 GB of RAM or more for better performance. Most budget providers like Hetzner or Contabo meet these requirements.
2. How do I back up my Vaultwarden data?
Backing up your Vaultwarden data is crucial. You can achieve this by regularly backing up the vw-data directory, where all your vault data is stored. Use the following command to create a backup:
tar -cvzf vaultwarden-backup.tar.gz ~/vaultwarden/vw-data
Additionally, some users may opt to automate backups and store them in external storage solutions. Itโs also wise to review any built-in backup features provided by Vaultwarden.
3. Can I use Vaultwarden with multiple users?
Yes, Vaultwarden supports multiple users. You can invite other users to your vault by providing them access to your server credentials. Keep in mind that each user will need to manage their own account setup and configurations. You can also manage user authentication and permissions directly through the Vaultwarden interface.
By following these steps, you can efficiently self-host Vaultwarden on your VPS, ensuring that your password management solution is secure, private, and under your control.