StendhalLocalhostServerOnLinux: Difference between revisions
Content deleted Content added
imported>Oslsachem →Setting up a localhost server: added hints |
imported>Kribbel m link for skipping |
||
| (67 intermediate revisions by 6 users not shown) | |||
Line 1:
{{Navigation for Stendhal Top|Building & Hosting}}
This guide applies to:
*Marauroa
*Stendhal 0.
<br>
= Setting up a localhost server =
This guide will teach you how to set up a server on your Linux machine
*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)''
*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 '''[[StendhalLocalhostServerOnLinux#Choosing_the_Java_Virtual_Machine|Choosing the Java Virtual Machine]]'''.
For '''advanced''' MySQL configuration, keep reading.
== Setting up MySQL ==
Install MySQL:
sudo apt-get install mysql-server
Line 20 ⟶ 26:
ln -s /path/to/file-name/mysql-connector-java-5.1.10.jar mysql-connector.jar
After you've installed MySQL, make sure you have a database ready for it.
At a command line, type
mysql -u NAME -p
if you need a password for your server (by default, you don't).
If you don't need a password, omit the "-u NAME -p" part.
At the prompt that appears, type
create database marauroa;
grant all on marauroa.* to 'FOO'@'localhost' identified by 'BAR';
'''FOO and BAR are the username and password to be used by Marauroa''', respectively. Replace them with whatever you want. If the user doesn't exist, it will be created. '''Remember these values (FOO and BAR)!'''
If you get a problem like:
ERROR 1044 (42000): Access denied for user 'FOO'@'localhost' to database 'marauroa'
then you need to login to mysql as the root mysql user, who should have 'grant' access. As root you can then try
grant all on marauroa.* to 'FOO'@'localhost' identified by 'BAR';
again
'''Note''': It is recommended to edit the MySQL configuration file to disallow external access if you are just going to use it for local testing, or simply use a firewall to block external access to the database.
== Choosing the Java Virtual Machine ==
Stendhal works with OpenJDK or
For Sun Java: Use your Package manager to download '''OpenJDK
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
Line 30 ⟶ 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:
*''java-1.
*''java-gcj 1042 /usr/lib/jvm/java-gcj''
*''java-
now, lets say you want to use the ''java-
update-java-alternatives --set java-
Now run
java
again to check it worked.
==
Download a current version of the Stendhal server, ''stendhal-server-{{version}}.zip'' from [http://arianne.sourceforge.net/?arianne_url=games/game_stendhal#downloadsection arianne.sf.net].
If you want to compile it yourself from CVS or the source code provided at the downloads link, then see [[HowToBuildStendhal|How to build Stendhal]] for more info. If you run a Linux System, then you have the necessary tools to get everything else.
== Create the server directory ==
Line 73 ⟶ 76:
== Stendhal server files ==
Unzip the stendhal server zip which you downloaded, into the stendhal_server directory.
Done!
==
The first time you run the server a configuration file for the server (named ''server.ini'') will be generated.
There is a script ''runserver.sh'' in the stendhal_server directory - you may need to make it executable first.
So
cd /path/to/stendhal_server
To make it executable, in a command prompt type
chmod u+x runserver.sh
To start it from a command prompt, type
./runserver.sh
Now, it will ask you questions.
=== H2 database ===
For the '''fast''' installation
* hit ''Enter'' to accept the defaults, that you want '''H2''' database
Line 104 ⟶ 97:
server.ini has been generated
'''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 ===
If you want to use MySQL then see below for more details:
When it asks you for...
Line 110 ⟶ 105:
*database name, hit enter to use the default (marauroa)
*host, hit enter to use the default (localhost)
*user, '''write the username you used in giving MySQL permissions (FOO)'''
*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.
'''Warning:''' Any value for the RSA key generation smaller than 512 may cause the server not to work properly and refuse the client connections.
Download a recent mysql-connector.jar from the [https://dev.mysql.com/downloads/connector/j/ MySQL site].
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
== Stopping the Server ==
In the server window just type '''CTRL+c'''
== Starting the Server again ==
To start the stendhal server again you can just type from a command prompt:
./runserver.sh
'''Note:''' Remember that the server configuration file (''server.ini'') is only generated the first time you run the server unless you delete it.
== Have fun ==
Line 145 ⟶ 136:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
</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
LOCALCLASSPATH=.:data/script/:data/conf/:stendhal-server-$STENDHAL_VERSION.jar:marauroa.jar:mysql-connector.jar:log4j.jar:commons-lang.jar
Line 150 ⟶ 144:
In this case the user had his log4j.jar in the folder called ''libs'' but the classpath expects it to be in the main folder where runserver.sh ran from. So you can: edit the classpath, replacing ''log4j.jar'' above with ''libs/log4j.jar'' '''or''' move the file.
=== MySQL possible error ===
If when you try to run the server later, you get this error in the log:
| |||