Project

General

Profile

Wiki » History » Version 9

Gareth Eaton, 08/25/2023 02:53 PM

1 1 Gareth Eaton
h1. Wiki
2
3
Install
4
5
To install Bitwarden on a Proxmox server, you can follow these general steps:
6
7
1. Set up a Linux container (LXC) on your Proxmox server. Bitwarden supports various Linux distributions, such as Ubuntu or Debian, so you can choose the one you are most comfortable with. For example, if you want to use Ubuntu, you can create an Ubuntu LXC container.
8
9
2. Once the LXC container is created, log in to the container via SSH or the Proxmox web interface.
10
11
3. Update the package repositories and upgrade the system by running the following commands:
12 2 Gareth Eaton
13 1 Gareth Eaton
<pre>
14 6 Gareth Eaton
sudo apt update && sudo apt upgrade -y
15 2 Gareth Eaton
</pre>
16 1 Gareth Eaton
17
4. Install the required dependencies. Bitwarden requires Docker and Docker Compose. Install them using the following commands:
18
19
<pre>
20 6 Gareth Eaton
sudo apt install docker.io -y && sudo apt install docker-compose -y
21 1 Gareth Eaton
</pre>
22
23
5. Start the Docker service:
24 2 Gareth Eaton
25 1 Gareth Eaton
<pre>
26 3 Gareth Eaton
sudo systemctl start docker
27 1 Gareth Eaton
</pre>
28
29
6. Create a directory to store the Bitwarden configuration and data:
30
31
<pre>
32 3 Gareth Eaton
sudo mkdir /opt/bitwarden
33 1 Gareth Eaton
</pre>
34
35
7. Change the ownership of the directory to the user running Docker:
36
37
<pre>
38 3 Gareth Eaton
sudo chown 1000:1000 /opt/bitwarden
39 1 Gareth Eaton
</pre>
40
41
8. Navigate to the Bitwarden directory:
42
43
<pre>
44 3 Gareth Eaton
cd /opt/bitwarden
45 1 Gareth Eaton
</pre>
46
47
9. Download the Bitwarden Docker Compose file:
48
49
<pre>
50
   sudo curl -Lso docker-compose.yml https://raw.githubusercontent.com/bitwarden/server/master/docker/docker-compose.yml
51
</pre>
52
53
10. Open the docker-compose.yml file using a text editor. For instance:
54
55
<pre>
56
sudo nano docker-compose.yml
57
</pre>
58
59
Add the following... if you want to make Bitwarden accessible at IP address 192.168.1.69, modify the ports configuration for the 
60
61
<pre>
62 8 Gareth Eaton
version: '3.7'
63
64 1 Gareth Eaton
services:
65 8 Gareth Eaton
  setup:
66 1 Gareth Eaton
    image: bitwarden/setup:latest
67
    # Rest of the service configuration
68
69
  bitwarden:
70
    image: bitwardenrs/server:latest
71
    container_name: bitwarden
72
    ports:
73
      - 0.0.0.0:80:80
74
    # Other configuration options for the Bitwarden service
75 8 Gareth Eaton
    environment:
76
      - SIGNUPS_ALLOWED=true
77
      - DOMAIN=https://bitwarden.fccong.com
78
      - SMTP_HOST=smtp.gmail.com
79
      - SMTP_PORT=587
80
      - SMTP_FROM=your-email@example.com
81
      - SMTP_FROM_NAME=Bitwarden
82
      - SMTP_SSL=true
83
      - SMTP_USERNAME=your-smtp-username@example.com
84
      - SMTP_PASSWORD=your-smtp-password
85
      - SMTP_AUTH=true
86
    volumes:
87
      - /opt/bitwarden_data:/data   # Data on host:/data in container
88 7 Gareth Eaton
89 5 Gareth Eaton
# Other configuration options for the Bitwarden service
90 8 Gareth Eaton
91 1 Gareth Eaton
92
93
</pre>
94
95
96 9 Gareth Eaton
if you get this error, ERROR: In file './docker-compose.yml', service 'environment' must be a mapping not an array.
97
98
99 1 Gareth Eaton
100
101
11. Save and close the Docker Compose file.
102
103
12. Start the Bitwarden containers using Docker Compose:
104
105
Swich to the docker folder
106
107
<pre>
108
cd /opt/bitwarden
109
</pre>
110
111
<pre>
112
   sudo docker-compose up -d
113
</pre>
114
115
13. Wait for the containers to start and initialize. You can check the status by running:
116
117
<pre>
118
   sudo docker-compose ps
119
 </pre>
120
121
14. Once the containers are up and running, you should be able to access Bitwarden by visiting the IP address or domain name of your Proxmox server in a web browser. Make sure to use HTTPS for secure access.
122
123
That's it! You have successfully installed Bitwarden on your Proxmox server. Remember to configure any necessary firewall rules to allow external access to the Bitwarden service, and consider setting up SSL/TLS certificates for secure communication.
124
125
---
126
127
By default, the Bitwarden containers will not start automatically after a server reboot. However, you can configure them to start automatically on server boot by using systemd services.
128
129
Here's a step-by-step guide to setting up systemd services for Bitwarden:
130
131
Create a systemd service unit file for Bitwarden. Open a new file with a .service extension using a text editor, such as bitwarden.service:
132
133
134
<pre>
135
sudo nano /etc/systemd/system/bitwarden.service
136
</pre>
137
138
Add the following content to the bitwarden.service file. Make sure to adjust the paths based on your specific configuration:
139
140
<pre>
141
142
[Unit]
143
Description=Bitwarden Service
144
After=network.target
145
146
[Service]
147
Type=simple
148
ExecStart=/usr/bin/docker-compose -f /opt/bitwarden/docker-compose.yml up
149
WorkingDirectory=/opt/bitwarden
150
User=root
151
Restart=always
152
153
[Install]
154
WantedBy=multi-user.target
155
</pre>
156
157
Save the changes and exit the text editor.
158
159
Enable the systemd service to start on boot:
160
161
<pre>
162
163
sudo systemctl enable bitwarden.service
164
</pre>
165
166
Start the Bitwarden systemd service:
167
168
169
<pre>
170
sudo systemctl start bitwarden.service
171
</pre>
172
173
With these steps, the Bitwarden containers should now start automatically when the server reboots. The systemd service will ensure that the docker-compose up command is executed with the appropriate configuration.
174
175
You can use the following commands to manage the Bitwarden systemd service:
176
177
Start the service: sudo systemctl start bitwarden.service
178
179
Stop the service: sudo systemctl stop bitwarden.service
180
181
Restart the service: sudo systemctl restart bitwarden.service
182
183
Check the status of the service: sudo systemctl status bitwarden.service
184
185
Remember to adjust the paths and configurations in the bitwarden.service file to match your specific setup.
186
187
After configuring the systemd service, you can test it by rebooting the server and verifying that Bitwarden starts automatically.