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 A cost-effective way to manage a Starbound ubuntu server with digitalocean

Discussion in 'Multiplayer' started by chronodekar, Jul 30, 2016.

  1. chronodekar

    chronodekar Space Hobo

    Hello folks,

    I bought a few copies of Starbound for my brother and me when it came out of beta. We tried setting up and playing a few multiplayer games - it was fun, but there were lag/connection issues. We're living in two different cities and every once in a while, my brother's connection would break or he'd be walking in the game out-of-sync. Not Fun. Soo, I decided to rent a server and see if that would help - it did, but boy-oh-boy was the whole process confusing!

    Looking around the forums here (especially the multiplayer section), led me to a few game hosting services. These sounded nice, but the prices were confusing. They like to say they charge around a dollar for a single seat/player, but if you actually try to sign up, there's a minimum requirement for at least 10 seats for some hosts, and others have some extra fees added on. In the end, the total cost comes to somewhere around USD $12.00/month. While I don't mind paying that for a good service, the feedback mentioned led me to believe that it wasn't worth the cost. So, why not rent a VPS and pay only for the hours we play? I found out that this IS possible when using digitalocean as my host, provided that I'm willing to do the legwork of managing the server myself. And the best part is what it cost me! Here's the breakdown from my bill,

    [​IMG]
    18 hours of gaming for USD $0.26 !!​

    CAVEAT: If you signup with them as a new user they'll charge you USD $5.00 to start an account with them. But, unless you actually run their server continuously, this should last for many hours of gaming. :)

    How does this pricing work?
    You can visit their pricing page here: https://www.digitalocean.com/pricing/
    Now, while the default numbers on that page look scary, what you really want to do is check out their hourly rates. Doesn't look too pricey now, does it? (at least, it didn't seem so for me!)

    And can it be used to keep playing on the same universe? Between play sessions?
    Yes, it can - provided you are willing to do the legwork. You see, digitalocean has a nice feature called 'snapshots'. It's like making a copy of your game server and storing it as a file. Once this is done, you can destroy the game server (so you won't be charged) and when you want to resume your play session, just remake the server from the snapshot and you'll be back online! Just ... don't forget to snapshot and destroy the server again when you are finished. For now, the snapshot feature is free, but even if they decide to start charging for it, considering the way they price, I don't expect it to be unreasonable.

    Sounds wonderful! Please tell me how to configure the same, so I can start hosting game with my friends?
    Woah, woah, woah! Do not rush into this! Let me say that while this is likely a cheaper and more reliable alternative than most hosting providers, it assumes many things. Most importantly, you understand the following,

    THIS AUTHOR WILL NOT BE HELD RESPONSIBLE FOR ANY DAMAGES OR COSTS THAT CAN ARISE FROM FOLLOWING THIS GUIDE/TUTORIAL. PROCEED AT YOUR OWN RISK!

    And with that out of the way, let's proceed with the guide!

    Step-01: Selecting a data center
    Let's assume that you've been chosen to manage a Starbound multiplayer game among your friends and that your friends live in different cities. Your first task, is to select a data center which provides reasonable ping/latency times for everyone.

    One approach is to opt for the first one which catches your fancy, configure a Starbound server on it and ask everyone to connect to it. If folks are having problems, offer a group sacrifice to Kluex, the winged god of the Aether, select a different data center and try again. Unless all your friends are Avians, following this tactic might gain you the reputation of being the village idiot.

    A smarter approach, is to use the free ping web-test provided by Digital Ocean at,
    http://speedtest-nyc1.digitalocean.com/
    Just ask your friends to open the above link on their computers, select a data center, run the test and report the results back to you. It should look something like this,

    [​IMG]
    What you are most interested in, is the Latency number. The smaller this is for everyone, the better will the experience be!

    Step-02: Sign up for a DigitalOcean account
    At the bare minimum, this is going to cost you USD $5.00/- You can pay for this via credit cards or PayPal during the sign up process. To do so, head over to the main Digital Ocean website and follow the instructions to create an account. Alternatively, if you were to use my referral link to make the account,
    https://m.do.co/c/50e578e90d50
    In addition to the USD $5.00, you'll get an additional bonus of $10, which will bring your total to $15.00/-
    (Confession: If enough people use my referral link to sign up, I can probably play my Starbound multiplayer matches for free - the real reason for making this guide! :p )

    Step-03: Creating a new server (or Droplet)
    After logging into your new Digital Ocean account, you should see something similar to the following image,

    [​IMG]

    Just click on the 'Create Droplet' button to make our server. There are a lot of different options to choose from, so lets go over them one-by-one.

    First is to select an image/OS. We want Ubuntu 16.04 64-bit,

    [​IMG]
    Next is to select droplet size. I've played 2-player games with the $10/month option - with the occasional crashes now and again, but suspect that's due to the game itself and not because of low spec hardware. Regardless, for price demonstration reasons, I'm going to select the $40/month for this guide.

    [​IMG]
    After this is an option about block storage (we don't need it) and what data center region to use. Remember the data center you decided earlier with your friends? This is when you select it. For this guide, I'm selecting Singapore.

    [​IMG]
    We can ignore the next few options and focus on what hostname to use for our server. I'm going with star-server for this guide.

    [​IMG]
    Click the Create button, a new page should load up, watch the server get prepared and when it's done you'll be able to see the IP address assigned to it,

    [​IMG]
    If you click on the server name, the details page will load up. It should look something like this,

    [​IMG]
    Don't forget how to navigate back to this page. We'll need to return here when it's time to snapshot and destroy the system after our gaming session is over. But for now, we're done. The server has been created!

    Step-04: Logging into our new server
    By now, you should have got an email with login details about the server you just made. Mine looked like this,

    [​IMG]
    I'm going to assume that you are using a Windows OS. We'll need to download a free utility called Putty to connect to our server. Open the following link on your web-browser and download the file called putty.exe,
    http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
    Here is an image of how the site looked like when I wrote this guide,

    [​IMG]
    Keep note of where you saved putty.exe on your computer. We'll need to come back to it often during this guide.

    [​IMG]

    For now, just double click or run the file and type in the server IP we got from Digital Ocean in the Host Name box. Select SSH for connection type. Here is how it looked like for me,

    [​IMG]
    When you click the Open button at the bottom, a terminal window will open up. Since this is the first time we're connecting to this server, a security dialog box will show up like this,

    [​IMG]
    Click Yes to proceed. On the terminal window you'll be asked for a login name. Enter 'root' as per the email you got from Digital Ocean. Next you'll be asked for the password. Just type in what you got in the mail. After this the server will ask you to make a new password. For this guide I'm going to use "rootpass" , without quotes. Here's how the terminal should look like,

    [​IMG]
    At this point, we've successfully connected to our server. Give yourself a pat on the back! :)

    Step-05: Installing Steam and Starbound
    Now that we're able to connect to our shiny new server, it's time to prepare it for our multiplayer games. First we'll need to install a few open source packages by typing the following,

    Code:
    apt-get install screen lib32gcc1
    Here's what the output looked like for me,

    [​IMG]
    We now need to create a new user to install with. Why? It's considered bad practice to be doing things on a server as the root/admin user. Let's call the new user 'starbound'. Type in the following to make the user.

    Code:
    adduser starbound
    You'll be asked to enter a password for the user. For this guide, let's use 'starpass' , without quotes. You can press the Enter key to accept the default values for the remaining options. Here's how it will look like when you are done,

    [​IMG]
    And with this, we are done doing things as the root user. Close the putty terminal window and open a new one. But this time enter the following in the Host Name section,

    Code:
    starbound@123.123.44.44
    Change the numbers to your server IP instead. Here's how things should look like,

    [​IMG]
    Press the Open button and you'll be asked for the password to the starbound user. Remember what we created earlier? Just type that and you'll be logged in.

    It is now time to make use of the screen utility we installed earlier. What is screen? It is a tool used by linux experts to let things continue to run even if the terminal session disconnects. That sounds a lot more confusing than it really is, so let's just move on with a demonstration instead. Type in the following on the terminal,

    Code:
    screen -R
    Here is how things will look like before pressing Enter,

    [​IMG]
    Here is how things will look like right after you press Enter,

    [​IMG]
    Press Enter again and we'll come here,

    [​IMG]
    With this, we've got screen running successfully! Yeah, it might look like nothing's really happened, but trust me, we've crossed over a VERY important step!

    Now, let us install SteamCMD. This is an official server tool released by Valve to allow gamers (like us) to manage server installations of our Steam games. Here is a link to the official documentation,
    https://developer.valvesoftware.com/wiki/SteamCMD#Linux

    First, we need to create a directory to install SteamCMD into. Run the following commands,

    Code:
    mkdir ~/steamcmd
    cd ~/steamcmd
    Next, we need to download and extract the steamcmd utility from Valve. Enter the following command into the terminal (copy-paste might work. I think it's right-click to paste).

    Code:
    wget http://media.steampowered.com/client/steamcmd_linux.tar.gz && tar -xvzf steamcmd_linux.tar.gz
    The output looks a bit messy, but here's how it should come,

    [​IMG]
    Now we are going to launch the SteamCMD utility and let it update itself. Type in the following,

    Code:
    ./steamcmd.sh
    Here's how the output might look like,

    [​IMG]
    As the installation happens, let us take this moment to demonstrate what exactly the screen utility does. Just close the console window right now - especially since the SteamCMD is still running. Go ahead, it's fine.

    Once you've done that, open up putty and login to the system again with the starbound user,

    [​IMG]
    When you login to the system, it will seem like a fresh login. The earlier steamcmd we ran isn't to be found anywhere. But we can get back to that session by typing the following,

    Code:
    screen -R
    This will take you back to the installation. In my case, it actually finished. Cool! You'll end up seeing a Steam> prompt. type 'quit' to close it. (You can press Enter a few times for spacing aesthetics).

    Now, navigate back to the home directory and create a new folder for our starbound game by entering the following,

    Code:
    cd ~
    mkdir ~/starbound_game
    Here's the output,

    [​IMG]

    To make things easy for ourselves in the future, let us create an update script for Starbound and make it executable. Type in the following,

    Code:
    echo "/home/starbound/steamcmd/steamcmd.sh +login STEAM_USERNAME STEAM_PASSWORD +force_install_dir /home/starbound/starbound_game +app_update 211820 +exit" > update_starbound.sh
    chmod +x update_starbound.sh
    
    Replace STEAM_USERNAME and STEAM_PASSWORD with your actual steam username/password - we'll be logging into steam with our actual Steam accounts (If you are using a separate Steam account for server activities, you can use that one instead). You can type "ls" , without quotes to list the contents of your home directory. Here's how should look like,

    [​IMG]

    Now, install the game by typing,

    Code:
    ./update_starbound.sh
    You'll probably be asked for your Steam 2 factor authentication code. The installation will start after Steam verifies your account. Considering that the server should have a faster internet connection than most homes, the installation should get done in about 5 mins. The same script can also be used to update the game. Just run it again. Here's how things looked like for me when I tried it,

    [​IMG]
    And with this, we've finished installing Steam and Starbound on our server!

    Step-06: Running Starbound server
    At this point, things are rather simple and straight-forward to get the server running. First, navigate to the following directory,

    Code:
    cd ~/starbound_game/linux/
    [​IMG]
    And enter the following to start the game server,

    Code:
    ./starbound_server
    Here's what the output looked like for me,

    [​IMG]
    To join the server, just ask your friends to start the Starbound game on their systems, from the main menu select 'Join Game', select a character and on the server info page enter the IP of the server. Like so,

    [​IMG]
    On pressing Join server, they'll be brought into the universe hosted by you! And as things happen, you'll see text scroll by on the putty terminal (which you can close, if you wish - since its running inside screen, it will remain active. Though, I like keeping it open by the side, since its easier to restart if it crashes).

    (TUTORIAL IN PROGRESS, I'M JUST SAVING THE THREAD SO AS NOT TO LOSE THE EFFORT, PLEASE BE PATIENT - WILL FINISH IT TOMORROW... )
     
    Last edited: Jul 30, 2016
  2. mattmonkey24

    mattmonkey24 Void-Bound Voyager



    Just to clarify, the game is DRM free, and you could get by with one copy preferably two, one for each of you. Though I'm sure Chucklefish appreciates the support

    This seems like a good beginners tutorial to running a dedicated server from start to finish.

    Since this is Ubuntu 16, you might also want a systemd unit that will start the server when the computer boots, and also gives a restart or stop tool if you right those in. Since you wont have the output in the putty window, it would be in one of the starbound_server.log files in the storage folder.

    You also didn't cover editing the config file, which might not be immediately obvious to a beginner. Adding a user account would be the biggest recommendation imo, since that's the only way to gain admin rights for kicking people or warping friends.
     

Share This Page