全站通知:

Linux dedicated server

阅读

    

2023-12-14更新

    

最新编辑:丸丸辣

阅读:

  

更新日期:2023-12-14

  

最新编辑:丸丸辣

来自UnturnedWIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

模板:Guide

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 模板:Path 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 模板:Path directory.

Launching the server

Navigate to the 模板:Path 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 模板:Path. 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 模板:Path directory, for example 模板:Path:

[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.

模板:Navbox tutorials (U3)