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 Dedicated Starbound server under GNU/Linux + Port Forwarding

Discussion in 'Multiplayer' started by kaski, Dec 18, 2013.

  1. kaski

    kaski Aquatic Astronaut

    TL;DR: Detailed but short guide on how to install Starbound server on GNU/Linux with port forwarding and firewall protection.

    Introduction:


    I saw many tutorials on web and on this forum, still many people had problems to install the server. I got my new dedicated server for my game servers and was installing starbound server on it and had an idea to write my own detailed guide about how I did it. You may have rented a VPS or dedicated server, or you might have one on your own house. As long as you use GNU/Linux, you should be able to follow this guide. Only problems you could encounter with different distributions/version are dependency problems which should be easy to fix (error code usually says what you are missing).

    You should already have your own username with full root access via sudo and also updated your package list (sudo apt-get update). I will try to keep this guide short but I will also try to explain things. I hope that atleast one of you will learn something from this. If you don't like reading then maybe this guide isn't for you.

    I apologize for my english skill. Also sorry if this guide is a mess.





    Things this tutorial has:
    - Explanation what is port forwarding, how to know if you need to forward and how to find info how to do it.
    - Configuring firewall. We will block all ports and open only ones that we need. This will be done via Webmin
    - Installing SteamCMD, running it and downloading/installing Starbound.


    My setup:
    Intel Xeon CPU E3 1240
    24GB DDR3 ECC
    2x 450GB SAS 15K RAID 1

    Debian 7 Wheezy, 64 bit
    Linux 3.2.0-4-amd64


    What is port forwarding?

    NOTE: If you have bought VPS / Dedicated server, you won't need to forward port. You can skip this.

    If your server is behind a router which has NAT on, no one will be able to access to your server by default. This is default operation on which routers work. There are two IPs involved, external and internal. Internal IP is only accessible within your network and it is given to devices and PCs by DHCP server which is located in your router. It is usually 192.168.X.X or 10.0.X.X. External IP is your "public" IP on which you will be seen on internet. This IP is normally assigned to your router. You can check your internal IP via command prompt by typing ipconfig (ifconfig on unix) and your external IP is visible here. If those IPs are different, then you have NAT on your router and you will have to forward a port.

    Forwarding port is what it is called, forwarding. Lets assume you have already starbound server on. It will listen by default 21025 TCP port. Your friend wants to join you, you give him an internal IP address. He will be unable to join since only people behind your router will have access to your internal IP. Then you will give him external IP address. He will still be unable to join and here is reason why:
    Your internet service provider will provide only X amount of external IP addresses. Due to this, routers usually take only one external address for themselfs and then share it across your network. This means that by giving your friend an external IP address, he is actually connecting to your router since your router doesn't have rule to forward TCP 21025 packets to your computer which has starbound server on. No wonder he can't connect to your starbound server. In other words, by port forwarding "TCP/21025 -> 192.168.1.5" you say to your router that any packets that are marked to go to TCP 21025 will be forwarded to computer under internal IP 192.168.1.5. By this rule, your friends traffic will be forwarded to your starbound server and you will be able to play.

    Port forwarding is always the same but all routers have different user interface. That is the reason why there isn't just one guide on how to do it. I'm sure you can find a HOWTO inside your routes manual (which should be available at your routers manufacturer website) or here. Also, if you understood what port forwarding is, you should be able to figure out what to do.



    Firewall

    We will be using iptables as a firewall. It should come preinstalled with Debian. I like to have all ports closed and open ones I need, if you don't want this kind of setup then you can skip this whole step. Also if you have NAT then skip this step.

    By default, iptables isn't blocking anything so we need it to block everything and only accept traffic that we allow. Now heres a big warning: If you manage to block yourself out of your server, there is nothing you can do unless you have physical access to your server or via IPMI/other. Blocking your SSH port will obv get you kicked out of it! I hold no responsibility if you manage to do so and I will not provide any support to recover.

    I like webGUIs to manage things on my servers and there is one perfect called webmin. There is simple and easy tutorial on how to install it and you should use it, since my guide might be (and will be eventually) out of date.

    First, lets install dependencies that webmin requires:
    Code:
    sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
    Now lets download .deb package to temp folder and install it:
    Code:
    cd /tmp/
    wget http://prdownloads.sourceforge.net/webadmin/webmin_1.660_all.deb
    sudo dpkg --install webmin_1.660_all.deb
    After this, you should get following text:
    (Note: You should change the default port webmin uses for security reasons. I'm not going to show you how, you can use google. This step is optional.)
    Now you need to login to webmin with your sudo or root user. Connect to https://[your IP]:[port] (Default port 10000) via your browser and login. Go to Networking - Linux Firewall. Choose "Block all except SSH and IDENT on external interface" and hit "Setup Firewall". You will get this page in front of you and this is where you will be opening ports you need. I will show you how to open one for Starbound server.

    By default, Starbound listens traffic that comes to 21025 TCP. So lets open that. Under "Input" (comming connection aka clients trying to connect to you), click "Add Rule". Now don't be scared, it looks complicated but it is easy to use. For rule comment, you can add Starbound server. It is not required. Change "Action to take" to "Accept" since we want to accept starbound traffic. For "Network Protocol", Change Ignored to Equals and make sure TCP is chosen. On "Destination TCP or UDP port", change "Ignored" to "Equals" and enter 21025 on empty field. [Picture] Click "Create". Now you should see your rule added "Accept - If protocol is TCP and destination port is 21025".

    NOTE: Obviously you need also to open webmin port to access it before you will apply configuration - otherwise you will get blocked from it! Do it before you apply configuration. And yes, by your own, you already know how to open port! If you manage to fail, just use this panic command:
    Code:
    sudo iptables -A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
    Click "Apply Configuration". Done.


    SteamCMD and Starbound:

    We will be using Steam to download Starbound. Again, you should use official tutorial here, my method can and will be eventually old. Also, you will need an access to your email (where steam is registered).

    First of all, steam is 32bit program where as my Debian is 64bit. This means that I need few 32bit libraries to run SteamCMD. I will install "ia32-libs" package since I need it for other purposes also, but you may install "lib32gcc1" as it is actually only one required to run SteamCMD:
    Code:
    sudo apt-get install lib32gcc1
    Lets download SteamCMD to steamcmd folder under your home directory. It will come compressed so we need to extract files (like .zip)
    Code:
    cd ~
    mkdir steamcmd
    cd steamcmd
    wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
    tar zxvf steamcmd_linux.tar.gz
    You will need also permission to execute that file:
    Code:
    chmod +x steamcmd.sh
    Next, start steamcmd:
    Code:
    ./steamcmd.sh
    Wait it up to download files and update itself. When you see "Steam>", you are ready. First, we need to login to our steam account which has Starbound since dedicated server isn't publicly available (atleast when I was writing this tutorial). It is safe to use your username/password, it's official steam application. So, login to your account:
    Code:
    login USERNAME
    It will ask you a password. Enter it. (NOTE: IT WILL BE VISIBLE WHEN YOU TYPE IT!) Also since this is new computer you will log into, steam guard will get an alert and you will have to retrieve 5 character long code from your email which steam has sent you. Enter it. When you are logged in, lets specify a folder where you want to download and install Starbound into. I want it o be in my home directory under starbound folder so I enter:
    Code:
    force_install_dir ../starbound/
    Next, lets start downloading and installing starbound. This will take a while, depending on your internet connection:
    Code:
    app_update 211820
    After it is downloaded, type exit and hit enter. Now navigate to your starbound folder and linux64 folder
    Code:
    cd ~/starbound/linux64
    Before we will be able to launch the server, we need to install some dependencies.
    Code:
    sudo apt-get install libpng12-0
    To launch the server:
    Code:
    ./starbound_server
    To shutdown the server, press CTRL-C once.


    What now?
    - Starbound will get updated frequently. You will also need to update your server files. There are many ways to update them. You can follow my tutorial from launching SteamCMD, you can write a script to automate the process or you can use ready scripts that users have posted in this forum
    - You might want to create or get one of the launchscripts in this forum for init.
    - You might want to configure your Starbound server config files.
    - You might want to check other cool stuff on this forum for your server.
     
    Last edited: Jul 19, 2014
    Symmasolan likes this.
  2. DaPaBe1999

    DaPaBe1999 Intergalactic Tourist

    HEYYYEYYYEYYYYEEE HEEEEYEEEEYEEEE, I said HEY, that's a pretty amazing post.
     
  3. Syntax42

    Syntax42 Pangalactic Porcupine

    Nice guide for those who want to use Debian.

    I wouldn't use webmin for the few tasks to set up a Starbound server, but I could see it being useful for doing a lot more.

    If you use Ubuntu 12.0.4 LTS, you don't have to worry about installing dependencies and can go straight to installing SteamCMD and running the server after downloading.

    I think setting up iptables is unnecessary for a gaming server as long as you are only exposing the game server's port(s) to the outside world on your router. If you have to expose port 22 for remote SSH access, setting up a connection limit on that port is a good idea.
     
  4. Speedrookie

    Speedrookie Space Spelunker

    got through most of it with no probs but i have this when i start it.

    ./starbound_server: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./starbound_server)
    ./starbound_server: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./starbound_server)
    ./starbound_server: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./starbound_server)
     
  5. germyliok

    germyliok Intergalactic Tourist

    Thanks! That works.
    How can I chat with players through console? Is it possible?
    And what about kick/ban?
     
  6. Syntax42

    Syntax42 Pangalactic Porcupine

    Kicking, banning, and console commands are not implemented at this point in the beta. Only give your server information out to those you trust or set up unique passwords for every user if you want full control.
     
  7. Malinka

    Malinka Yeah, You!

    Thanks for the post.

    But I have the same problem like speedrookie.
    When I try to start the server I get following error:
    ./starbound_server: /lib/libpthread.so.0: version `GLIBC_2.12' not found (required by ./starbound_server)
    ./starbound_server: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./starbound_server)
    ./starbound_server: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./starbound_server)
    ./starbound_server: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./starbound_server)

    Can someone help me? Please.
     
  8. ReaZaaa

    ReaZaaa Intergalactic Tourist

    Example for an update-script:
    Code:
    ./steamcmd/steamcmd.sh +login steamname password +force_install_dir ./starbound +app_update 211820 +logout +quit
     
  9. kaski

    kaski Aquatic Astronaut

    Coming back to starbound and this guide is still valid, just checked. Launching doesn't have anymore .sh script but the executable itself, I changed that part of the guide. If you want server to stay online when closing the SSH client, use program called screen.

    Also about those errors, I guess you can just DL the libstdc++ .deb file and extract it. However I just installed this on clean debian server and I had no problems. If you still have this problem, I suggest you to just google the error message. I found dozens of other posts which are solved.
    3.10.23-xxxx-std-ipv6-64
    Debian GNU/Linux 7.6
     
  10. wilminator

    wilminator Aquatic Astronaut

    I'm posting a CentOS version of this guide in case anyone is interested. I'm just meeting the two post requirement :p
     
  11. newdark

    newdark Void-Bound Voyager

    I turned the work above into a nice little bash script here is the gist.

    https://gist.github.com/newdark/9cee55c52711262b72fc

    Code:
    wget -O install_starbound.sh http://bit.ly/1Ehneqb
    chmod +x install_starbound.sh
    ./install_starbound.sh 
    when prompted for user name password that is going to be your steam username and password
     
    Last edited: Feb 22, 2015
  12. DannyIkard

    DannyIkard Space Hobo

    I wrote a script as well. It's a one-stop shop for a dedicated starbound server on Linux. Let me know if you have any issues. Should make running a Starbound DS pretty easy.

    https://github.com/DannyIkard/starbound-ds
     

Share This Page