VpnHood!

Install VpnHood! SERVER with Docker

Run the server as a container on any Linux machine with Docker. One command installs it, as a managed server or a standalone one, and the container keeps the server running and up to date.

Before you start

  • A Linux machine with a public IP address, on x64 or arm64. The image is built for both. System requirements lists the systems it runs on.
  • Root access.
  • Docker with its compose plugin. The installer can install it for you on Ubuntu, Debian and the distributions based on them.
  • TCP port 443 open, both in the machine's firewall and in your hosting provider's. The container shares the host's network, so the server listens on the host's port directly.

Install a standalone server

Run this command. It asks whether to install Docker, then downloads the compose file and starts the server's container.

sudo bash -c 'u=https://github.com/vpnhood/VpnHood.App.Server/releases/latest/download/VpnHoodServer.docker.sh; bash <(wget -qO- $u 2>/dev/null || curl -fsSL $u)'

To install it in a script, without the question, see Installer options.

The server keeps its settings, keys and logs in /opt/VpnHoodServer/storage on the host, so they outlive the container.

Create an access key

Run this on the machine. The key is made inside the server's container, so it uses the server's own settings.

sudo docker exec VpnHoodServer /app/vhsupervisor gen

For example, a key for one phone

sudo docker exec VpnHoodServer /app/vhsupervisor gen -name Phone -maxClient 1

The output and the options are the same as for a standalone server installed without Docker: copy the line under --- AccessKey ---, and see Create your first access key for the options that limit a key.

Connect

Install VpnHood! CLIENT on each device, add the key, and connect.

Start, stop and check the server

The container is called VpnHoodServer. Docker starts it again when the machine restarts, and inside it the server is started again if it crashes.

sudo docker logs VpnHoodServer
sudo docker stop VpnHoodServer
sudo docker start VpnHoodServer

The same log is written to /opt/VpnHoodServer/storage/logs/server.log on the host.

Change the settings

The server reads its settings from /opt/VpnHoodServer/storage/appsettings.json. Edit the file, then restart the container with sudo docker restart VpnHoodServer.

Where you cannot edit a file, put the whole content of an appsettings.json in the VH_APPSETTINGS environment variable instead. The server then uses it in place of the file.

Set your server's IP addresses and Use a domain name and a trusted certificate walk through the settings you are most likely to change.

Updates

The server updates itself inside the container. It checks for a new release when it starts and every 12 hours, and restarts into the new version.

To stay on one version, set VH_AUTO_UPDATE=0 in the container's environment.

Now and then a release needs a newer image. The server then keeps its current version, and its log says Pull the latest image! Run the install command again: it pulls the latest image and creates the container again, with the same settings and keys.

If you installed with an earlier version of the script, run the install command again. It moves the server to the new image and removes the old VpnHoodUpdater container.

Uninstall

To remove the server, remove its container and its image. Its settings, access keys and certificates stay in /opt/VpnHoodServer/storage on the host, for a later install.

sudo docker rm -f VpnHoodServer && sudo docker rmi vpnhood/vpnhoodserver

Delete its settings and keys too: devices that hold its keys can no longer connect, even to a new install

sudo rm -rf /opt/VpnHoodServer

Create the container yourself

If you manage your containers by hand, this is the container the installer creates. Run it on the host's network, as the installer does.

sudo docker run -d --name VpnHoodServer --network host --restart always --stop-timeout 30 -v /opt/VpnHoodServer/storage:/app/storage vpnhood/vpnhoodserver

To move it to a newer image, pull vpnhood/vpnhoodserver and create the container again.

Next steps