Bitwarden is a free and open-source password manager that allows you to store all of your logins and passwords and sync them between all of your devices. It is cross-platform and available for Linux and all other major operating systems, like Windows and macOS. It has a lot of useful features, including strong encryption, two-factor authentication (2FA), password security auditing, password breach monitoring, and cloud or local hosting options.

In this post, we will show you how to install Bitwarden Password Manager software on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A root password is configured on the server.

Getting Started

First, it is recommended to update and upgrade all your system packages to the latest version. You can update them by running the following command:

apt update -y

apt upgrade -y

Once all the packages are upgraded, run the following command to install additional required dependencies:

apt install apt-transport-https ca-certificates curl software-properties-common -y

Once all the dependencies are installed, you can proceed to the next step.

Install Docker CE Repository

Next, you will need to add the Docker CE official repository to APT. First, add the Docker GPG key with the following command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Next, add the Docker CE repository using the following command:

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Once the Docker repository is added to APT, you can procee to the next step.

Install Docker CE

Now, you can install the latest version of Docker CE using the following command:

apt install docker-ce -y

Once the Docker is installed, verify the status of the Docker service with the following command:

systemctl status docker

You will get the Docker status in the following output:

? docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-28 05:52:18 UTC; 47s ago
TriggeredBy: ? docker.socket
       Docs: https://docs.docker.com
   Main PID: 2719 (dockerd)
      Tasks: 7
     Memory: 30.3M
        CPU: 312ms
     CGroup: /system.slice/docker.service
             ??2719 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.379341986Z" level=info msg="scheme "unix" not registered, fallback to d>
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.379467088Z" level=info msg="ccResolverWrapper: sending update to cc: {[{u>
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.379593467Z" level=info msg="ClientConn switching balancer to "pick_first>
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.427861369Z" level=info msg="Loading containers: start."
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.620267088Z" level=info msg="Default bridge (docker0) is assigned with an >
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.713742709Z" level=info msg="Loading containers: done."
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.744925054Z" level=info msg="Docker daemon" commit=a89b842 graphdriver(s)=>
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.745338168Z" level=info msg="Daemon has completed initialization"
Aug 28 05:52:18 ubuntu2204 systemd[1]: Started Docker Application Container Engine.
Aug 28 05:52:18 ubuntu2204 dockerd[2719]: time="2022-08-28T05:52:18.805663866Z" level=info msg="API listen on /run/docker.sock"

Install Docker Compose

You will also need to install Docker Compose to your system. You can download and install it with the following command:

curl -sL "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Next, set the execution permission to the downloaded binary with the following command:

chmod  x /usr/local/bin/docker-compose

Next, verify the Docker Compose version using the following command:

docker-compose --version

You will get the following output:

docker-compose version 1.29.2, build 5becea4c

Create a User for Bitwarden

It is a good idea to run Bitwarden as a dedicated user. You can create a new user and add it to the sudo and docker group with the following command:

useradd -G docker,sudo -s /bin/bash -m -d /opt/bitwarden bitwarden

Next, set a user password with the following command:

passwd bitwarden

You should see the following output:

New password: 
Retype new password: 
passwd: password updated successfully

Next, change the ownership to the bitwarden directory:

chown -R bitwarden: /opt/bitwarden

Install Bitwarden Password Manager on Ubuntu 22.04

First, visit the Bitwarden hosting page and obtain Bitwarden installation key and id as shown below:

<img alt="Host ID" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/09/echo/p1.png6311c415d8e39.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="388" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, switch the user to Bitwarden and download the Bitwarden installation script using the following command:

su - bitwarden

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

Next, set execution permission to the downloaded script:

chmod  x bitwarden.sh

Next, install the Bitwarden password manager with the following command:

sudo ./bitwarden.sh install

You will be asked to provide your domain or IP, SSL information, and database name as shown below:

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

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

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

bitwarden.sh version 2022.8.4
Docker version 20.10.17, build 100c701
docker-compose version 1.29.2, build 5becea4c

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

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

(!) Enter the database name for your Bitwarden instance (ex. vault): bitwarden

Provide all necessary information and press the Enter key. You will be asked to provide the Bitwarden installation key, id, and SSL information:

2022.8.4: Pulling from bitwarden/setup
1efc276f4ff9: Pull complete 
e5aeae5c9ad4: Pull complete 
9d8b4edc672a: Pull complete 
67bb3a123350: Pull complete 
4b31f33ff8ee: Pull complete 
8302c6d93c2f: Pull complete 
64c1ff0e03a3: Pull complete 
289e8b648bb1: Pull complete 
c706fe453135: Pull complete 
6b18bfe90415: Pull complete 
Digest: sha256:257317606bad7b6c06755c81e4f61099b4af8b89829d7a9a2688545b92daa45f
Status: Downloaded newer image for bitwarden/setup:2022.8.4
docker.io/bitwarden/setup:2022.8.4

(!) Enter your installation id (get at https://bitwarden.com/host): c1908405-5beb-497f-9f09-aefe00f87c3f

(!) Enter your installation key: yQVH9PTcUIPftio0ZM8L

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

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

Provide all the necessary information and press the Enter key. Once the Bitwarden is installed, you should see the following output:

Generating key for IdentityServer.
Generating a RSA private key
.........................    
.    
writing new private key to 'identity.key'
-----

!!!!!!!!!! WARNING !!!!!!!!!!
You are not using a SSL certificate. Bitwarden requires HTTPS to operate. 
You must front your installation with a HTTPS proxy or the web vault (and 
other Bitwarden apps) will not work properly.

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`

Now, start the Bitwarden service using the following command:

sudo ./bitwarden.sh start

You should get the following output:

bitwarden.sh version 2022.8.4
Docker version 20.10.17, build 100c701
docker-compose version 1.29.2, build 5becea4c

Pulling mssql         ... done
Pulling web           ... done
Pulling attachments   ... done
Pulling api           ... done
Pulling identity      ... done
Pulling sso           ... done
Pulling admin         ... done
Pulling icons         ... done
Pulling notifications ... done
Pulling events        ... done
Pulling nginx         ... done
Creating directory /opt/bitwarden/bwdata/core
Creating directory /opt/bitwarden/bwdata/core/attachments
Creating directory /opt/bitwarden/bwdata/logs
Creating directory /opt/bitwarden/bwdata/logs/admin
Creating directory /opt/bitwarden/bwdata/logs/api
Creating directory /opt/bitwarden/bwdata/logs/events
Creating directory /opt/bitwarden/bwdata/logs/icons
Creating directory /opt/bitwarden/bwdata/logs/identity
Creating directory /opt/bitwarden/bwdata/logs/mssql
Creating directory /opt/bitwarden/bwdata/logs/nginx
Creating directory /opt/bitwarden/bwdata/logs/notifications
Creating directory /opt/bitwarden/bwdata/logs/sso
Creating directory /opt/bitwarden/bwdata/logs/portal
Creating directory /opt/bitwarden/bwdata/mssql/backups
Creating directory /opt/bitwarden/bwdata/mssql/data
Creating network "docker_default" with the default driver
Creating network "docker_public" with the default driver
Creating bitwarden-notifications ... done
Creating bitwarden-events        ... done
Creating bitwarden-icons         ... done
Creating bitwarden-mssql         ... done
Creating bitwarden-attachments   ... done
Creating bitwarden-web           ... done
Creating bitwarden-sso           ... done
Creating bitwarden-identity      ... done
Creating bitwarden-api           ... done
Creating bitwarden-admin         ... done
Creating bitwarden-nginx         ... done
2022.8.4: Pulling from bitwarden/setup
Digest: sha256:257317606bad7b6c06755c81e4f61099b4af8b89829d7a9a2688545b92daa45f
Status: Image is up to date for bitwarden/setup:2022.8.4
docker.io/bitwarden/setup:2022.8.4


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

visit http://bitwarden.example.com
to update, run `./bitwarden.sh updateself` and then `./bitwarden.sh update`

You can verify all downloaded docker images using the following command:

sudo docker images

You will get the following output:

REPOSITORY                TAG        IMAGE ID       CREATED       SIZE
bitwarden/mssql           2022.8.4   0fde97fd6c2b   11 days ago   1.4GB
bitwarden/setup           2022.8.4   c3f86466c311   11 days ago   271MB
bitwarden/notifications   2022.8.4   ad800e29d1bf   11 days ago   286MB
bitwarden/identity        2022.8.4   39342ec67118   11 days ago   284MB
bitwarden/nginx           2022.8.4   a9e4cdb98e3d   11 days ago   144MB
bitwarden/icons           2022.8.4   e52e97fcc4c1   11 days ago   285MB
bitwarden/admin           2022.8.4   25fe354a8fa2   11 days ago   346MB
bitwarden/sso             2022.8.4   345ee4d3d544   11 days ago   289MB
bitwarden/events          2022.8.4   012f3c8dc079   11 days ago   284MB
bitwarden/api             2022.8.4   f780a0e0bfbf   11 days ago   289MB
bitwarden/attachments     2022.8.4   8b08874c96fc   11 days ago   214MB
bitwarden/web             2022.8.1   1ac4e585d2dd   2 weeks ago   247MB

To check all running containers, run the following command:

sudo docker ps

You should see the following output:

CONTAINER ID   IMAGE                              COMMAND            CREATED          STATUS                             PORTS                                                                                    NAMES
9af240bb8845   bitwarden/nginx:2022.8.4           "https://www.howtoforge.com/entrypoint.sh"   33 seconds ago   Up 28 seconds (health: starting)   80/tcp, 0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp   bitwarden-nginx
4758bb5d8c6c   bitwarden/admin:2022.8.4           "https://www.howtoforge.com/entrypoint.sh"   39 seconds ago   Up 33 seconds (health: starting)   5000/tcp                                                                                 bitwarden-admin
2814dd1eddd2   bitwarden/identity:2022.8.4        "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 35 seconds (healthy)            5000/tcp                                                                                 bitwarden-identity
22fa6c748d4f   bitwarden/sso:2022.8.4             "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 34 seconds (health: starting)   5000/tcp                                                                                 bitwarden-sso
9906ace7ea69   bitwarden/api:2022.8.4             "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 34 seconds (healthy)            5000/tcp                                                                                 bitwarden-api
1d1f10c10667   bitwarden/mssql:2022.8.4           "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 39 seconds (health: starting)                                                                                            bitwarden-mssql
f7ab34d501cc   bitwarden/attachments:2022.8.4     "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 37 seconds (healthy)                                                                                                     bitwarden-attachments
6646bf077ba8   bitwarden/web:2022.8.1             "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 39 seconds (healthy)                                                                                                     bitwarden-web
e73076475cc7   bitwarden/icons:2022.8.4           "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 35 seconds (health: starting)   5000/tcp                                                                                 bitwarden-icons
535f2f7599c1   bitwarden/events:2022.8.4          "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 35 seconds (healthy)            5000/tcp                                                                                 bitwarden-events
7a489f258459   bitwarden/notifications:2022.8.4   "https://www.howtoforge.com/entrypoint.sh"   45 seconds ago   Up 34 seconds (healthy)            5000/tcp                                                                                 bitwarden-notifications

Access Bitwarden Web Interface

At this point, the Bitwarden password manager is installed and configured. You can now access its web UI using the URL https://your-server-ip. You should see the Bitwarden login page:

<img alt="Login to Bitwarden" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/09/echo/p2.png6311c41618853.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="462" loading="lazy" src="data:image/svg xml,” width=”750″>

Click on the Create Account button. You should see the following page:

<img alt="Create an account" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/09/echo/p3.png6311c4164c628.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="523" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide your Email address, Master password, and click on the Create Account button. Once the account is created, you will be redirected to the Bitwarden login page:

<img alt="Bitwarden master password" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/09/echo/p4.png6311c4168123e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="529" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide your email address, password and click on the Log in button. You should see the Bitwarden dashboard on the following page:

<img alt="Bitwarden dashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/09/echo/p5.png6311c416b94c4.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="433" loading="lazy" src="data:image/svg xml,” width=”750″>

Conclusion

Congratulations! you have successfully installed Bitwarden Password Manager with Docker on Ubuntu 22.04. You can now add your passwords and share them between multiple devices. Feel free to ask me if you have any questions.