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.

Server Help Dedicated linux server

Discussion in 'Multiplayer' started by Mastah, Dec 5, 2013.

  1. Mastah

    Mastah Seal Broken

    Hi there.

    I'll just present you a fast tutorial to create a simple dedicated server of Starbound for Linux. This has been tested on a Debian 7 distribution (most likely work for Ubuntu and Debian 6).

    First you'll need to upload the directory "assets" and either "linux 32" or "linux 64" (depending of your operating system) on your dedicated server.

    For that purpose I've done the following:
    Code:
    opt
        |_ starbound
                    |_ assets
                    |_ bin (content of linuX32/64)
    You'll need to chmod +x the following file : starbound_server

    After that you can use this script (/etc/init.d/starbound join as a file to this thread) to start/stop/reload starbound.

    Edit: well somehow I can't upload a file :(

    Code:
    #!/bin/sh
    
    ### BEGIN INIT INFO
    # Provides:      starbound
    # Required-Start:    $local_fs $remote_fs $network $syslog $named
    # Required-Stop:    $local_fs $remote_fs $network $syslog $named
    # Default-Start:    2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: starts the starbound server
    # Description:      starts starbound using start-stop-daemon
    ### END INIT INFO
    
    #LD_LIBRARY_PATH=/opt/starbound
    PID=/var/run/starbound/starbound.pid
    # Server BIN
    DAEMON=/opt/starbound/bin/starbound_server
    # Name of process
    NAME=Starbound
    # Desc of process
    DESC="starbound server"
    # User used to run the process (do not use root)
    USER=starbound
    
    
    # test exec
    test -x $DAEMON || exit 0
    
    set -e
    
    . /lib/lsb/init-functions
    
    
    start() {
            # start the server
                    start-stop-daemon --start --make-pidfile --pidfile $PID --chuid $USER --exec $DAEMON -- $DAEMON_OPTS > /dev/null &
    }
    
    stop() {
            # gracefully stop the server
            start-stop-daemon --stop --signal INT --pidfile $PID --chuid $USER --oknodo --exec $DAEMON
    }
    
    case "$1" in
            start)
                    log_daemon_msg "Starting $DESC" "$NAME"
                    start
                    log_end_msg $?
                    ;;
    
            stop)
                    log_daemon_msg "Stopping $DESC" "$NAME"
                    stop
                    log_end_msg $?
                    ;;
    
            restart)
                    log_daemon_msg "Restarting $DESC" "$NAME"
                    stop
                    sleep 1
                    start
                    log_end_msg $?
                    ;;
    
            status)
                    status_of_proc -p $PID "$DAEMON" starbound
                    ;;
    
            *)
                    echo "Usage: $NAME {start|stop|restart|status}" >&2
                    exit 1
                    ;;
    esac
    
    exit 0
    Where:
    Code:
    PID: location of the pid file (change according to your needs)
    DAEMON: location of the Starbound binary
    NAME: process name
    DESC: process description
    USER: user that will run the process
    
     
    Last edited: Dec 5, 2013
    Neihan and bigmess like this.
  2. Mastah

    Mastah Seal Broken

    Temp reply for further information if needed.
     
  3. Patchu

    Patchu Intergalactic Tourist

    Edit: As far as CentOS goes, the init.d script would need to be mostly rewritten.

    However, there are issues getting the Starbound server to run under CentOS 6.5 in the first place, namely issues with the supported versions of gcc and openssl (the Starbound server was compiled against newer versions than what CentOS supports).
     
    Last edited: Dec 5, 2013
  4. kalasai

    kalasai Tentacle Wrangler

    Thanks for this. Works Fine ! Have you some returns off the stability ? Need regular reboot ?
     
  5. Mastah

    Mastah Seal Broken

    So far I haven't had time to really try the game, so I can't really tell if the server is stable. I assume the server is what you are running on, in solo play anyway, so probably stable enough.
    Also I recommend to shutdown the server after each use, to prevent any kind of hacking what so ever (Server code is in beta and could potentially contain breach). Hence why you really need to execute it with a proper account meant just for Starbound.
     
  6. kalasai

    kalasai Tentacle Wrangler

    I had make a modification for add command " backup "

    The script copy the directory " universe " with date incrementation. You can too make multiple backup per day.

    Code:
    #!/bin/sh
    
    ### BEGIN INIT INFO
    # Provides:      starbound
    # Required-Start:    $local_fs $remote_fs $network $syslog $named
    # Required-Stop:    $local_fs $remote_fs $network $syslog $named
    # Default-Start:    2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: starts the starbound server
    # Description:      starts starbound using start-stop-daemon
    ### END INIT INFO
    
    #LD_LIBRARY_PATH=/opt/starbound
    PID=/var/run/starbound/starbound.pid
    # Server BIN
    DAEMON=/opt/starbound/bin/starbound_server
    # Name of process
    NAME=Starbound
    # Desc of process
    DESC="starbound server"
    # User used to run the process (do not use root)
    USER=starbound
    #Backup Path ( Create a directory for backup )
    BACKUPPATH=/.../
    #Game path ( The path for locate the universe folder )
    SBPATH=/.../
    
    ME=`whoami`
    as_user() {
      if [ "$ME" == "$USER" ] ; then
        bash -c "$1"
      else
        su - $USER -c "$1"
      fi
    }
    
    
    # test exec
    test -x $DAEMON || exit 0
    
    set -e
    
    . /lib/lsb/init-functions
    
    
    start() {
            # start the server
                    start-stop-daemon --start --make-pidfile --pidfile $PID --chuid $USER --exec $DAEMON -- $DAEMON_OPTS > /dev/null &
    }
    
    stop() {
            # gracefully stop the server
            start-stop-daemon --stop --signal INT --pidfile $PID --chuid $USER --oknodo --exec $DAEMON
    }
    
    case "$1" in
            start)
                    log_daemon_msg "Starting $DESC" "$NAME"
                    start
                    log_end_msg $?
                    ;;
    
            stop)
                    log_daemon_msg "Stopping $DESC" "$NAME"
                    stop
                    log_end_msg $?
                    ;;
            backup)
                    echo "Backing up Starbound universe"
      if [ -d $BACKUPPATH/universe_`date "+%m.%d.%Y"` ]
      then
        for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
        do
          if [ -d $BACKUPPATH/universe_`date "+%m.%d.%Y"`-$i ]
          then
            continue
          else
            as_user "cd $SBPATH && cp -r universe $BACKUPPATH/universe_`date "+%m.%d.%Y"`-$i"
            break
          fi
        done
      else
        as_user "cd $SBPATH && cp -r universe $BACKUPPATH/universe_`date "+%m.%d.%Y"`"
        echo "Backed up universe"
      fi
          echo "Backup complete"
              ;;
            restart)
                    log_daemon_msg "Restarting $DESC" "$NAME"
                    stop
                    sleep 1
                    start
                    log_end_msg $?
                    ;;
    
            status)
                    status_of_proc -p $PID "$DAEMON" starbound
                    ;;
    
            *)
                    echo "Usage: $NAME {start|stop|backup|restart|status}" >&2
                    exit 1
                    ;;
    esac
    
    exit 0
    
    Use crontab for automatic backup :)
     
  7. Leonick

    Leonick Master Chief

    The server executable is pretty big. How much ram does it use?

    I also doubt the server needs the whole assets folder. Maybe a few of the config files but what need would it have of all the graphical assets?
     
  8. dwi

    dwi Scruffy Nerf-Herder

    Unfortunetly it does require whole assets folder :/
     
  9. Leonick

    Leonick Master Chief

    Huh. Wonder what for? Answer is probably "beta" :p

    Oh well, looks like I've got quite a bit of uploading to do before I can even try running it on my server.
     
  10. DanMero

    DanMero Aquatic Astronaut

    With that script, i can get updated my server every day? have autoupdate?
     
  11. Kainzo

    Kainzo Intergalactic Tourist

    edited - got a post below.
     
    Last edited: Dec 5, 2013
  12. eueln

    eueln Space Hobo

    It's worth noting that SteamCMD can be used in place of manually uploading the server contents for each update -- it tends to be faster that way.

    Code:
    steamcmd.sh +login yourusername +force_install_dir /opt/starbound/ +app_update 211820 validate +quit
     
    Last edited: Dec 5, 2013
  13. Drakythe

    Drakythe Void-Bound Voyager

    It is also worth noting that Debian 6 apparently only supports/has up to libssl0.9.8.x and Starbound tries to use libssl1.0.0.

    I am updating my server right now to Debian 7 to see if I can get this up and running. Thanks for doing all the grunt work :)
     
  14. Kainzo

    Kainzo Intergalactic Tourist

    Any thoughts on this?

    Code:
    starbound@box:~/servers/sanctum/bin$ sh starbound.sh start
    Starting starbound server: Starboundstarbound.sh: 35: starbound.sh: start-stop-daemon: not found
    .
     
  15. Drakythe

    Drakythe Void-Bound Voyager

    Just an update. Running an apt-get update/upgrade/dist-upgrade (in that order) fixed my problem, so Debian 6 is out unless you want to mess around with package backporting.

    However I have a new problem. When I run "/etc/init.d/starbound start" I get "[ ok ] Starting star bound server: Starbound." but when I grep for it it in my running apps (ps -ef | grep starbound) It is not running. So it seems like maybe it is starting up and then dying immediately?
     
  16. shamus03

    shamus03 Big Damn Hero

    Hey, I get the following error:

    Code:
     * Starting starbound server Starbound
    start-stop-daemon: unable to open pidfile '/var/run/starbound/starbound.pid' for (Permission denied)
    What's going wrong?
     
  17. kalasai

    kalasai Tentacle Wrangler

    The user who launch the application have no right on the directory /var/run/starbound/ ( Permission Denied for create PID File )

    Normaly, you create a specific user for launch the starbound server, and you locate the pid file in the starbound server directory.
     
  18. Mastah

    Mastah Seal Broken

    718M virtual, 510M really used.
     
  19. Mastah

    Mastah Seal Broken

    You probably don't have start-stop-daemon installed on your distribution.
     
  20. Mastah

    Mastah Seal Broken

    In the bin directory you should have a game log file. Try to find what is the cause of the problem in that file. Else you can try to remove "> /dev/null" from the start command, it will give you the console output.
     

Share This Page