Guide:LinuxServerSetup

From Starbounder - Starbound Wiki
Jump to: navigation, search
    • THIS PAGE NEEDS UPDATED. THE ONLY LINUX BINARY IS NOW 64-BIT.**

Introduction

This guide will help new server owners setup a Starbound server on a Linux server. This guide focuses on using Ubuntu Server 12.04 (Current LTS version). It is assumed Ubuntu Server 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 on to allow incoming outside connections.

Prerequisites

This section will help you install the necessary dependencies before the server can run.

Libraries

If your OS is 64-bit you will need to install the 32-bit libraries to get the SteamCMD client running as it is a 32-bit application.

 > sudo apt-get install lib32gcc1

The default ubuntu installation doesn't provide all the necessary packages to run the game so we will install all the game dependencies using the following command

 > sudo apt-get install libvorbisfile3

SteamCmd

The Steam Console Client or SteamCMD 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. SteamCMD.[1]

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
 steam@Server:~/steamcmd$ ls
 linux32  package  public  steam  steamcmd.sh  steam.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 Linux account security. It is recommended to leave it out, in which case you will be prompted for your password when you update.

 steam>login <username> <password>
 steam>force_install_dir <directory>
 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.)

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 +login <username> <password> +force_install_dir <starbound server directory> +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's been downloaded and updated

Change into the starbound server directory for linux

 > cd <server directory>/linux

Run the server

 > ./starbound_server

After the server has run, you should see something similar to the following output

[17:01:26.066] [Info] Root: Preparing Root...
[17:01:26.067] [Info] Root: Done preparing Root.
[17:01:26.070] [Info] Root: Scanning for asset sources in directory '../assets/'
[17:01:26.072] [Info] Root: Loaded Configuration in 0.0015257 seconds
<SNIP>
[17:01:29.547] [Info] Server Version 1.0 (linux x86_64) Source ID: fbfc7341813b83db61ef5a4b68360b0bf9c927b7 Protocol: 723
[17:01:29.547] [Info] UniverseServer: Acquiring universe lock file
[17:01:29.551] [Info] UniverseServer: Loading settings
[17:01:29.553] [Info] UniverseServer: Starting UniverseServer with UUID: <REDACTED>
[17:01:29.555] [Info] UniverseServer: listening for incoming TCP connections on <REDACTED>
[17:01:31.073] [Info] Root: Writing runtime configuration to '../storage/starbound_server.config'

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

GNU Screen

GNU Screen is a multiplexer which allows users to run simultaneous terminal sessions in one session[2]

It should be installed by default on most linux distributions. In case it is not

 > sudo apt-get install screen

Run Screen

 > screen

A new terminal will open up and you may start typing in commands

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)

Byobu Split Screen
  • 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/linux32 #If on the x86 version
 cd ~/steam/starbound/linux64 #If on the x64 version
 ./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


Systemd

To use Systemd services , your Server Operating System should use Systemd as init Process[3]

With Debian/Ubuntu 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 steam user is called starbound-server

 [Unit]
 Description=StarboundServer
 After=network.target
 [Service]
 WorkingDirectory=/home/starbound-server/Steam/steamapps/common/Starbound/linux
 User=starbound-server
 Group=starbound-server
 Type=simple
 ExecStart=/home/starbound-server/Steam/steamapps/common/Starbound/linux/starbound_server
 RestartSec=15
 Restart=always
 [Install]
 WantedBy=multi-user.target

Refresh Systemd using the systemctl command[4]

 systemctl daemon-reload

To Start Use

 systemctl start starbound-server

Verify that it runs via

 systemctl status starbound-server

The Result should look like the following

 # systemctl status starbound-server
 ● starbound-server.service - StarboundServer
  Loaded: loaded (/etc/systemd/system/starbound-server.service; enabled)
  Active: inactive (dead)
  Dez 31 17:58:46 phunderbird-starbound starbound_server[106]: [Info] Root: Loaded ItemDatabase in 1.07855 seconds
  Dez 31 17:58:46 phunderbird-starbound starbound_server[106]: [Info] Root: Loaded CollectionDatabase in 0.724747 seconds

To stop the Server issue

 systemctl stop starbound-server

To Start the Server upon boot

 systemctl enable starbound-server

To Disable Start upon boot , simply disable the target with

 systemctl disable starbound-server

Configuration

By editing the file starbound_server.config in the storage directory, players can adjust the settings for the server they're hosting.

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

References

  1. https://developer.valvesoftware.com/wiki/SteamCMD
  2. http://www.gnu.org/software/screen/
  3. https://de.wikipedia.org/wiki/Systemd
  4. https://wiki.ubuntuusers.de/systemd/systemctl/