Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install a Self-Hosted Bitwarden Server on Ubuntu

Run your own Bitwarden password manager on a VPS with Docker.

VPS and Cloud Servers2 min read17 screenshots
Bitwarden on Ubuntu

What you need

  • An Ubuntu VPS (2 GB of RAM or more).
  • A domain name that points to the IP address of the VPS (for HTTPS).
  • Ports 80 and 443 open.
  • An installation ID and key from Bitwarden (free, see step 7).

Step 1: Install the packages

sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
Installing the required packages

Step 2: Add the Docker GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Adding the Docker key

Step 3: Add the Docker repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Adding the Docker repository
sudo apt update
Updating the package list

Step 4: Install Docker Engine

sudo apt install docker-ce
Installing Docker
The Docker installation

Check that it runs:

sudo systemctl status docker
The Docker status

Step 5: Install Docker Compose

sudo apt install docker-compose -y
Installing Docker Compose

(You can also install the docker-compose-plugin package and use docker compose.)

Step 6: Create a user for Bitwarden

sudo useradd -G docker -s /bin/bash -m -d /opt/bitwarden bitwarden
Creating the bitwarden user

Set a password:

sudo passwd bitwarden
Setting the password

Step 7: Get an installation ID and key

Go to the Bitwarden website page for hosting (bitwarden.com/host). Enter your email address and choose the data region (US or EU).

Submitting the domain and email

Bitwarden shows an installation ID and an installation key. Copy both.

The installation ID and key

Step 8: Download the install script

Switch to the new user:

su - bitwarden

Download the official script:

curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh
Downloading the Bitwarden script

Make it executable:

chmod +x bitwarden.sh
Making the script executable

Step 9: Install and start Bitwarden

./bitwarden.sh install
Running the installer

The installer asks you for:

  • The domain name of your server.
  • Whether to use Let's Encrypt for a free certificate (answer y).
  • The database name (the default is fine).
  • The installation ID and installation key from step 7.
  • The data region (US or EU).
    Entering the details

Then start it:

./bitwarden.sh start

Step 10: Open the web vault

Go to https://your-domain.com in your browser. Create your account, and log in.

Set up email

Edit ~/bwdata/env/global.override.env with your SMTP details so that the server can send emails (for example for verification). Restart with ./bitwarden.sh restart.

Update

./bitwarden.sh updateself
./bitwarden.sh update
Tip: Back up the folder ~/bwdata on a regular basis.

Quick recap

  • Install Docker and Docker Compose.
  • Get an installation ID and key, then run ./bitwarden.sh install.
  • Open your domain and create your account.