From LedHed's Wiki
Jump to: navigation, search
(Created page with "== Overview == How to install Bitwarden === Install === As Root: Install Prerequisites apt-get install apt-transport-https ca-certificates curl gnupg-agent software-proper...")
(No difference)

Revision as of 11:05, 16 June 2021

Overview

How to install Bitwarden


Install

As Root: Install Prerequisites

apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install docker-ce docker-ce-cli containerd.io docker-compose

Create the Bitwarden Service Account

useradd -s /bin/bash -m -d /home/bitwarden bitwarden
usermod -aG docker bitwarden
passwd bitwarden (USE A REALLY LONG COMPLEX PASSWORD AND FORGET IT!) You'll never actually login as this user, instead login as a user with root privileges and: su bitwarden
mkdir /opt/bitwarden
chmod 700 /opt/bitwarden
chown bitwarden.bitwarden /opt/bitwarden


Bitwarden User:

cd /opt/bitwarden
wget -O bitwarden.sh https://go.btwrdn.co/bw-sh
chmod +x bitwarden.sh
./bitwarden.sh install

Copy ca.crt, certificate.crt, and private.key to:

/home/bitwarden/bwdata/ssl/<FQDN>/

Start Bitwarden

~/bitwarden.sh start


Automatic Startup

Create /lib/systemd/system/bitwarden.service

[Unit]
Description=Bitwarden
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
User=bitwarden
Group=bitwarden
ExecStart=/opt/bitwarden/bitwarden.sh start
ExecStop=/opt/bitwarden/bitwarden.sh stop
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

Enable the Bitwarden service

systemctl enable bitwarden

Start the service

systemctl start bitwarden


Reference

https://bitwarden.com/help/article/hosting-faqs/#q-how-do-i-add-bitwarden-to-system-boot