Linux dedicated server
This is a community guide. | ||
This page is officially maintained by Smartly Dressed Games, and serves as documentation to walk you through a specific task or feature. |
This is a setup guide for hosting a Linux dedicated server for Unturned (version 3). It references the official documentation located on the GitHub repository, which should be used first with this page serving as an optional supplement.
All multiplayer servers are hosted using the Unturned Dedicated Server app, which will be installed and updated through Valve's SteamCMD tool for the purposes of this guide.
Installing SteamCMD
Refer to Valve's official documentation for a Linux installation. Once downloaded, run the steamcmd.sh
script.
Installing the server
Login to Steam anonymously, download the server, and then close SteamCMD.
login anonymous app_update 1110390 quit
After installation, the server files are now in the SteamCMD\steamapps\common\U3DS
directory.
Launching the server
Navigate to the SteamCMD\steamapps\common\U3DS
directory.
For an internet server, run ./ServerHelper.sh +InternetServer/MyServer
. For a LAN server, use +LanServer
instead.
Cleanly shutdown the server once it finishes loading, with shutdown
.
Running it will have created a "MyServer" directory in U3DS\Servers
. This is where all savedata and configuration files are kept. Changing the MyServer
ServerID in the launch arguments can be done to run multiple servers at once, or to keep savedata separate.
For an example script, open the built-in ExampleServer.sh
file.
Systemd Service
A systemd service can be created to automatically start and stop the server.
Make sure you have screen
installed.
Create a .service file in the /etc/systemd/system
directory, for example unturned-server.service
:
[Unit] Description=Unturned Dedicated Server After=network.target [Service] Type=forking ExecStart=/bin/screen -dmS unturned-server pathtounturned/ServerHelper.sh -ThreadedConsole +InternetServer/MyServer ExecStop=/bin/bash -c 'screen -S unturned-server -p 0 -X stuff "save^Mshutdown^M"; tail --pid=$MAINPID -f /dev/null' User=unturned Restart=always [Install] WantedBy=multi-user.target
Change pathtounturned/ServerHelper.sh
to the path where the server is installed, +InternetServer/MyServer
to the name of the server, and User=unturned
to the user that will run the server.
Then reload systemd and enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable unturned-server sudo systemctl start unturned-server
Systemd will now automatically start the server on boot and will gracefully shutdown the server on shutdown.