Project

General

Profile

Wiki » History » Version 4

Gareth Eaton, 07/13/2023 10:53 AM

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