UPDATED: Linux Dedicated Server Startup Guide

We've posted an important announcement regarding the current situation and the future of the game: Announcement

  • UPDATED: Linux Dedicated Server Startup Guide

    I thought I would write a quick basic guide to get you up and running on a linux server.

    Preamble:
    I have a working knowledge of several distros of linux but I always prefer Ubuntu LTS flavors.
    I purchased VPS services from a reputable, trusted company that I have used before.
    I chose x64 architecture and Ubuntu 12.04 lts.

    The VPS specs:
    • Quad Core
    • 6GB Memory
    • 30GB Storage
    • 2TB Traffic Limit
    • 10Gbit Connection
    1. Everyone has their own methods of getting around linux on a remote server
    but here I will be using what I used to get through this.

    Download an SSH client of your choosing. I prefer Putty. You can find it chiark.greenend.org.uk/~sgtatham/putty/download.html

    2. Connect to your remote linux server. (I log in as "root" and do my "business", when everything is as it should be, you can start buttoning down your server for more security.

    3. Download the dedicated server files. (The zip will contain dedicated server startup scripts for windows, mac & linux.

    4. Install JAVA on the dedicated server. PLEASE NOTE: You may have to use "sudo apt-get"
    • apt-get update
    • java -version (check to see if java is already installed, and what version if so)
    • apt-get install default-jre
    • apt-get install default-jdk
    • apt-get install openjdk-7-jre (I'm not 100% positive this is needed but it won't hurt your server nor slow it down)
    • apt-get install openjdk-7-jdk
    • apt-get install python-software-properties
    • add-apt-repository ppa:webupd8team/java
    • apt-get update
    • apt-get install oracle-java7-installer ((( I could not get the linux startup script to run without installing the oracle JDK ))))
    5. Install "Screen"
    • apt-get install screen
    6. At this point lets test the server and its dependencies (JAVA) to see if everything is working like it should.
    • start the server with:

      Source Code

      1. java -Xmx1G -Xms32M -jar server.jar
      in the terminal.
    • PLEASE NOTE THAT THE Xmx and Xms variables should reflect the amount of memory you have/want to use.
    • Xms = START the server with certain amount of memory. Example: Xms1G this = 1 Gigabyte (start the server with this minimal amount of memory) [format is numerical amount, followed by delegated M for megabytes, G for gigabytes etc]
    • Xmx = GIVE the server this defined MAX amount of memory when needed. Example: Xms6G = 6 Gigabytes
    • you should get server success, if you do not then chances are that you don't have all the JAVA repositories/dependencies that you need.
    • Reboot the server here and log back in via your chosen SSH client.
    • I highly recommend you change your SSH listening port from the default to avoid brute force SSH attempts, and believe me sooner or later it WILL happen.
    • I also recommend a package called fail2ban to auto block ip's of people who are trying to attack your server.

    7. Edit the "server.properties" file with your desired settings. (WILL INCLUDE MORE DETAILS HERE FOR YOU WHEN FINISHED)

    8. You will need to "cd" to the directory where your dedicated rising world server files are located and start the script OR use the java start method mentioned above and you should be ready to rock with your server showing up in the server list via "Multiplayer" in the game.

    9. Now if you have configured everything and started the server with

    Source Code

    1. java -Xmx1G -Xms32M -jar server.jar
    followed by success and connected to server hive, then we know it works.

    I welcome contributions and input on this so we can clean it up and make it something worth reading to people interested in running their own server.




    Epic Insomniacs Rising World!

    Come have some fun @ 62.213.195.243:4255 or find us in the server list:
    [420] Epic Insomniacs Rising World Server

    The post was edited 3 times, last by Droophoria ().

  • AFAIK, some steps are not necessary, and while you install "screen", you never make use of it :) The server actually comes with a Shell script to launch the game with "screen".

    ** 2016-01-30 : You need to install Java 8. Support for Java 7 has ended last year. **

    1. Install Oracle Java 8

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer oracle-java8-set-default


    2. Install dependencies

    apt-get install screen python-software-properties mysql-server

    3. Download dedicated server file here
    4. Extract files (ex: /home/$USER/risingworld) and edit server.properties

    NOTE : When using MySQL, use the root user by default. For more experienced users, create and configure your Rising World Server user accordingly.

    5. Start server

    cd ~/risingworld
    ./linux_startscript.sh start


    If everything worked fine, running ./linux_startscript.sh status should display information about the server running normally.

    6. For advanced users only, create an init script

    Note : this script has not been tested, but should be a good ground for starting. Feedback appreciated!

    Display Spoiler

    Source Code

    1. #! /bin/sh
    2. ### BEGIN INIT INFO
    3. # Provides: Rising World Server
    4. # Required-Start: $remote_fs $syslog
    5. # Required-Stop: $remote_fs $syslog
    6. # Default-Start: 2 3 4 5
    7. # Default-Stop: 0 1 6
    8. # Short-Description: Start Rising World Dedicated Server
    9. # Description: This file should be saved as /etc/init.d/risingworld
    10. ### END INIT INFO
    11. # Author: LordFoobar <lordfoobar@mind2soft.com>
    12. # Set the user running the server (other than root)
    13. USER=
    14. DESC="Rising World Game Server"
    15. NAME=linux_startscript.sh
    16. DAEMON=/home/$USER/risingworld/$NAME
    17. DAEMON_ARGS=""
    18. SCRIPTNAME=/etc/init.d/risingworld
    19. # Exit if the package is not installed
    20. [ -x "$DAEMON" ] || exit 0
    21. # Load the VERBOSE setting and other rcS variables
    22. . /lib/init/vars.sh
    23. # Define LSB log_* functions.
    24. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
    25. # and status_of_proc is working.
    26. . /lib/lsb/init-functions
    27. #
    28. # Function that starts the server
    29. #
    30. do_start()
    31. {
    32. return exec su -l $USER -c "$DEAMON start $DEAMON_ARGS"
    33. }
    34. #
    35. # Function that stops the server
    36. #
    37. do_stop()
    38. {
    39. return exec su -l $USER -c "$DEAMON stop"
    40. }
    41. #
    42. # Function that restarts the server
    43. #
    44. do_restart() {
    45. exec su -l $USER -c "$DEAMON restart"
    46. }
    47. case "$1" in
    48. start)
    49. [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC"
    50. do_start
    51. case "$?" in
    52. 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    53. *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    54. esac
    55. ;;
    56. stop)
    57. [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC"
    58. do_stop
    59. case "$?" in
    60. *) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    61. esac
    62. ;;
    63. status)
    64. $DAEMON status
    65. ;;
    66. restart)
    67. [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC"
    68. do_restart
    69. case "$?" in
    70. 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    71. *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    72. esac
    73. esac
    74. ;;
    75. *)
    76. echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
    77. exit 3
    78. ;;
    79. esac
    80. :
    Display All

    The post was edited 2 times, last by LordFoobar ().

  • I am trying to log in using the linux_startscript.sh but I keep getting the "No Server title set" and then it exits. My linux_startscript is below. I have also altered all the names in the server.properties to the same naming scheme. I have probably made stupid oversight here but I am trying to learn Linux as I go with this. Thank you for help.


    Display Spoiler
    #!/bin/bash
    SCREEN_NAME="Teerian Crotia"

    txtgrn=$(tput setaf 2) # Green
    txtred=$(tput setaf 1) # Red
    txtbld=$(tput bold) # Bold
    txtreset=$(tput sgr0) # reset colors

    if [ ! -x `which screen` ]; then echo "You have to install screen first!"; exit 1; fi
    if [ ! -x `which java` ]; then echo "You have to install java first!"; exit 1; fi

    cd $(pwd)

    function checkTitle(){
    if [ -n "$1" ]; then
    SCREEN_NAME=$1
    else
    SCREEN_NAME=`grep -i 'server_screen_title' server.properties | tr -d '\n\r' | cut -f2 -d'='`
    fi

    if [ -z "$SCREEN_NAME" ]; then
    echo "${txtred}No server_title set. Set title to 'Rising World Server'${txtreset}"
    SCREEN_NAME="Rising World Server"
    fi

    if ! [[ $SCREEN_NAME =~ ^[a-zA-Z0-9_.-]+$ ]]; then
    echo "${txtred}The Server title contains invalid symbol. Only a-z A-Z 0-9 - _ . are allowed${txtreset}"
    exit 1;
    fi

    }

    case "$1" in
    start)
    checkTitle $2
    MEMORY=$(grep -i 'server_memory' server.properties | tr -d '\n\r' | cut -f2 -d'=')
    if [ -z "$MEMORY" ]; then
    echo "${txtred}No server_memory set. Server starts with 1024mb memory${txtreset}"
    MEMORY=1024
    fi
    if ! [[ $MEMORY =~ ^[0-9]+$ ]]; then
    echo "${txtred}The property 'server_memory' is not numeric${txtreset}"
    exit 1;
    fi

    if screen -ls | grep [.]${SCREEN_NAME}[[:space:]] > /dev/null
    then
    echo "${SCREEN_NAME} is already running";
    else
    screen -dmSL ${SCREEN_NAME} java -Xmx${MEMORY}m -Xms$(($MEMORY/2))m -jar server.jar

    if screen -ls | grep [.]${SCREEN_NAME}[[:space:]] > /dev/null
    then
    echo "${txtgrn}${SCREEN_NAME} is successfully started${txtreset}"
    else
    echo "${SCREEN_NAME} an error has orcuded${txtreset}"
    fi
    fi
    ;;
    stop)
    checkTitle $2
    if screen -ls | grep [.]${SCREEN_NAME}[[:space:]] > /dev/null
    then
    screen -S ${SCREEN_NAME} -p 0 -X quit
    echo "${txtgrn}${SCREEN_NAME} is successfully stopped${txtreset}"
    else
    echo "${txtred}No screen with name '${SCREEN_NAME}' found${txtreset}"
    fi

    ;;
    restart)
    $0 stop && $0 start || exit 1
    ;;
    status)
    checkTitle $2
    if screen -ls | grep [.]${SCREEN_NAME}[[:space:]] > /dev/null
    then
    echo "${SCREEN_NAME} is ${txtgrn}${txtbld}running${txtreset}"
    else
    echo "${SCREEN_NAME} is ${txtred}${txtbld}not running${txtreset}"
    fi
    ;;
    attach)
    checkTitle $2
    if screen -ls | grep [.]${SCREEN_NAME}[[:space:]] > /dev/null
    then
    screen -r ${SCREEN_NAME}
    else
    echo "${txtred}No screen with name '${SCREEN_NAME}' found${txtreset}"
    fi
    ;;
    *)
    echo "Usage: linux_startscript.sh {start|stop|restart|status|attach} [title]"
    exit 2
    esac
    exit 0
  • I am getting a weird java error after following these steps to the T twice.

    Here is the Java error:

    Source Code

    1. brandon@brandon-Mint-VM ~/Desktop/RisingWorldServer $ java -Xmx2G -Xms1G -jar server.jar
    2. Exception in thread "main" java.lang.UnsupportedClassVersionError: server/Main : Unsupported major.minor version 52.0
    3. at java.lang.ClassLoader.defineClass1(Native Method)
    4. at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    5. at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    6. at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    7. at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    8. at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    9. at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    10. at java.security.AccessController.doPrivileged(Native Method)
    11. at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    12. at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    13. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    14. at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    15. at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
    Display All


    Also, if I wanted to move my local LAN server to this Mint server, what would I need to do?

    Linux Mint 17.3
    3 GB RAM
    Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
  • java version "1.7.0_80"
    Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

    I'm wondering if this new distro of Linux Mint has some other Java in it and I can't see anything other than version 7 installed so... I think JDK 8 is still beta though so that wouldn't be on there anyways.

    Edit: Java 8 is released, I wonder if I pushed 8 if it would work.

    The post was edited 1 time, last by Humphrey_Max ().

  • Humphrey_Max wrote:

    java version "1.7.0_80"
    Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

    I'm wondering if this new distro of Linux Mint has some other Java in it and I can't see anything other than version 7 installed so... I think JDK 8 is still beta though so that wouldn't be on there anyways.

    Edit: Java 8 is released, I wonder if I pushed 8 if it would work.


    Yes. If you search the keyword "Java" on this forum, you'll find some post talking about it. I updated my first post to reflect that.
  • Worldpart generating...
    08/16/2016 04:32 PM server.Main
    SEVERE: Fatal error occurred!
    java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.<init>(ArrayList.java:152)
    at r.u.a(SourceFile:799)
    at r.u.a(SourceFile:704)
    at r.l.a(SourceFile:279)
    at r.l.a(SourceFile:579)
    at r.l.a(SourceFile:198)
    at server.util.a.a(SourceFile:144)
    at server.c.a(SourceFile:1192)
    at server.c.a(SourceFile:1098)
    at server.c.a(SourceFile:940)
    at server.Main.c(SourceFile:437)
    at server.Main.initApplication(SourceFile:283)
    at commons.JIWApplication.initialize(SourceFile:92)
    at com.jme3.system.NullContext.initInThread(NullContext.java:86)
    at com.jme3.system.NullContext.run(NullContext.java:129)
    at java.lang.Thread.run(Thread.java:745)

    Fatal error occurred!
    java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.<init>(ArrayList.java:152)
    at r.u.a(SourceFile:799)
    at r.u.a(SourceFile:704)
    at r.l.a(SourceFile:279)
    at r.l.a(SourceFile:579)
    at r.l.a(SourceFile:198)
    at server.util.a.a(SourceFile:144)
    at server.c.a(SourceFile:1192)
    at server.c.a(SourceFile:1098)
    at server.c.a(SourceFile:940)
    at server.Main.c(SourceFile:437)
    at server.Main.initApplication(SourceFile:283)
    at commons.JIWApplication.initialize(SourceFile:92)
    at com.jme3.system.NullContext.initInThread(NullContext.java:86)
    at com.jme3.system.NullContext.run(NullContext.java:129)
    at java.lang.Thread.run(Thread.java:745)


    Uncaught exception thrown in Thread[jME3 Headless Main,5,main]
    Shutdown 1 database threads...
    08/16/2016 04:32 PM x.a
    INFO: DatabaseTaskManager stopped!








    hello guys wat is here the problem i try to update my server en than i got this :p
    for more info letsdrive.be
    Rising-World server ip = 178.63.179.74
    Teamspeak 3= 178.63.179.74
    facebook= facebook.com/risingworld

    The post was edited 1 time, last by Jjustmee22 ().

  • @'LordFoobar

    I can't get the init script you wrote to work. There are a few typos, ex daemon is typed deamon, but that was easy to spot. The error i see in journalctl is " /etc/init.d/risingworld: 40: return: Illegal number: exec"

    The linux_startscript.sh works fine. Its the init script that isn't working for me. I will post the line that is giving the error below.


    Source Code

    1. return exec su -l $USER -c "$DAEMON start" # $DAEMON_ARGS"
    I commented out the daemon_args just to make sure that wasn't the problem.
  • Is it possible to run a dedicated server on a virtualbox guest machine?

    Naturally using NAT or network NAT and port-forwarding to port forward all the needed ports to host. In such a case the client should be connect to localhost, otherwise it is always possible to use Bridged Network configuration, giving the guest an network interface on the LAN.

    I should have enough CPU computing power (intel i7-4820K) and RAM (16GB) to make it working...

    Have you already done any trial about installing it in a virtualbox guest machine?
  • 4ndr34 wrote:

    Is it possible to run a dedicated server on a virtualbox guest machine?

    Naturally using NAT or network NAT and port-forwarding to port forward all the needed ports to host. In such a case the client should be connect to localhost, otherwise it is always possible to use Bridged Network configuration, giving the guest an network interface on the LAN.

    I should have enough CPU computing power (intel i7-4820K) and RAM (16GB) to make it working...

    Have you already done any trial about installing it in a virtualbox guest machine?



    why?

    you can run lan/dedicated server on windows, mac and linux
  • Most gaming servers out there for rent are virtual machines so I don't see what issues you'll have as far as resources go. As long as your virtual network adapter is bridged to the physical adapter, you should be able to run two IP addresses on a single device. Assuming this is your home gaming machine, just open up the necessary ports on your router and you're good to go.

    Just keep in mind that depending on how many people you plan to host for, you'll easily eat up 4GB of memory or more.
  • joni909 wrote:

    4ndr34 wrote:

    Is it possible to run a dedicated server on a virtualbox guest machine?

    Naturally using NAT or network NAT and port-forwarding to port forward all the needed ports to host. In such a case the client should be connect to localhost, otherwise it is always possible to use Bridged Network configuration, giving the guest an network interface on the LAN.

    I should have enough CPU computing power (intel i7-4820K) and RAM (16GB) to make it working...

    Have you already done any trial about installing it in a virtualbox guest machine?
    why?

    you can run lan/dedicated server on windows, mac and linux
    Because if it works, the server becomes indipendent by the host than the actual hardware and host OS that is running it, that is:
    • easier to mantain.
    • easier to migrate hardware and host OS.
    • easier to scale up and down. 8)
    EDIT: I can confirm that it runs round and smooth, :thumbsup:

    Right now I am reading docs and infos on the forum to configure the server to tune the gameplay experience.

    The post was edited 1 time, last by 4ndr34 ().

  • hello alls i god problems with the update


    this is what i got when i try to start

    Start context...
    java.sql.SQLException: failed to load commons/definitions/definitions.db: java.io.IOException: failed to remove existing DB file: /tmp/sqlite-jdbc-tmp--1748519013.db
    at org.sqlite.core.CoreConnection.open(CoreConnection.java:181)
    at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
    at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:26)
    at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
    at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
    at org.sqlite.JDBC.createConnection(JDBC.java:114)
    at org.sqlite.JDBC.connect(JDBC.java:88)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at d.a.a(SourceFile:46)
    at commons.definitions.Items.<clinit>(SourceFile:57)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at server.Main.b(SourceFile:374)
    at server.Main.initApplication(SourceFile:278)
    at commons.JIWApplication.initialize(SourceFile:236)
    at com.jme3.system.NullContext.initInThread(NullContext.java:87)
    at com.jme3.system.NullContext.run(NullContext.java:130)
    at java.lang.Thread.run(Thread.java:748)
    java.lang.NullPointerException
    at d.a.a(SourceFile:84)
    at commons.definitions.Items.<clinit>(SourceFile:59)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at server.Main.b(SourceFile:374)
    at server.Main.initApplication(SourceFile:278)
    at commons.JIWApplication.initialize(SourceFile:236)
    at com.jme3.system.NullContext.initInThread(NullContext.java:87)
    at com.jme3.system.NullContext.run(NullContext.java:130)
    at java.lang.Thread.run(Thread.java:748)


    thanks for helping :p
    for more info letsdrive.be
    Rising-World server ip = 178.63.179.74
    Teamspeak 3= 178.63.179.74
    facebook= facebook.com/risingworld