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 Ubuntu 13.10 VPS + Starrybound Server 1.2 + Server-Wide Dropbox Mod Sync

Discussion in 'Multiplayer' started by geokhentix, Jan 3, 2014.

  1. geokhentix

    geokhentix Scruffy Nerf-Herder

    VPS 101: Virtualized Servers and You
    First off let's talk about where VPS's come from. Yes, no, they do not come from some hatted bird carrying a knapsack with a life-ending monstrosity lurking inside. I'm talking about the provider. The internet is full of VPS/VDS hosts, both big and small, fast and slow. What you need to know is that an oversold VPS is a waste of money. Most cheap VPS hosts use OpenVZ Virtualization which has no kind of barrier against overselling. This will seriously encumber your VPS's resources, and greatly affect the stability of your server. This is precisely why you should always go with XEN Virtualization, as it is nearly impossible to oversell resources. This will ensure that the resources you are paying for are truly yours. I would personally stick with Linode or NFOservers for all of my virtual needs, but that's just me. Either way, moral of the story is XEN makes the body happy. Now that we've got that out of the way, let's kick this pig.

    Initial Setup
    First order of business is of course to create a new user. Let's talk about this for a second though. When you sign into your VPS for the first time, you will be signing into the root account. It is good practice to run all of your processes on a non-root account. If you browse around on the intarwebz, most guides will have you create a user specific to each process, like a "starbound" user, and a "teamspeak3" user, but that's not entirely necessary either. The only thing that is necessary is that you are not on the root account. You could create one non-root account and just run everything from that; it is a minimal security risk but nothing a good SSH keyfile wouldn't make up for. It's your discretion with how you want to set up your users.
    Anyway, onto making the user.

    Code:
    sudo adduser user (type password and leave the rest blank)
    sudo adduser user sudo
    I recommend using all of the directories I use in the guide for ease of use. Ifyou choose not to, remember to substitute them with your directories!


    SteamCMD
    It's time to install SteamCMD. SteamCMD is a tool that allows us to sign into our steam accounts and download Starbound from the command line. Follow along.
    Code:
    sudo apt-get install lib32gcc1
    cd ~
    mkdir steamcmd
    cd steamcmd
    wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
    tar xvfz steamcmd_linux.tar.gz && rm steamcmd_linux.tar.gz
    
    Now it's time to log into SteamCMD and download Starbound. This step can take awhile, so be patient. Obviously substitute username and password with your Steam credentials, and do note if this is the first time you're logging into SteamCMD, it'll ask for SteamGuard.
    Code:
    ./steamcmd.sh +login username password +force_install_dir ../starbound +app_update 211820 validate +quit
    Assuming Starbound installs directly, we can continue.


    Starrybound
    Now it's time to install Starrybound. Hoorah! Starbound is an easy to use Server Wrapper that uses mono. It lets us use a few cool features inside the game that aren't available on the vanilla server! Aren't you excited?! It's easy!
    Code:
    cd ~
    sudo apt-get install mono-complete
    mkdir starrybound
    cd starrybound
    sudo wget https://github.com/AvilanceLtd/StarryboundServer/releases/download/1.2.1.1/starrybound-server-1.2.zip
    unzip starrybound-server-1.2.zip
    rm starrybound-server-1.2.zip
    sudo mv * ~/starbound/linux64/
    cd ..
    rm -r starrybound
    Don't worry about starting the server for now, we're going to create a nice, easy sophisticated way to do it in the next step!

    Upstart Script & Aliases
    This part is mostly optional, but it does help a ton. First we're going to install a Upstart script for the Starrybound server. Upstart will give you a nice easy command to run, which will get even easier once we get to aliases, and will also revive the server should your VPS go down or reboot.
    Code:
    sudo apt-get install nano
    sudo nano /etc/init/starrybound.conf
    Nano, a text editor, will show up. We're going to paste the code below into nano. Copy the text below, and then right click inside the black nothingness of nano; this will paste the text into the editor. When you're done, press CTRL+X to bring up the prompt to save the file. Say yes and just hit enter when it asks for a name.
    Make sure you set setuid user to your user!
    Code:
    #!upstart
    description "Starrybound"
    
    # Set User
    setuid user
    
    # Start the Job
    script
    export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:./"
    exec /usr/bin/mono '~/starbound/linux64/starrybound-server.exe' -d
    end script
    
    start on filesystem and net-device-up IFACE=lo
    
    respawn
    
    respawn limit 10 90
    After that, it's time to set up some bash aliases. These are commands that will make it easier for us to run commands on the server.
    Code:
    sudo nano ~/.bash_aliases
    Just as we pasted the upstart conf, we're going to paste this the same way: copy it and right click inside nano.
    Code:
    alias sb-start="sudo start starrybound"
    alias sb-stop="sudo stop starrybound"
    alias sb-restart="sb-stop;sb-start"
    alias sb-status="sudo status starrybound"
    Again, hit CTRL+X to save, press Y, and hit Enter when it asks for a name. Now we need to reload bash.
    Code:
    . ~/.bashrc
    Now we can try starting Starrybound. If everything went correctly, the server should boot, and stay booted.
    Code:
    sb-start
    It'll say starrybound start/running, but don't get excited yet; there's a chance it didn't work. To check:
    Code:
    sb-status
    If it still says start/running, then congratulations, you have a working Starrybound server. If not, make sure the directories under the Start the Job portion of the Upstart.conf are set correctly for your environment.

    Dropbox Mod Syncing
    This is very optional. This will require everyone on your server to have Dropbox and run a command to create a symbolic link between directories. The result is, should anyone drop a mod into the mod folder, it will be distributed globally between the server and users instantly. We'll set it up on the server first.
    Code:
    cd ~
    
    wget -O ~/dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86"
    tar -xzvf ~/dropbox.tar.gz
    ~/.dropbox-dist/dropboxd
    This will output a website URL that you will need to browse to on your computer's web browser in order to sync the VPS to your Dropbox account. LEAVE THE PROGRAM RUNNING WHILE GOING TO THE URL. Once it's done and says successful, you can hit CTRL+C to exit.
    We now currently have the folder ~/Dropbox. We're going to download a script and make a mods folder, and link it to our Starbound mods folder.
    Code:
    wget -O ~/.dropbox/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"
    
    chmod 755 ~/.dropbox/dropbox.py
    mkdir ~/Dropbox/mods
    ln -s ~/starbound/mods ~/Dropbox/mods
    ~/.dropbox/dropbox.py start
    
    From your windows desktop,
    1. DELETE THE MODS FOLDER IN YOUR STARBOUND DIRECTORY.
    2. Click Start > CMD and right click CMD and open as administrator.
    Code:
    mklink /j "C:/Path/To/Starbound/mods" "C:/Path/To/Dropbox/mods"
    Example:
    Code:
    mklink /j "C:/Program Files (x86)/Steam/SteamApps/common/Starbound/mods" "C:/Dropbox/mods"
    This will create a symbolic link on both ends.
    Protip: To let other people in on the fun, share the mods folder with them and have them run the above mklink command on their machines as well.


    It has been a pleasure learning you, and I'll be here to answer any questions.
     
    Last edited: Jan 3, 2014
    flyinpancake, Crashdoom and Katorone like this.

Share This Page