Hosting a Dedicated Server

From Official Barotrauma Wiki
Revision as of 15:10, 25 May 2023 by Generic (talk | contribs) (Added steps to copy steamclient.so library to the required path for steamcmd on ubuntu for steam authorization)
Jump to: navigation, search
Data is up-to-date
Last updated for version 0.18.15.0
Last mentioned in changelog 0.8.9.4
The current game version is 1.2.8.0

A Dedicated Server is a command-line application that has no graphical interface, meaning it has a lesser impact on your computer's performance than hosting a server through the full game.
If you want to host a server without needing to be in the game, this is the best way to do it.

Hosting Options

You are able to host a dedicated server with either the built-in application, or through SteamCMD. This guide will walk you through on how to do both.

DedicatedServer.exe

  • Before starting the server, make sure your server settings are in their desired state, and that port forwarding is setup correctly.
  • After you have finished tweaking server settings and setting up port forwarding, run the server executable "DedicatedServer.exe", located in the main Barotrauma folder.
  • Finally, after the command line reads "Server started", your dedicated server is ready to use!

SteamCMD

  • Before using SteamCMD to host a server, you will need to install it using these instructions.
  • After SteamCMD has been installed, log in using the command "login anonymous".
  • Next, install the Barotrauma Dedicated Server application by using the command "app_update 1026340 validate".
  • Then, before starting the server, make sure your server settings are in their desired state, and that port forwarding is setup correctly.
  • After you have finished tweaking server settings and setting up port forwarding, use the command "app_run 1026340" to start the server.
  • Finally, after the command line reads "Server started", your dedicated server is ready to use!

On linux some additional steps might be needed. See Linux Dedicated Server Hosting below.

Port Forwarding

  • If your router supports Universal Plug and Play (UPnP), you can enable it in the server settings file; however this may occasionally not work.
  • To port forward manually, you will have to either open your service provider's website, or an IP Address link.
    • For the latter option, open command prompt and enter the command "ipconfig" in.
    • Then, copy the IPv4 address under "Default Gateway" and paste it into your browser in the format of "http://xxx.xxx.x.x"
    • Finally, log in to the router config page. The default username is typically "admin".
  • After logging in to your account, navigate to the "Port Forwarding" section.
  • Next, add two new port forwards, both over UDP, with the ports listed in the serversettings.xml file.
  • Finally, save the new port forwards and return to setting up your dedicated server.

Server Settings

Main article: Serversettings.xml


  • To edit the default server settings, navigate to and open the file "serversettings.xml".
    • If you are hosting using DedicatedServer.exe, this will be located in the main Barotrauma folder. -> steamapps/common/Barotrauma
    • If you are hosting using SteamCMD, this will be located where you installed Barotrauma - either the default location under steamapps/common/Barotrauma, or in a folder specified when you installed it.
  • Change the settings to their desired state, and save the file.

Client Permission Settings

Main article: clientpermissions.xml

  • To edit the client permission settings, navigate to and open the file "clientpermissions.xml".
    • If you are hosting using DedicatedServer.exe, this will be located in the data folder in the main Barotrauma folder. -> steamapps/common/Barotrauma Dedicated Server\Data
    • If you are hosting using SteamCMD, this will be located where you installed Barotrauma - either the default location under steamapps/common/Barotrauma/Data, or in a folder specified when you installed it.
  • Change the permissions to their desired state, and save the file.

Linux Dedicated Server Hosting

You can host Barotrauma on certain Linux distros. The basic requirements are as follows:

  • You need access to an older version of libssl-dev for Debian or Ubuntu based Distros or openssl-devel for Redhat/Centos/Fedora based Distros. Barotrauma will start with an exception that it cannot find the libraries if it is missing, but keep in mind it is looking for the older version.
  • You must make the following path for the server to start: ~/.local/share/Daedalic Entertainment GmbH/Barotrauma/

Note: It does not appear to be possible to run the dedicated server out of the box with Ubuntu 22.04 due to it lacking the openssl-devel lib for compatibility. Older versions of Ubuntu such as 20.04 are fine. The reason is Ubuntu 22.04 does not include a compat lib for libssl1.1

Tested on Fedora 36 Barotrauma runs fine once you install the above dependency.

Work around for hosting on Ubuntu:

Ubuntu 22.04 has updated the OpenSSL version in their repo to a newer version that isn't compatible with Barotrauma. To work around this run the following to manually download and install the older verison:

Note: Add http:// in front of the link, the spam filter blocks it.

wget archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.10_amd64.deb && dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.10_amd64.deb

SteamCMD on Linux (Ubuntu)

Follow the instructions from earlier to get SteamCMD running.

Exit the SteamCMD client with the quit command after you've exetued the app_update.

Navigate to the Barotrauma directory manually:

cd ~/.steam/steamapps/common/Barotrauma\ Dedicated\ Server

Then run the server with

./DedicatedServer

If the server does not start, check if you got "Exception: InitGameServer returned false".

In this case you need to copy the steamclient.so library to the .steam/sdk64/ directory, create that directory beforehand if it does not exist:

mkdir ~/.steam/sdk64
cp ~/.steam/steamapps/common/Barotrauma\ Dedicated\ Server/linux64/steamclient.so ~/.steam/sdk64/steamclient.so

After this, either start the server within SteamCMD (see above) or manually as described with the DedicatedServer executable.

To keep the server running after closing your session, you might want to install a window manager like screen which allows you to disconnect from a session-window and later reconnect.

See: Enabling Mods on a Dedicated Server for more information about modding your experience.