# Install Bitwarden on Linux

By
Adrien

# System Specification

Recommanded
Processor 2 vCore
Memory 4GB RAM
Storage 10Go (minimum)
Docker Engine 19+ and Compose 1.24+

# Steps to follow

  1. Configure DNS and open port 80 / 443
  2. Install Docker & Docker Compose

Install Docker and Docker Compose
../ubuntu-docker/

  1. Create a Bitwarden user
adduser bitwarden
passwd bitwarden
groupadd docker
usermod -aG docker bitwarden
mkdir /opt/bitwarden
chmod -R 700 /opt/bitwarden
chown -R bitwarden:bitwarden /opt/bitwarden
su - bitwarden
cd /opt/bitwarden
  1. Install Bitwarden
curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh && chmod 700 bitwarden.sh
./bitwarden.sh install

To get installation ID and installation KEY : https://bitwarden.com/host/

  1. Configure environment variables

Edit ./bwdata/env/global.override.env

globalSettings__mail__smtp__host=**placeholder** # smtp.gmail.com
globalSettings__mail__smtp__port=**placeholder** # 587
globalSettings__mail__smtp__ssl=**placeholder**
globalSettings__mail__smtp__username=**placeholder**
globalSettings__mail__smtp__password=**placeholder**
...
adminSettings__admins=**placeholder** # email for admin account

How to use Gmail as SMTP mail server
https://bitwarden.com/help/hosting-faqs/#q-how-do-i-use-gmail-as-an-smtp-mail-server

Then

./bitwarden.sh restart
  1. Update installation files

Edit ./bwdata/config.yml as needed and then rebuild

./bitwarden.sh rebuild
  1. Start bitwarden
./bitwarden.sh start
  1. Startup option

Set PVE option : "start at boot" to yes, "order" to 2

# About data

All Bitwarden data is stored on the host machine in the ./bwdata directory, relative to the location in which you installed Bitwarden. It's recommended that you backup and keep safe the entire ./bwdata directory.

# Nightly Database Backups

Bitwarden will automatically take nightly backups of the mssql container database. These backups are kept in the ./bwdata/mssql/backups directory for 30 days.

# Restore a backup

Restore a nightly backup
https://bitwarden.com/help/backup-on-premise/#restore-a-nightly-backup