Creating The Necessary Directory

The first thing we need to do before installing Bitwarden is configure our Environment Variables file. This file will tell Bitwarden how we want it to run.

We need to create a directory to house Bitwarden, and we need to create that directory in our Containers directory we created earlier.

To make sure you're there, you can enter this line in your Command Line Interface.

cd ~/containers

From your containers file, make a directory called bitwarden.

mkdir ./bitwarden

Configuring Bitwarden Unified Environment Variables

Now let's create our file.

nano ./bitwarden/settings.env

As you'd expect, this will be a blank text file.

Take the entire code block below and paste it into this file. Here are the changes you need to make.

  1. Line 6. Change quailavocadotoast.com to your domain.
  2. Line 12. Insert the name of your database from the docker-compose.yml file.
  3. Line 13. Insert the user name for your database from the docker-compose.yml file.
  4. Line 14. Insert the password for your database user name from the docker-compose.yml file.
  5. Go to https://bitwarden.com/host/ in a new browser tab. Enter your email and you'll get an installation id and key.
  6. Line 18. Replace insertyourid with the installation ID from Step 5.
  7. Line 19. Replace insertyourkey with the installation key from Step 5.
  8. Line 55. Replace quailavocadotoast.com with your domain. Keep the no-reply at the beginning.
  9. Line 56. Replace quailavocadotoast.com with your domain.
  10. Line 70. Replace your_email_address with your email address.
  11. The line: BW_ENABLE_NOTIFICATIONS is optional, but recommended if you want to use Bitwarden on your mobile device. If you don't plan on using mobile, you can comment this line out.

For more information on setting up Environment Variables for Bitwarden Unified you can visit:

Bitwarden's Official Instructions For Installing Bitwarden Unified

Bitwarden's GitHub Example of settings.env

#####################
# Required Settings #
#####################

# Server hostname
BW_DOMAIN=quailavocadotoast.com

# Database
# Available providers are sqlserver, postgresql, mysql/mariadb, or sqlite
BW_DB_PROVIDER=mysql
BW_DB_SERVER=db
BW_DB_DATABASE=insertadatabasename
BW_DB_USERNAME=insertausername
BW_DB_PASSWORD=insertapassword

# Installation information
# Get your ID and key from https://bitwarden.com/host/
BW_INSTALLATION_ID=insertyourid
BW_INSTALLATION_KEY=insertyourkey

#####################
# Optional Settings #
#####################
# Learn more here: https://bitwarden.com/help/environment-variables/

# Container UID/GID
#UID=1000
#GID=1000

# Webserver ports
#BW_PORT_HTTP=8080
#BW_PORT_HTTPS=8443

# SSL
#BW_ENABLE_SSL=true
#BW_ENABLE_SSL_CA=true
#BW_SSL_CERT=ssl.crt
#BW_SSL_KEY=ssl.key
#BW_SSL_CA_CERT=ca.crt

# Services
# Some services, namely for enterprise use cases, are disabled by default. Defaults shown below.
BW_ENABLE_ADMIN=true
BW_ENABLE_API=true
#BW_ENABLE_EVENTS=false
#BW_ENABLE_ICONS=true
BW_ENABLE_IDENTITY=true
BW_ENABLE_NOTIFICATIONS=true
#BW_ENABLE_SCIM=false
#BW_ENABLE_SSO=false

#BW_ICONS_PROXY_TO_CLOUD=false

# Mail
globalSettings__mail__replyToEmail=no-reply@quailavocadotoast.com
globalSettings__mail__smtp__host=quailavocadotoast.com
globalSettings__mail__smtp__port=587
#globalSettings__mail__smtp__ssl=false
#globalSettings__mail__smtp__username=smtpusername
#globalSettings__mail__smtp__password=smtppassword
globalSettings__mail__smtp__trustServer=true

# Yubikey
#globalSettings__yubico__clientId=REPLACE
#globalSettings__yubico__key=REPLACE

# Other
globalSettings__disableUserRegistration=false
#globalSettings__hibpApiKey=REPLACE
adminSettings__admins="your_email_address"

Save and exit this file.
We're ready to install Bitwarden. Onwards!

by: