|
|
| (2 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| − | <br>
| + | This guide has been made obsolete by JacksonTheMaster's excellent [https://github.com/SteamServerUI/StationeersServerUI/releases/ SSUI] tool. |
| − | [[Category:Tutorials]]
| + | Give JacksonTheMaster's repo a star and support their continued work on this excellent tool. |
| − | | |
| − | == Requirements ==
| |
| − | * A machine that runs any Linux distribution that uses SystemD
| |
| − | * Access to, and basic knowledge of your Linux shell
| |
| − | * <code>sudo</code>-rights
| |
| − | * At least 16GB RAM
| |
| − | | |
| − | == Preparing the server ==
| |
| − | To maximize server security, we will be setting up a dedicated user that only has the privileges to run the dedicated server, and nothing else.
| |
| − | | |
| − | <code>sudo useradd -m stationeers</code>
| |
| − | | |
| − | We won't need to log in with the user at all, so to increase security even more, let's prevent anyone from logging in with the user.
| |
| − | | |
| − | <code>sudo nano /etc/passwd</code>
| |
| − | | |
| − | Find the line that starts with <code>stationeers:x:</code> (it's most likely the last line in the file). Replace the path at the end of this line (probably says <code>/bin/bash</code>) with <code>/sbin/nologin</code>.
| |
| − | | |
| − | == Installing SteamCmd ==
| |
| − | Follow the instructions here to get SteamCmd installed: https://developer.valvesoftware.com/wiki/SteamCMD#Package_From_Repositories
| |
| − | | |
| − | == Creating the SystemD service==
| |
| − | Now it's time to create the service-file for SystemD so we can use it to control starting and stopping the Stationeers server.
| |
| − | | |
| − | <code>sudo nano /etc/systemd/system/stationeers.service</code>
| |
| − | | |
| − | Paste the following into the editor:
| |
| − | ----
| |
| − | <code>[Unit]<br>
| |
| − | Description=Stationeers Dedicated Server<br>
| |
| − | Wants=network-online.target<br>
| |
| − | After=syslog.target network.target nss-lookup.target network-online.target
| |
| − | | |
| − | [Service]<br>
| |
| − | Environment="LD_LIBRARY_PATH=./linux64"<br>
| |
| − | ExecStartPre=/usr/games/steamcmd +force_install_dir "/home/stationeers/StationeersDedicatedServer" +login anonymous +app_update 600760 validate +quit<br>
| |
| − | ExecStart=/home/stationeers/StationeersDedicatedServer/rocketstation_DedicatedServer.x86_64 -loadlatest "NAME_OF_SAVE" PLANET -difficulty DIFFICULTY_SETTING -settings StartLocalHost true ServerVisible true LocalIpAddress IP_ADDRESS ServerName "NAME_IN_SERVER_LIST" ServerPassword "YOUR_SECURE_PASSWORD" ServerMaxPlayers MAX_PLAYERS UPNPEnabled false<br>
| |
| − | User=stationeers<br>
| |
| − | Group=stationeers<br>
| |
| − | StandardOutput=journal<br>
| |
| − | Restart=on-failure<br>
| |
| − | WorkingDirectory=/home/stationeers
| |
| − | | |
| − | [Install]<br>
| |
| − | WantedBy=multi-user.target</code>
| |
| − | ----
| |
| − | The stuff under <code>[Unit]</code> and <code>[Install]</code> is just to name the service in Linux, and declare when it's safe to start. It's the stuff under <code>[Service]</code> that is the "business end" of this file.
| |
| − | | |
| − | <code>ExecStartPre</code> runs the <code>steamcmd</code> application to update the dedicated server. You might want to check that <code>steamcmd</code> is actually installed in /usr/games/ by running the following command: <code>find /usr/ -name "steamcmd"</code><br>
| |
| − | <code>ExecStart</code> starts the Stationeers dedicated server. Be sure to replace all the UPPERCASE entries with what you want for your server. See here: https://github.com/rocket2guns/StationeersDedicatedServerGuide/blob/main/README.md<br>
| |
| − | <code>User</code> and <code>Group</code> ensures that the dedicated server runs with the user we set up earlier.<br>
| |
| − | <code>StandardOutput=journal</code> directs all log-messages to the system journal. If something goes wrong, you don't have to locate any log-files, you just run the command <code>journalctl -fu stationeers</code> to browse the journal for what the user <code>stationeers</code> has output.<br>
| |
| − | <code>Restart=on-failure</code> ensures that if the server crashes, it will automatically restart.<br>
| |
| − | <code>WorkingDirectory=/home/stationeers</code> makes sure that everything we do assumes that we're standing in this folder when we do it. It's kind of redundant here, but I keep it in for safety.
| |
| − | | |
| − | == Wrapping it all up ==
| |
| − | Now that we've created the service-file, we have to let SystemD know it's there. Run <code>sudo systemctl daemon-reload</code> to do that. Any time you edit the service-file, you have to run this command to make SystemD aware of the changes you've made.
| |
| − | | |
| − | That's it! All we need to do now is run <code>sudo systemctl start stationeers</code>, and it will download Stationeers Dedicated Server, start it with the parameters we've set, and run until we either reboot the machine, or run <code>sudo systemctl stop stationeers</code>.<br>
| |
| − | If there's an update to Stationeers, just run <code>sudo systemctl restart stationeers</code>, and the <code>ExecStartPre</code> line in the service-file will ensure that <code>steamcmd</code> downloads the latest version.
| |
| − | | |
| − | Want the dedicated server to start with the machine every time you reboot? Just run <code>sudo systemctl enable stationeers</code> to enable start-on-boot, and <code>sudo systemctl disable stationeers</code> to disable it again.
| |