How to Install Bitwarden on Ubuntu

install bitwarden ubuntu

Bitwarden is a useful and secure password manager that works great for both individuals and teams. What makes it even more useful is that it also offers a command-line version. If you’re someone who often works with servers that don’t have a graphical interface, or if you simply prefer using the terminal, Bitwarden has a solution for you. While the command-line tool isn’t as user-friendly as the desktop app, it’s still a practical option for managing your vault directly from the terminal.

In this article, we’ll show you a step-by-step process of installing a self-hosted instance of Bitwarden on Ubuntu using Docker and Docker Compose.

Install Bitwarden on Ubuntu

Installing Bitwarden on Ubuntu lets you manage your passwords securely using a web interface or the command line. In this section, I’ll show you how to set it up with Docker and Docker Compose in a few simple steps.

Step 1: Install Essential Packages

You can install essential packages required to fetch files over HTTPS, manage GPG keys, and add third-party repositories. These are necessary before setting up Docker:

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

Step 2: Add Docker’s GPG Key

After installing required packages, add Docker’s official GPG key to ensure that the downloaded packages are verified and trusted by your system.

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

Step 3: Add Docker Repository

Next, you need to add Docker’s stable repository to your system’s sources list so that you can install Docker directly from Docker’s official package server:

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
add docker repository

Then, update the list of installed packages on your system to make sure the latest package listings, including the new Docker repository, are available:

sudo apt update
update system packages

Step 4: Install Docker Engine

You can now install the Docker engine, which is essential for running containers like Bitwarden on your Ubuntu system:

sudo apt install docker-ce
install docker engine

After this, start the Docker service and also enable it to start every time your system boots up automatically:

sudo systemctl start docker && sudo systemctl enable docker

Also, confirm if the Docker service is active and running properly by viewing its status:

sudo systemctl status docker
verify docker status

Step 5: Install Docker Compose

Now, install Docker Compose, which helps in managing multi-container applications like Bitwarden using a single YAML configuration file.

sudo apt install docker-compose -y
install docker compose

Step 6: Create and Configure the Bitwarden User

You can create a new system user named bitwarden with its own directory under /opt. This user will have permission to use Docker and sudo commands:

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

Set a password for the new Bitwarden user so you can switch to it later and perform installation steps securely:

sudo passwd bitwarden
set password bitwarden

Step 7: Get Installation ID and Key

After this, visit the Bitwarden’s official hosting page to request your installation ID and key. These are required during the installation process to validate your self-hosted instance:

submit domain and email

Click the submit button to get your installation ID and installation key from Bitwarden:

get installation id and key

Step 8: Download Bitwarden Installation Script

After that, switch to the Bitwarden user environment to keep all Bitwarden files organized under its dedicated user account:

su - bitwarden

Now, download the official Bitwarden installation script directly into your current directory.

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

download official Bitwarden installation script

Make the installation script executable:

chmod +x bitwarden.sh
make script executable

Step 9: Start Bitwarden

Now start the Bitwarden installation process. It will prompt you for your domain name, installation ID, key, and admin email:

sudo ./bitwarden.sh install
start bitwarden

It will prompt you to specify the domain name and your email. Also, type y to generate a free SSL certificate:

provide necessary details

Step 10: Access Bitwarden Web Vault

Finally, you can now open your web browser and visit your configured domain (e.g., https://yourdomain.com) to access the Bitwarden web interface and log in.

Conclusion

You can install Bitwarden on Ubuntu using Docker and Docker Compose to manage your passwords securely. If you prefer working in the terminal or need a tool that runs without a graphical interface, Bitwarden gives you that flexibility. Once you complete the setup, you can open your browser, access the web vault, and start managing your credentials with confidence.

Experience top-tier performance with UltaHost’s Linux VPS Hosting, featuring ultra-fast NVMe SSD storage, full root access, and quick server deployment. Whether you’re hosting websites, running databases, or managing development tools, our Linux VPS offers the reliability, flexibility, and control your projects need to thrive.

FAQ

Do I need a paid Bitwarden plan to use this setup?
Why do we use Docker instead of a direct install?
Can I run Bitwarden without Docker Compose?
What happens if my SSL certificate fails to renew?
Can I back up my vault data?
How do I add more users?
How to uninstall Bitwarden from Ubuntu?

Related Post

How to Install TensorFlow on Ubuntu

TensorFlow is a powerful open-source machine-learning l...

How to Create and Setup a Cron Job in Ubuntu

You will be asking the compelling question, what is cro...

How to Install Apache on Ubuntu

Apache is a free and open-source web server the most po...

Copying Files from Local to Remote Server wit...

SCP (Secure Copy Protocol) is a command that securely t...

How to Install OpenJDK on Ubuntu

OpenJDK the Open Java Development Kit is a free and ope...

How to Install Puppet on Ubuntu 24.04

Puppet is a popular open-source configuration managemen...

Leave a Comment