1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Tutorial Starbound Server on a hosted Windows Server

Discussion in 'Multiplayer' started by Jammrock, Dec 9, 2013.

  1. Jammrock

    Jammrock Void-Bound Voyager

    Sources:
    http://community.playstarbound.com/index.php?threads/how-to-set-up-a-linux-server-on-ubuntu.34623/
    http://www.reddit.com/r/starbound/comments/1s4l04/servers_and_you_getting_started_guide/


    A big thanks to those who wrote the initial guides posted in sources.

    These are the steps I used to install Starbound on my cloud server without installing the Steam client. These basic steps should work for any hosted environment. My server is running Windows Server 2012 R2, but these steps should work back through Server 2008 R2 at least.

    Setup:

    0. Create a folder for SteamCMD and the Starbound files. I'll use E:\SteamCMD and E:\Starbound respectively, but you're welcome to use whatever you want.

    1. Download SteamCMD and store it in its own folder.

    https://developer.valvesoftware.com/wiki/SteamCMD

    2. Go to E:\SteamCMD and execute SteamCMD.exe. When you do this a bunch of other files will show up in the SteamCMD folder. This is normal, don't panic.

    3. In the SteamCMD console enter the following commands, replacing the <> bits (including the <>) with the pertinent details:

    login <your_steam_user_name> <your_steam_password>
    force_install_dir <E:\Starbound>
    app_update 211820
    quit

    NOTE: The app_update part is what downloads and installs Starbound. It will pull down the entire app, including the Linux files, when you do this and can take some time.
    NOTE2: If space is tight or priced at a premium you can delete E:\StarBound\linuX32 and E:\StarBound\linux64.

    4. Open E:\StarBound\assets\default_configuration.config in Notepad, Notepadd++, text editor of your choice.

    5. [Required for cloud and hosted servers, or any server hosted where there are no UPnP-based consumer routers in use.]

    Find this line:

    "upnpPortForwarding" : true,

    ...and replace it with this line...

    "upnpPortForwarding" : false,

    UPnP won't work in hosted spaces so it's best to turn this off.

    6. Look for this line:

    "serverPasswords" : [

    Below this will be a set of empty double quotes ("") and two other words inside "". These are the server passwords, and knowing any of these will apparently allow someone access to your server.

    If you want your server to be private, as in only let your friends in, then change all the passwords in this section. For example, your serverPasswords section could look like this (but please don't blindly copy it):

    "serverPasswords" : [
    "SpamSpamBaconNSpam",
    "StarboundIsDaBomb.",
    "ToInfinityAndBeyond!",
    ],

    7. Save the file.

    8. Open, and forward if applicable, these three TCP ports with your host: 21025, 21026, 2107. If you do not know how to do this please contact your host's support, or look in their control panel or management portal.

    NOTE: You can change these ports via the default_configuration.config file. If you don't use the standard ports you need to edit the "starbound.config" file on your Starbound clients with the new port numbers.

    default_configuration.config:

    "gamePort" : 21025,
    "controlPort" : 21026,
    "authPort" : 21027,

    starbound.config:

    "controlPort" : 21026,
    "gamePort" : 21025,


    9. If the Windows Firewall is enabled (which it should) you will need to open the ports on the firewall. If you did not install to E:\StarBound please update the paths.

    Windows Server 2012+:

    a. Open an elevated (Run as administrator) PowerShell console:
    b. Execute these two commands:

    New-NetFirewallRule -Name "Starbound Server (TCP-In)" -DisplayName "Starbound Server (TCP-In)" -Direction Inbound -Protocol TCP -LocalPort 21025-21027 -Program "E:\StarBound\win32\starbound_server.exe"

    New-NetFirewallRule -Name "Starbound Server (TCP-Out)" -DisplayName "Starbound Server (TCP-Out)" -Direction Outbound -Protocol TCP -LocalPort 21025-21027 -Program "E:\StarBound\win32\starbound_server.exe"

    Windows Server 2008 [R2]

    a. Open an elevated (Run as administrator) Command Prompt console:
    b. Execute these two commands:

    netsh advfirewall firewall add rule name="Starbound Server (TCP-In)" dir=in localport=21025-21027 protocol=TCP action=Allow Program="E:\StarBound\win32\starbound_server.exe"

    netsh advfirewall firewall add rule name="Starbound Server (TCP-Out)" dir=out localport=21025-21027 protocol=TCP action=Allow Program="E:\StarBound\win32\starbound_server.exe"

    10. You'll want Starbound Server to start when the server is rebooted, which I did using a task.
    a. Open Task Scheduler
    b. Select "Task Schedule Library"
    c. Select "Create Basic Task" in the Actions pane.
    d. Name: Starbound Server
    e. Next>
    f. Select "When the computer starts"
    g. Next>
    h. Start a program
    i. Next
    j. Browse to E:\Staround\win32 and select starbound_server.exe.
    k. Next>
    l. Check "Open properties dialog..."
    m. Finish
    n. Select the "Change user or group..." button
    o. Enter "System" and press OK. If the system is domain joined you make need to change the Location to the local server.
    p. Go to the Settings tab
    q. Check the following boxes, uncheck everything else (!!!make sure the "Stop task if it runs longer than" box is UNCHECKED!!!):
    "Allow task to be run on demand"
    "Run task as soon as possible..."
    "If the task fails restart every" and set the drop downs to 5 minutes and 3 times
    "If the task does not end..."
    ...and finally change the bottom drop down to "Stop the existing instance".
    r. OK

    11. Time to start the Starbound server. Right-click on the task you just created and select Run.

    12. Hit Refresh in the Actions pane and make sure the Status column shows "Running".

    13. Double check that it is running by opening the task manager and look for the startbound_server process running.

    As long as the public endpoints are setup correctly you should be ready to play. Fire up Starbound and connect to your server.

    Update:

    To update the Starbound Server follow these much shorter steps.

    0. Make sure you and all your family/friends are off the server.

    1. Open Task Scheduler and End the Starbound server task (right-click or Actions pane). You need to manually refresh the task status from the Refresh button on the Actions pane. When the server is down the status should be Queued.

    2. Open PowerShell as admin and run this command to make sure the Starbound server is stopped:

    Get-Process starbound_server -EA SilentlyContinue | Stop-Process -Force -EA SilentlyContinue

    3. Open SteamCMD and enter the following commands, replacing the <> bits (including the <>) with the pertinent details:

    login <your_steam_user_name> <your_steam_password>
    force_install_dir <E:\Starbound>
    app_update 211820
    quit

    NOTE: The app_update part is what updated Starbound. It will pull down the entire app, including the Linux files, when you do this and can take some time.
    NOTE2: If space is tight or priced at a premium you can delete E:\StarBound\linuX32 and E:\StarBound\linux64.

    4. Start the Starbound Server task.

    5. Verify starbound is running using this PowerShell command:

    Get-Process starbound_server -EA SilentlyContinue


    I've tested these steps pretty well so they should work. If you're running Server 2008 R2 some of the names may be a little different, but close enough that you get the idea. Let me know if anything is confusing and you need clarification.

    Any other tips and tricks welcome.

    12/12/2013 follow-up:

    SteamCMD had an issue with updating the files and it broke. I finally got it working again, but while Starbound is in beta please be aware that this may happen.

    To fix the issue I had to delete the contents of the SteamCMD and Starbound directories. Then launch SteamCMD fresh and run app_update. The fresh build worked.

    Alternately you can compress the Starbound dir on your desktop and ship those, or use robocopy to apply the file diff if you have SMB access to the server.

    I found that with the latest patch (10 or 11 Dec 2013) that I had to update starbound.config in the root of the Starbound dir on the client with all three of the passwords I set on the Starbound server. Once I did that I stopped getting the "wrong password" error.


    If I get some time I'll script something out that will automate Starbound server updates.

    12/13/2013 follow-up:

    The update to version 622 worked using my update instructions. So far so good.

    I've noticed that two or more starbound_server.exe processes will sometimes spawn when I start the server. Closing all the processes and starting the task again will get it running with a single process. This normally happens after I've done an update to the game or settings. PowerShell makes doing this quick and easy.

    Look for extra starbound_server processes:

    Get-Process starbound_server -EA SilentlyContinue

    Close all starbound_server processes:

    Get-Process starbound_server -EA SilentlyContinue | Stop-Process -Force -EA SilentlyContinue

    Start the task.
     
    Last edited: Dec 13, 2013
  2. Mastroz

    Mastroz Yeah, You!

    nice write up, I was thinking about getting a windows server 2012, but not sure yet about it.
     
  3. misterducky

    misterducky Scruffy Nerf-Herder

    Switching from a server hosted on my own desktop to one hosted remotely, and I was looking for a good tutorial. First thing that came up in DuckDuckGo. Stellar write up. Many thanks.
     
  4. Jammrock

    Jammrock Void-Bound Voyager

    My pleasure. Glad to be of assistance.
     
  5. Jables

    Jables Void-Bound Voyager

    Finding some way to automate server updates would be really excellent. I hope you'll still consider writing a script to do that! :D
     
  6. Jammrock

    Jammrock Void-Bound Voyager

    It's on my mind, just haven't had the time to write it. I've built and am currently tuning a tool that will sync player files and game files between computers in a LAN. Once that's done I'll work on automating the server side updates.
     
  7. Jammrock

    Jammrock Void-Bound Voyager

    Here is the beta version of the update script. Tested on Server 2012 R2, should work on 2008 R2+ with PowerShell 3.0+. Will post this separately once I get some testers to confirm this works.

    http://pastebin.com/j3sAyucH


    Requires PowerShell 3.0 (built-in to 8+/2012+, must be installed on Server 2008 R2/7, not supported on older versions of Windows).

    Instructions:

    - Save the script to a .PS1 file on your Starbound server.
    - Edit the "##### CONSTANTS #####" section. There are four variables that need to be edited: starboundPath, steamCmdPath, steamUser, and starboundTaskName
    - the Steam password is prompted using a securestring, for security purposes
    - Execute the script. See instructions below if you are unfamiliar with running PowerShell scripts.

    http://technet.microsoft.com/en-us/library/ee176949.aspx


    Example output:

    PS C:\Scripts> .\Update-StarboundServer.ps1
    Steam password: ******
    Validating data.

    Stop Starbound server
    The Starbound server is about to be stopped. Please make sure all users "Save and quit" before continuing. Would you
    like to continue?
    [Y] Yes [N] No [?] Help (default is "N"): y
    Stopping Starbound Server.
    Checking for updates to Starbound.
    Starting the Starbound server task.
    Waiting for the starbound_server process.
    Waiting for a listener on the Starbound game port: 21025
    The Starbound server is now ready.

    Have fun exploring!


    The script assumes you use a task to control the SB server, i.e. the directions in the OP. If you yank the task validation out of the VALIDATION section it should work for servers not using a task ... in theory.

    Please reply if you test the script with the OS version you used and whether it worked. Once I get some good feedback I'll fix it, clean it and release it.

    Enjoy!
     

Share This Page