云服务器安装 bitwarden
官方文档 Install and Deploy - Linux
创建bitwarden
本地用户和目录(SKIP)
1. Create a bitwarden user: |
安装
1. Download the Bitwarden installation script (bitwarden.sh) to your machine:
curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh && chmod 700 bitwarden.sh |
2. Run the installer script. A ./bwdata directory will be created relative to the location of bitwarden.sh.
./bitwarden.sh install |
3. Complete the prompts in the installer
-
Enter the domain name for your Bitwarden instance:
Typically, this value should be the configured DNS record. -
Do you want to use Let’s Encrypt to generate a free SSL certificate? (y/n):
Specify y to generate a trusted SSL certificate using Let’s Encrypt. You will be prompted to enter an email address for expiration reminders from Let’s Encrypt. For more information, see Certificate Options. Alternatively, specify n and use the Do you have a SSL certificate to use? option. -
Enter your installation id:
Retrieve an installation id using a valid email at https://bitwarden.com/host. For more information, see What are my installation id and installation key used for?. -
Enter your installation key:
Retrieve an installation key using a valid email at https://bitwarden.com/host. For more information, see What are my installation id and installation key used for?. -
Do you have a SSL certificate to use? (y/n):
If you already have your own SSL certificate, specify y and place the necessary files in the ./bwdata/ssl/your.domain directory. You will be asked whether it is a trusted SSL certificate (y/n). For more information, see Certificate Options.Alternatively, specify n and use the self-signed SSL certificate? option, which is only recommended for testing purposes.
-
Do you want to generate a self-signed SSL certificate? (y/n):
Specify y to have Bitwarden generate a self-signed certificate for you. This option is only recommended for testing. For more information, see Certificate Options.If you specify n, your instance will not use an SSL certificate and you will be required to front your installation with a HTTPS proxy, or else Bitwarden applications will not function properly.
4. Post-Install Configuration
- Environment Variables
... |
Replacing globalSettings__mail__smtp...=
placeholdesr will configure the SMTP Mail Server that will be used to send verification emails to new users and invitations to Organizations. Adding an email address to adminSettings__admins=
will provision access to the Admin Portal.
After editing global.override.env
, run the following command to apply your changes:
./bitwarden.sh restart |
5. Installation File
The Bitwarden installation script uses settings in ./bwdata/config.yml
to generate the necessary assets for installation. Some installation scenarios (e.g. installations behind a proxy with alternate ports) may require adjustments to config.yml
that were not provided during standard installation.
Edit config.yml
as necessary and apply your changes by running:
./bitwarden.sh rebuild |
Start Bitwarden
Once you’ve completed all previous steps, start your Bitwarden instance:
./bitwarden.sh start |
The first time you start Bitwarden it may take some time as it downloads all of the images from Docker Hub.
Verify that all containers are running correctly:
docker ps |
Congratulations! Bitwarden is now up and running at https://your.domain.com
. Visit the web vault in your web browser to confirm that it’s working.
You may now register a new account and log in. You will need to have configured smtp
environment variables (see Environment Variables) in order to verify the email for your new account.
Script Commands Reference
The Bitwarden installation script (bitwarden.sh
or bitwarden.ps1
) has the following commands available:
PowerShell users will run the commands with a prefixed -
(switch). For example .\bitwarden.ps1 -start
.
Command | Description |
---|---|
install | Start the installer. |
start | Start all containers. |
restart | Restart all containers (same as start). |
stop | Stop all containers. |
update | Update all containers and the database. |
updatedb | Update/initialize the database. |
updateself | Update this main script. |
updateconf | Update all containers without restarting the running instance. |
renewcert | Renew certificates. |
rebuild | Rebuild generated installation assets from config.yml . |
help | List all commands. |