Guide:LinuxServerSetup
Contents
Introduction
This guide will help new server owners setup a Starbound server on a Linux server. This guide focuses on using Ubuntu Server 16.04 and Debian 9. It is assumed Ubuntu Server/Debian is already installed and updated. If this is your first linux experience, click here to access a guide from canonical to help you install the server distribution.
It is also assumed you have forwarded the appropriate ports to allow incoming outside connections if you are behind a NAT. Starbound uses port 21025 over TCP and UDP by default and requires a 64-bit operating system to run.
Prerequisites
This section will help you install the necessary dependencies before the server can run.
Libraries
The default Ubuntu and Debian installations do not provide all the necessary packages to run the game and SteamCMD. Install all the dependencies using the following command.
$ sudo apt-get update && sudo apt-get install software-properties-common lib32gcc1 libvorbisfile3
software-properties-common
is a library required by SteamCMD. lib32gcc1
is a 32-bit library required by SteamCMD. libvorbisfile3
is required by the Starbound server.
SteamCmd
The Steam Console Client or SteamCMD[1] is a command-line version of the Steam client. Its primary use is to install and update various dedicated servers available on Steam using a command-line interface.
This section will help you install the SteamCMD application used to download the Starbound dedicated server.
Download and Install
Create a non-admin user to install/update/run the server application.
$ sudo adduser steam
Switch to this new user.
$ su - steam
Create a directory for the SteamCMD client and enter it.
$ mkdir steamcmd $ cd steamcmd
Download the SteamCMD application.
$ wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
Extract the archive.
$ tar -zxvf steamcmd_linux.tar.gz
[ Optional ] Verify files are available in the directory.
$ ls linux32 linux64 package public Steam steamcmd.sh
Running And Downloading Server With SteamCMD
Downloading The Dedicated Server
Run the SteamCMD client.
$ ./steamcmd.sh
When you start the application, you will notice that your prompt switches to steam>
instead of the traditional prompt. We will now login for the first time with our steam account and we will install the server files.
SECURITY NOTE: in the following, especially the update script, putting your password in spot of <password> might risk your Steam account security. It is recommended to leave it out, in which case you will be prompted for your password when you update.
steam>force_install_dir <directory> steam>login <username> <password> steam>app_update 211820 steam>quit
Tip: The directory can be named anything and be put anywhere (e.g. ./starbound_server, /home/steam/starbound, etc.). Do not use ~/ to represent the home directory for the user, use the full path instead.
Updating The Server
When Starbound updates, we want to make sure the server is up to date so your players will be able to continue playing on it. This section will help you create a script you can run to keep the server updated.
Use vim to create the shell script.
$ vim update_starbound_server.sh
Write the script that will run SteamCMD and update the server. Press i
to enter insert mode.
#!/bin/bash ./steamcmd.sh +force_install_dir <starbound server directory> +login <username> <password> +app_update 211820 validate +quit
Tip: Save and quit vim by pressing esc
to leave insert mode and then using the vim command :wq
.
Change the permissions of the script so it can be executed while at the same time unreadable by other users.
$ chmod 700 update_starbound_server.sh
Run the script with the following command every time you want to update the Starbound server.
$ ./update_starbound_server.sh
Running The Server
This section will help you on running the server once it has been downloaded and updated.
Change into the Starbound server directory for Linux.
$ cd <server directory>/linux
Run the server.
$ ./starbound_server
Once the server starts, you should see something similar to the following output
[Info] Root: Preparing Root... [Info] Root: Done preparing Root. [Info] Root: Scanning for asset sources in directory '../assets/' [Info] Root: Loaded Configuration in 0.000242169 seconds <SNIP> [Info] Server Version 1.3.3 (linux x86_64) Source ID: c13069b244d626cfe673f047c2100d2fcb0766d4 Protocol: 743 [Info] UniverseServer: Acquiring universe lock file [Info] UniverseServer: Loading settings [Info] UniverseServer: Starting UniverseServer with UUID: 7218b6bd1502cqf91891d1f45fe8d4bf [Info] UniverseServer: listening for incoming TCP connections on 0000:0000:0000:0000:0000:0000:0000:0000:21025
Congratulations! You're now successfully running your server.
Tip: To shutdown your server, press ctrl
+ c
.
Advanced Usage
This section provides advanced usage for server admins wishing to run their server while not having to be connected to the terminal. There are two main ways to accomplish this: using an init system, or using a terminal multiplexer.
systemd
systemd is an init system that is built into most linux systems including Ubuntu and Debian. It manages the services that start with the server. The Starbound server can be setup as a service for systemd to manage. To use systemd services, your server operating system must use systemd as its init system.[2]
Create a file in /etc/systemd/system/starbound-server.service or the corresponding systemd service location.
$ sudo touch /etc/systemd/system/starbound-server.service
Open the file for editing.
$ sudo -e /etc/systemd/system/starbound-server.service
In the following example, the server will run as the steam user created above.
[Unit] Description=StarboundServer After=network.target [Service] WorkingDirectory=/<server directory/linux User=steam Group=steam Type=simple ExecStart=/<server directory>/linux/starbound_server RestartSec=15 Restart=always KillSignal=SIGINT [Install] WantedBy=multi-user.target
Refresh systemd using the systemctl command.[3]
$ sudo systemctl daemon-reload
To start the server, use the start command.
$ sudo systemctl start starbound-server
You can verify that it is running with the status command.
$ sudo systemctl status starbound-server
The result should look like the following.
# systemctl status starbound-server ● starbound.service - Starbound Loaded: loaded (/etc/systemd/system/starbound-server.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-01-20 19:24:34 PST; 37min ago Main PID: 644 (starbound_serve) Tasks: 9 (limit: 4915) CGroup: /system.slice/starbound-server.service └─644 /<server directory>/linux/starbound_server
You can use the stop command to shutdown the server gracefully.
$ sudo systemctl stop starbound-server
To start the server upon boot you can use the enable command.
$ sudo systemctl enable starbound-server
To keep the server from starting on boot use the disable command.
$ sudo systemctl disable starbound-server
Terminal Multiplexers
Multiplexers allow you to use multiple terminal sessions in a single session. Multiplexers will also allow you to start the Starbound server and disconnect the session without killing the server.
GNU Screen
GNU Screen[4] is a multiplexer which should be installed by default on most linux distributions.
If Screen is not installed you can install it with your package manager.
$ sudo apt-get install screen
Run Screen
$ screen
A new terminal session will open up. You can type commands exactly as before.
Enter server directory and run the server.
$ cd <starbound server directory>/linux $ ./starbound_server
To disconnect from the screen session, press ctrl
+ a
d
. This detaches from the session but it will still be running in the background.
Next time you want to access that terminal session, simply use:
$ screen -r
This resumes the previous screen session.
Byobu
I will use byobu in a split screen environment. (Note that all commands are to be executed by your non-admin user)
- If you use windows and access the server via SSH, you will need to set your ssh client to UTF-8 translation and Xterm R6 type of function keys/keypad
- The first step is to tell byobu to start automatically on login for our non-admin user
$ byobu-enable
- You can now press ctrl + a which will ask you if you want to have ctrl + a used as if you use screen or emacs. This is due to the conflict between the two applications. In screen, ctrl + a is used to send commands to the application, while in emacs ctrl + a is used to go to the begining of the line. For this guide we will use the screen type
- Once we are back in our shell inside byobu, it is time to split the screen by pressing ctrl + a then pressing |
- Now our screen is split in two panes horizontally. To switch between the two, we only need to press ctrl + a then press the Tab button.
- On the top tab, navigate to the starbound server folder and start the starbound server
$ cd ~/steam/starbound/linux $ ./starbound_server
- On the bottom tab, simply navigate to the steam folder. This tab will be used to update the server files. I have this setup as it is more convenient than switching directories all the time.
$ cd ~/steam
Voila, you now have a fully running starbound server. Note that I did not do any port forwarding as it is something you should learn before tackling installing a server appliance. To disconnect from your byobu session, you simply need to press F6
Configuration
By editing the file starbound_server.config
in the storage
directory, players can adjust the settings for the server they are hosting. The file is in the JSON format. If there are syntax errors in the file when the server starts then the file will be renamed starbound_server.config.old
and replaced with the default configuration file.
The following values may be modified:
Server Configuration | |||
---|---|---|---|
Key | Description | Example | Default Value |
allowAdminCommands | Allows admin commands on the server | true | |
allowAdminCommandsFromAnyone | Allows admin commands to be executed by anyone on the server | false | |
allowAnonymousConnections | Allow connections from any account without authentication | true | |
allowAssetsMismatch | Allows clients with mismatched assets to join the server | true | |
anonymousConnectionsAreAdmin | Clients not authenticated are admins | false | |
bannedIPs | List of banned IP addresses | [] | |
bannedUuids | List of banned unique user ids | [] | |
checkAssetsDigest | false | ||
clearPlayerFiles | Wipes the server of all player files | false | |
clearUniverseFiles | Wipes the server of all world files | false | |
clientIPJoinable | false | ||
clientP2PJoinable | true | ||
crafting: filterHaveMaterials | false | ||
gameServerBind | The IP address the server should bind to | :: | |
gameServerPort | The port the server should listen on | 21025 | |
interactiveHighlight | true | ||
inventory:pickupToActionBar | Should items picked up be sent straight to the hotbar | true | |
maxPlayers | The maximum amount of players allowed on the server | 8 | |
maxTeamSize | The maximum amount of players allowed in a party | 4 | |
playerBackupFileCount | The number of backups for a player file | 3 | |
queryServerBind | The IP the query server should bind to | :: | |
queryServerPort | The port the query server should listen on | 21025 | |
rconServerBind | The IP the rcon server should bind to | :: | |
rconServerPassword | The password used to authenticate when connecting to the rcon server | "" | |
rconServerPort | The port the rcon server should listen on | 21026 | |
rconServerTimeout | The amount of time to wait before timing out a command in milliseconds | 1000 | |
runQueryServer | Runs the query server | false | |
runRconServer | Runs the rcon server | false | |
safeScripts | true | ||
scriptInstructionLimit | The maximum allowed instructions per script | 10000000 | |
scriptInstructionMeasureInterval | 10000 | ||
scriptProfilingEnabled | false | ||
scriptRecursionLimit | The maximum allowed recursive calls in a script | 100 | |
serverFidelity | "automatic" | ||
serverName | Name of the server | "" | |
serverOverrideAssetsDigest | null | ||
serverUsers | list of users that may log into the server using | "fred" : { "admin" : true, "password" : "hunter2" } |
{} |
tutorialMessages | Show the tutorials messages | true |