Install Bitwarden Password Manager on Ubuntu 20.04

|
Last Updated:
|
|

In this tutorial, you will learn how to install Bitwarden password manager on Ubuntu 20.04. Bitwarden is an “open-source password manager which provides an easiest and safest way for individuals to store, share and secure sensitive data”. Bitwarden is available for individual and organizational use in both free and paid plans. In this tutorial, we will be learning how to install and setup free version of Bitwarden on Ubuntu 20.04 for individual use.

Installing Bitwarden Password Manager on Ubuntu

In order to install Bitwarden on Ubuntu 20.04;

Minimum System Requirements

Before you can install Bitwarden password manager, below are the minimum recommended system requirements that your system should meet;

  • Processor: x64, 2 GHz dual core
  • Memory: 4 GB RAM (system memory)
  • Storage: 25 GB
  • Docker: Engine 19+ and Compose 1.24+

Run System Update

Ensure that your system package cache is up-to-date.

apt update

Set System Domain Name

Bitwarden requires a system domain name while being installed. Therefore, set your system FQDN as follows. Be sure to replace the domain accordingly.

hostnamectl set-hostname bitwarden.kifarunix-demo.com

Install Docker and Docker Compose on Ubuntu 20.04

Bitwarden is deployed using Docker containers through the use of Docker compose. In this tutorial, we are using the community Docker edition. Follow the links below to install both Docker and Docker compose on Ubuntu 20.04.

Install Docker CE on Ubuntu 20.04

Install Docker Compose on Ubuntu 20.04

Installing Bitwarden Password Manager

Once the above procedures are done, you can now install Bitwarden password manager.

Obtain Bitwarden Hosting Installation ID and Key

Navigate to Bitwarden hosting page and provide your email ID to get the hosting installation ID and key.

Once you enter your email ID, click submit. Such a page is loaded.

bitwarden install host id key

Keep the installation ID and Key as we will need it later in the installation.

Download Bitwarden Installation Script

Run the command below to download the Bitwarden installation script.

apt install curl
curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh

Make the script executable;

chmod +x bitwarden.sh

Next, install Bitwarden password manager;

./bitwarden.sh install

Enter your system hostname;

 _     _ _                         _            
| |__ (_) |___      ____ _ _ __ __| | ___ _ __  
| '_ \| | __\ \ /\ / / _` | '__/ _` |/ _ \ '_ \ 
| |_) | | |_ \ V  V / (_| | | | (_| |  __/ | | |
|_.__/|_|\__| \_/\_/ \__,_|_|  \__,_|\___|_| |_|

Open source password management solutions
Copyright 2015-2020, 8bit Solutions LLC
https://bitwarden.com, https://github.com/bitwarden

===================================================

Docker version 19.03.12, build 48a66213fe
docker-compose version 1.27.2, build 18f557f9

(!) Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com): bitwarden.kifarunix-demo.com

Choose whether you want to use Let’s Encrypt to generate a free SSL certificate. In our case, this is a local setup and hence, we chose no.

(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): n

The script will then proceed to pull Bitwarden containers.

Once the container download is done, you are prompted to enter the hosting installation id and key you obtained from the Bitwarden hosting page.

...
Digest: sha256:d53aa2bc97c9bfdb5609cf9ec7cbee8cfedac536a7b101e039db2e0d733c60e0
Status: Downloaded newer image for bitwarden/setup:1.37.0
docker.io/bitwarden/setup:1.37.0

(!) Enter your installation id (get at https://bitwarden.com/host): 23b..............................2fb40d

(!) Enter your installation key: 6trsD........................g85

Next, if you have an SSL certificate, say yes otherwise, say no and generate self signed one;

...
(!) Do you have a SSL certificate to use? (y/n): n

(!) Do you want to generate a self-signed SSL certificate? (y/n): y

The self signed SSL cert is generated with such a warning;

!!!!!!!!!! WARNING !!!!!!!!!!
You are using an untrusted SSL certificate. This certificate will not be 
trusted by Bitwarden client applications. You must add this certificate to 
the trusted store on each device or else you will receive errors when trying 
to connect to your installation.

And the installation of Bitwarden on Ubuntu 20.04 is now done;

Building nginx config.
Building docker environment files.
Building docker environment override files.
Building FIDO U2F app id.
Building docker-compose.yml.

Installation complete

If you need to make additional configuration changes, you can modify
the settings in `./bwdata/config.yml` and then run:
`./bitwarden.sh rebuild` or `./bitwarden.sh update`

Next steps, run:
`./bitwarden.sh start`

Running Bitwarden Password Manager

You can now start Bitwarden Docker containers;

./bitwarden.sh start
...
Creating bitwarden-web           ... done
Creating bitwarden-icons         ... done
Creating bitwarden-events        ... done
Creating bitwarden-attachments   ... done
Creating bitwarden-api           ... done
Creating bitwarden-identity      ... done
Creating bitwarden-sso           ... done
Creating bitwarden-notifications ... done
Creating bitwarden-mssql         ... done
Creating bitwarden-admin         ... done
Creating bitwarden-portal        ... done
Creating bitwarden-nginx         ... done
1.37.0: Pulling from bitwarden/setup
Digest: sha256:d53aa2bc97c9bfdb5609cf9ec7cbee8cfedac536a7b101e039db2e0d733c60e0
Status: Image is up to date for bitwarden/setup:1.37.0
docker.io/bitwarden/setup:1.37.0


Bitwarden is up and running!
===================================================

visit https://bitwarden.kifarunix-demo.com
to update, run `./bitwarden.sh updateself` and then `./bitwarden.sh update`

You can now check Bitwarden containers;

docker ps

Accessing Bitwarden Web Interface

The installation of Bitwarden is now complete. You can access the web interface using the https://bitwarden-server-fqdn. Replace the bitwarden-server-fqdn with your system fully qualified domain name.

Ensure that from the workstation you are accessing Bitwarden from can resolve the Bitwarden hostname. Otherwise use the hosts file if you do not have DNS.

bitwarden login

Create a new account to access your Bitwarden secure vault by clicking Create Account.

create accnt

Once you have created an account, login to your Bitwarden vault.

bitwarden interface 1

Verifying Self-hosted Bitwarden Email

In order to verify Self-hosted Bitwarden email, we are going to use local Postfix relay via Gmail SMTP. Therefore, install and configure Postfix to use Gmail SMTP relay by following the guide below;

Configure Postfix to Use Gmail SMTP on Ubuntu 20.04

Next, configure Postfix to allow Bitwarden docker containers to sent emails through it. How I did this, i just greped the docker IP addresses;

ip add | grep 172.
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
    inet 172.28.0.1/16 brd 172.28.255.255 scope global br-a8c84f91fe15
    inet 172.29.0.1/16 brd 172.29.255.255 scope global br-d5da6fd7075c

Then, edit postfix main conf and add the Bitwarden docker container networks to mynetworks variable.

vim /etc/postfix/main.cf
...
mydestination = $myhostname, bitwarden.kifarunix-demo.com, localhost.kifarunix-demo.com, , localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 172.17.0.0/16 172.28.0.0/16 172.29.0.0/16 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
...

Restart postfix;

systemctl restart postfix

Next, configure Postfix SMTP mail server IP address and Port settings by editing the environment settings file, ./bwdata/env/global.override.env.

vim ./bwdata/env/global.override.env

In our setup, we are using Postfix on the localhost, hence only the lines, highlighted we used.

...
globalSettings__mail__replyToEmail=no-reply@bitwarden.kifarunix-demo.com
globalSettings__mail__smtp__host=192.168.57.3
globalSettings__mail__smtp__port=25
globalSettings__mail__smtp__ssl=false
globalSettings__mail__smtp__username=REPLACE
globalSettings__mail__smtp__password=REPLACE
....

Save and exit the file.

You should now be able to sent the verification mail.

Check your inbox and do the account verification.

Once you have verified the email, the verify email notification on the dashboard should now be gone.

bitwarden verified

You can now safely store your passwords in your safe vault. Enjoy.

Reference

Installing and Deploying Bitwarden

Install and Setup Passbolt Password Manager on Ubuntu 20.04

Configure OpenLDAP Password Expiry Email Notification

Install sysPass Password Manager on Ubuntu 18.04

Import Saved Passwords From Firefox to Chrome on Ubuntu 18.04

Disable SSH Password Login for Specific Users in Ubuntu 18.04

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment