StendhalLocalhostServerOnLinux: Difference between revisions

From Arianne
Jump to navigation Jump to search
Content deleted Content added
imported>Immibis
MAJOR CHANGES AND BROUGHT UP-TO-DATE
imported>Kymara
Please lets keep X.XX as version else the guide gets out dated with every new release!!!
Line 1: Line 1:
This guide applies to:
This guide applies to:
*Marauroa 2.1
*Marauroa 2.1
*Stendhal 0.64
*Stendhal 0.64 and above
*Stendhal server 0.64


= 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 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:
*Marauroa version 2.1
*Marauroa version 2.1, see below
*A compiled version of the Stendhal Server, version 0.64
*A compiled version of the Stendhal Server, version X.XX
*MySQL
*MySQL
*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)
Line 14: Line 13:
<!-- This is heavily based on the Visual Guide to Setting up a Localhost Server on Windows XP (c) -->
<!-- This is heavily based on the Visual Guide to Setting up a Localhost Server on Windows XP (c) -->
== Getting the materials ==
== Getting the materials ==
Download a current version of Stendhal. If you want to use the current release of the Stendhal server, go to http://arianne.sourceforge.net/?arianne_url=games/game_stendhal#downloadsection and download the stendhal-server-X.XX.zip from that page.
Download a current version of Stendhal. If you want to use the current release of the Stendhal server, go tohttp://arianne.sourceforge.net/?arianne_url=games/game_stendhal#downloadsection and download the stendhal-server-X.XX.zip from that page.


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. I recommend ViM for those command-line lovers, and GEdit/Kate for those GUI people. Command line access shouldn't be a problem, ask your system administrator if you do and how to get to it.
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. I recommend ViM for those command-line lovers, and GEdit/Kate for those GUI people. Command line access shouldn't be a problem, though if it is, ask your system administrator how to get it.


= Setting up MySQL =
= Setting up MySQL =
Line 44: Line 43:


== Marauroa and Stendhal: Moving time! ==
== Marauroa and Stendhal: Moving time! ==
Check you have the following files in the server directory, either from your zip or your own build:
Check you have the following files in the server directory:
*stendhal-server-X.XX.jar
*marauroa.jar
*stendhal-xmlconf-X.XX.jar
*log4j.properties
*stendhal-server-0.64.jar
*stendhal-maps-X.XX.jar
*stendhal-xmlconf-0.64.jar
*stendhal-maps-0.64.jar
*log4j.jar
*groovy.jar
*groovy.jar
*simple.jar
*simple.jar
*marauroa.jar
*log4j.jar
*log4j.properties
*jython.jar
*jython.jar
*mysql-connector.jar
*mysql-connector.jar
*commons-lang.jar
<!-- there is no real order to this list, just how I remembered it -->

The first few will be included in your zip of the server. If any of the latter ones are missing you can fetch them here: http://arianne.cvs.sourceforge.net/arianne/stendhal/libs/
Done!
Done!


== MySQL & Marauroa: Let the 2 be one ==
== MySQL & Marauroa: Let the 2 be one ==
Time to configure Marauroa to point to the database you made earlier. In the command-line (not in GUI!), run:
Time to configure Marauroa to point to the database you made earlier. In the command-line (not in GUI!), run:
java -cp marauroa.jar:stendhal-server-0.64.jar games.stendhal.server.GenerateINI
java -cp marauroa.jar:stendhal-server-X.XX.jar games.stendhal.server.GenerateINI
Make sure the names of any jars after the 'cp' are the same as the ones in the server directory.

When it asks you for...
When it asks you for...
*database name, use the default (marauroa)
*database name, use the default (marauroa)
Line 66: Line 69:
*user, use the username you used in giving permissions (FOO)
*user, use the username you used in giving permissions (FOO)
*password, use the password you used giving permissions (BAR)
*password, use the password you used giving permissions (BAR)
*port, anything above 1024. 32160 is the deafult for stendhal, but it can be anything above 1024
*port, anything above 1024. 32160 is the default for stendhal, but it can be anything above 1024
*game, type "stendhal" (or a number for that, if a multiple-choice menu appears)
*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
*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
*log and stats generation logs, use the default ("./") - it's in the same directory as everything else
*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. Like the prompt says, anything greater than 1024 can take a LONG time. But, if you have ~30 minutes to spare (more or less, depending on your comp), you could use the extra security
*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. Like the prompt says, anything greater than 1024 can take a LONG time. But, if you have ~30 minutes to spare (more or less, depending on your comp), you could use the extra security
Line 92: Line 95:
== Server bonuses ==
== Server bonuses ==
=== You are the man! ===
=== You are the man! ===
Want to be an admin? Now you can! It's easy! First create a file called "admins.list" This is a plain text file, with each name on a seperate line. The name must be EXACT, or it will not work. Then go to the directory where you extracted stendhal-server-X.XX.zip, and browse to /data/conf (create it if it isn't already there). Add admins.list there.
Want to be an admin? Now you can! It's easy! First create a file called "admins.list" This is a plain text file, with each name on a separate line. The name must be EXACT, or it will not work. Then go to the directory where you extracted stendhal-server-X.XX.zip, and browse to data/conf (create it if it isn't already there). Add admins.list there. You may need to adjust the classpath which your server loads from.

=== Be my wife? And other server extensions ===
=== Be my wife? And other server extensions ===
Server extensions. They add much (or little) functionality to a server, that another may not have. If you want to add the Spouse extension, which adds marriage (uh-oh!) to your server, just add these to your marauroa.ini file we created earlier (note that marriage is not built in to the server and doesn't require an extension, but you can use this template for all extensions):
Server extensions. They add much (or little) functionality to a server, that another may not have. If you want to add the Spouse extension, which adds marriage (uh-oh!) to your server, just add these to your marauroa.ini file we created earlier (note that marriage is not built in to the server and doesn't require an extension, but you can use this template for all extensions):

Revision as of 13:42, 2 December 2007

This guide applies to:

  • Marauroa 2.1
  • Stendhal 0.64 and above

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:

  • Marauroa version 2.1, see below
  • A compiled version of the Stendhal Server, version X.XX
  • MySQL
  • GNU/Linux (This may be others, the directions should apply almost exactly to any *nix system)
  • A text editor (doesn't matter)
  • Command-line access

Getting the materials

Download a current version of Stendhal. If you want to use the current release of the Stendhal server, go tohttp://arianne.sourceforge.net/?arianne_url=games/game_stendhal#downloadsection and download the stendhal-server-X.XX.zip from that page.

If you want to compile it yourself from CVS or the source code provided at the downloads link, then see How to build Stendhal for more info. If you run a Linux System, then you have the necessary tools to get everything else. I recommend ViM for those command-line lovers, and GEdit/Kate for those GUI people. Command line access shouldn't be a problem, though if it is, ask your system administrator how to get it.

Setting up MySQL

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)!

Makin' the cake

Well, now that we have the materials ready, we need to mix them together to create a great product, no? Here are the steps to take:

  1. Create a server directory, to hold everything in a nice, organized way
  2. Unzip your Stendhal Server zip in this server directory
  3. Run the Stendhal GenerateINI script, to get a configuration file
  4. Have fun

Now, the first and last shouldn't be to hard. Let's create that directory!

Creating the server directory

I'm an organized person when it comes to my computer. Now, sometimes that means I have to go about 3-4 levels deeper into the folder hierarchy to get where I want, but at least I know where my files are for whatever project directory I'm in. Now, you don't have to do this, but I like to keep my computer not so cluttered up with files that I don't know where they belong. Let's create it in your home directory. NOTE: The commands given are for use in the command-line, but you can take the GUI route as well. For some commands, you must run them from the command-line, and I will tell you

cd
mkdir stendhal_server

This will create a directory called "stendhal_server" in your home directory. See how easy that was? And how easy to tell what will be in that directory? That's the beauty of organization.

Marauroa and Stendhal: Moving time!

Check you have the following files in the server directory:

  • stendhal-server-X.XX.jar
  • stendhal-xmlconf-X.XX.jar
  • stendhal-maps-X.XX.jar
  • groovy.jar
  • simple.jar
  • marauroa.jar
  • log4j.jar
  • log4j.properties
  • jython.jar
  • mysql-connector.jar
  • commons-lang.jar

The first few will be included in your zip of the server. If any of the latter ones are missing you can fetch them here: http://arianne.cvs.sourceforge.net/arianne/stendhal/libs/ Done!

MySQL & Marauroa: Let the 2 be one

Time to configure Marauroa to point to the database you made earlier. In the command-line (not in GUI!), run:

java -cp marauroa.jar:stendhal-server-X.XX.jar games.stendhal.server.GenerateINI

Make sure the names of any jars after the 'cp' are the same as the ones in the server directory.

When it asks you for...

  • database name, use the default (marauroa)
  • host, using 'localhost' is fine
  • user, use the username you used in giving permissions (FOO)
  • password, use the password you used giving permissions (BAR)
  • port, anything above 1024. 32160 is the default for stendhal, but it can be anything above 1024
  • 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
  • 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. Like the prompt says, anything greater than 1024 can take a LONG time. But, if you have ~30 minutes to spare (more or less, depending on your comp), you could use the extra security

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, try running the GenerateINI command again; the file could have change with updating the RSA keys

Starting Marauroa

To start Marauroa, simply open the marauroad file in the directory with Marauroa - you may need to make it executable first. To make it executable, in a command prompt type

chmod +x /path/to/marauroad

To start it from a command prompt, type

cd /path/to/
./marauroad

where /path/to/ is the path to the directory in which Marauroa is installed.

Have fun

Well, that's it! Just follow the previous steps under Starting Marauroa to start the server. Pretty easy, huh? Check out the troubleshooting and extras sections for more things to do.

Extras

This is the extras section! Here you have trouble shooting, and hints & tips

Troubleshooting

Can't login!

You try logging in with the account you made when you first got Stendhal. It doesn't work in your server! You see, the MySQL database we created is the user and some other info database, meaning that we have a list of users, while the main server has it's own list. Until access is publicly granted to the MySQL database over there, we must click on Create An Account and choose localhost as the server to join. 2 different accounts. That, well, sucks.

Server bonuses

You are the man!

Want to be an admin? Now you can! It's easy! First create a file called "admins.list" This is a plain text file, with each name on a separate line. The name must be EXACT, or it will not work. Then go to the directory where you extracted stendhal-server-X.XX.zip, and browse to data/conf (create it if it isn't already there). Add admins.list there. You may need to adjust the classpath which your server loads from.

Be my wife? And other server extensions

Server extensions. They add much (or little) functionality to a server, that another may not have. If you want to add the Spouse extension, which adds marriage (uh-oh!) to your server, just add these to your marauroa.ini file we created earlier (note that marriage is not built in to the server and doesn't require an extension, but you can use this template for all extensions):

# load StendhalServerExtension(s)
groovy=games.stendhal.server.scripting.StendhalGroovyRunner
http=games.stendhal.server.StendhalHttpServer
spouse=games.stendhal.server.extension.SpouseExtension
server_extension=groovy,http,spouse

http.port = 8080

The first 3 lines (not including the comment) point to specfic classes in your code. Ther server_extension line tells marauroa to load those extensions at start time. After adding these, restart your server. Don't worry - the RSA keys won't break because you added these lines. I personally have 3 server extensions that I wrote as well, 2 of which are broken (help!). To add those, just add this:

my_extension=java.class.path.to.my_extension

And add "my_extension" to the end of server_extension (don't forget the comma separating everything!)

Finished

Well, that's it. You're done. Finito. Fi. Whatever. You now have your own localhost server! No one can access yet; sign up for a free dynamic dns service at www.dyndns.com and connect a server they host to your IP. Then, all people have to do is go to whatever you set as your domain name with DynDNS. Party time!