Project

General

Profile

Wiki » History » Version 2

Gareth Eaton, 07/12/2023 12:35 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 2 Gareth Eaton
sudo apt update
15
sudo apt upgrade
16
</pre>
17 1 Gareth Eaton
18
4. Install the required dependencies. Bitwarden requires Docker and Docker Compose. Install them using the following commands:
19 2 Gareth Eaton
20 1 Gareth Eaton
<pre>
21 2 Gareth Eaton
sudo apt install docker.io
22
sudo apt install docker-compose
23 1 Gareth Eaton
</pre>
24
25
5. Start the Docker service:
26 2 Gareth Eaton
27 1 Gareth Eaton
<pre>
28
   sudo systemctl start docker
29
</pre>
30
31
6. Create a directory to store the Bitwarden configuration and data:
32
33
<pre>
34
   sudo mkdir /opt/bitwarden
35
</pre>
36
37
7. Change the ownership of the directory to the user running Docker:
38
39
<pre>
40
   sudo chown 1000:1000 /opt/bitwarden
41
</pre>
42
43
8. Navigate to the Bitwarden directory:
44
45
<pre>
46
   cd /opt/bitwarden
47
</pre>
48
49
9. Download the Bitwarden Docker Compose file:
50
51
<pre>
52
   sudo curl -Lso docker-compose.yml https://raw.githubusercontent.com/bitwarden/server/master/docker/docker-compose.yml
53
</pre>
54
55
10. Open the docker-compose.yml file using a text editor. For instance:
56
57
<pre>
58
sudo nano docker-compose.yml
59
</pre>
60
61
Add the following... if you want to make Bitwarden accessible at IP address 192.168.1.69, modify the ports configuration for the 
62
63
<pre>
64
services:
65
  '404':
66
    image: bitwarden/setup:latest
67
    # Rest of the service configuration
68
69
services:
70
  bitwarden:
71
    image: bitwardenrs/server:latest
72
    container_name: bitwarden
73
    ports:
74
      - 192.168.1.69:80:80
75
    # Other configuration options for the Bitwarden service
76
77
</pre>
78
79
80
81
82
11. Save and close the Docker Compose file.
83
84
12. Start the Bitwarden containers using Docker Compose:
85
86
Swich to the docker folder
87
88
<pre>
89
cd /opt/bitwarden
90
</pre>
91
92
<pre>
93
   sudo docker-compose up -d
94
</pre>
95
96
13. Wait for the containers to start and initialize. You can check the status by running:
97
98
<pre>
99
   sudo docker-compose ps
100
 </pre>
101
102
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.
103
104
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.
105
106
---
107
108
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.
109
110
Here's a step-by-step guide to setting up systemd services for Bitwarden:
111
112
Create a systemd service unit file for Bitwarden. Open a new file with a .service extension using a text editor, such as bitwarden.service:
113
114
115
<pre>
116
sudo nano /etc/systemd/system/bitwarden.service
117
</pre>
118
119
Add the following content to the bitwarden.service file. Make sure to adjust the paths based on your specific configuration:
120
121
<pre>
122
123
[Unit]
124
Description=Bitwarden Service
125
After=network.target
126
127
[Service]
128
Type=simple
129
ExecStart=/usr/bin/docker-compose -f /opt/bitwarden/docker-compose.yml up
130
WorkingDirectory=/opt/bitwarden
131
User=root
132
Restart=always
133
134
[Install]
135
WantedBy=multi-user.target
136
</pre>
137
138
Save the changes and exit the text editor.
139
140
Enable the systemd service to start on boot:
141
142
<pre>
143
144
sudo systemctl enable bitwarden.service
145
</pre>
146
147
Start the Bitwarden systemd service:
148
149
150
<pre>
151
sudo systemctl start bitwarden.service
152
</pre>
153
154
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.
155
156
You can use the following commands to manage the Bitwarden systemd service:
157
158
Start the service: sudo systemctl start bitwarden.service
159
160
Stop the service: sudo systemctl stop bitwarden.service
161
162
Restart the service: sudo systemctl restart bitwarden.service
163
164
Check the status of the service: sudo systemctl status bitwarden.service
165
166
Remember to adjust the paths and configurations in the bitwarden.service file to match your specific setup.
167
168
After configuring the systemd service, you can test it by rebooting the server and verifying that Bitwarden starts automatically.