StendhalLocalhostServerOnLinux: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Oslsachem
feeble attempt to update the guide
imported>Kribbel
m link for skipping
 
(50 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Navigation for Stendhal Top|Building & Hosting}}

This guide applies to:
This guide applies to:
*Marauroa 2.1 and above
*Marauroa 3.0 and above
*Stendhal 0.65.5 and above
*Stendhal 0.95 and above
<br>
<br>
= Setting up a localhost server =
= Setting up a localhost server =
This guide will teach you how to set up a server on your Linux machine. The server will be a local one, so people from around the world cannot get to your server. Only those who are directly connected to you via a LAN can connect to this server. The required packages are:
This guide will teach you how to set up a server on your Linux machine. The required packages are:
*A compiled version of the Stendhal Server, version {{version}}
*A compiled version of the Stendhal Server, version {{version}}
*GNU/Linux ''(This may be others, the directions should apply almost exactly to any *nix system)''
*GNU/Linux ''(This may be others, the directions should apply almost exactly to any *nix system)''
*Command-line access ''(ask system administrator if it's a problem)''
*Command-line access ''(ask system administrator if it's a problem)''


For '''easy''' H2 database configuration (which is shipped with Stendhal and is installation-free) just skip straight to '''Choosing the Java Virtual Machine'''.
For '''easy''' H2 database configuration (which is shipped with Stendhal and is installation-free) just skip straight to '''[[StendhalLocalhostServerOnLinux#Choosing_the_Java_Virtual_Machine|Choosing the Java Virtual Machine]]'''.


For '''advanced''' MySQL configuration, keep reading.
For '''advanced''' MySQL configuration, keep reading.
Line 43: Line 45:


== Choosing the Java Virtual Machine ==
== Choosing the Java Virtual Machine ==
Stendhal works with OpenJDK or Sun Java, you will need Java 5 or greater.
Stendhal works with OpenJDK or Oracle Java, you will need Java 7 or greater.


For Sun Java: Use your Package manager to download '''OpenJDK 6''' or Sun Java 1.5 or greater version. At a command line, type
For Sun Java: Use your Package manager to download '''OpenJDK 7''' or Oracle Java 7 or greater version. At a command line, type
java -version
java -version
and if you see anything other than the new java you just installed, then you need to update the java used. At a command line, type
and if you see anything other than the new java you just installed, then you need to update the java used. At a command line, type
Line 51: Line 53:
(using sudo if you are an ubuntu user, or as root if you are another linux user) which should give you output something like this:
(using sudo if you are an ubuntu user, or as root if you are another linux user) which should give you output something like this:


*''java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun''
*''java-1.7.0-oracle 53 /usr/lib/jvm/java-1.7.0-oracle''
*''java-gcj 1042 /usr/lib/jvm/java-gcj''
*''java-gcj 1042 /usr/lib/jvm/java-gcj''
*''java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk''
*''java-7-openjdk 1061 /usr/lib/jvm/java-7-openjdk''


now, lets say you want to use the ''java-6-openjdk''. Then you type
now, lets say you want to use the ''java-7-openjdk''. Then you type
update-java-alternatives --set java-6-openjdk
update-java-alternatives --set java-7-openjdk
Now run
Now run
java --version
java -version
again to check it worked.
again to check it worked.


Line 95: Line 97:
server.ini has been generated
server.ini has been generated


'''Warning:''' Any value for the RSA key generation other than 512 may cause the server not to work properly and refuse the client connections. Therefore, just accept this default value. This is a known bug.
'''Warning:''' Any value for the RSA key generation small than 512 may cause the server not to work properly and refuse the client connections.


=== MySQL database ===
=== MySQL database ===
Line 105: Line 107:
*user, '''write the username you used in giving MySQL permissions (FOO)'''
*user, '''write the username you used in giving MySQL permissions (FOO)'''
*password, '''write the password you used giving MySQL permissions (BAR)'''
*password, '''write the password you used giving MySQL permissions (BAR)'''
*RSA key size- This is to make sure that the login information is valid and secure.
*port, anything above 1024. 32160 is the default for stendhal, but it can be anything above 1024
'''Warning:''' Any value for the RSA key generation smaller than 512 may cause the server not to work properly and refuse the client connections.
*game, type "stendhal" (or a number for that, if a multiple-choice menu appears)

*turn time, or how long the server takes to process each event, choose anything above 200, but below 1000. This is in milliseconds. default is 300
Download a recent mysql-connector.jar from the [https://dev.mysql.com/downloads/connector/j/ MySQL site].
*log and stats generation logs, use the default ("./") - it's in the same directory as everything else
*RSA key size, choose anything smaller than 1024 bits, but greater than 512 (or equal to). This is to make sure that the login information is valid and secure.
'''Warning:''' Any value for the RSA key generation other than 512 may cause the server not to work properly and refuse the client connections. Therefore, just accept this default value. This is a known bug.


Well, thats everything! When it's finished, you'll have a new file, "server.ini". Don't lose it, as it contains the information to get your server up & running, as well as the key to do that. If Marauroa won't start, and nor will your server, check to see if that INI file is there (at the same directory! NOWHERE ELSE!) and if it is not, try running the runserver.sh script again; the file could have changed when updating the RSA keys
Well, thats everything! When it's finished, you'll have a new file, "server.ini". Don't lose it, as it contains the information to get your server up & running, as well as the key to do that. If Marauroa won't start, and nor will your server, check to see if that INI file is there (at the same directory! NOWHERE ELSE!) and if it is not, try running the runserver.sh script again; the file could have changed when updating the RSA keys
Line 136: Line 136:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
</pre>
</pre>

''<span style="color:red;">DEPRECATED:</span> "log4j.jar" is now intended to be located in "libs" directory''

Please open runserver.sh in a text editor. You'll see the classpath defined there, something like
Please open runserver.sh in a text editor. You'll see the classpath defined there, something like
LOCALCLASSPATH=.:data/script/:data/conf/:stendhal-server-$STENDHAL_VERSION.jar:marauroa.jar:mysql-connector.jar:log4j.jar:commons-lang.jar
LOCALCLASSPATH=.:data/script/:data/conf/:stendhal-server-$STENDHAL_VERSION.jar:marauroa.jar:mysql-connector.jar:log4j.jar:commons-lang.jar