From The Mana World
Revision as of 09:33, 20 August 2010 by Rotonen (talk | contribs) (Added more 64bit compilation troubleshooting)

This article describes setting up eAthena on a Linux system. For how to set up eAthena on Windows refer to Building and running eAthena on Windows.

Cloning and compiling

Start with cloning eAthena from our Git repository and compiling it, then compile the eathena-monitor utility. If you are compiling for FreeBSD, use gmake instead of make. Also note that you will need bison and flex installed.

$ git clone git://gitorious.org/tmw-eathena/mainline.git eathena
$ cd eathena
$ make
$ make tools

There's probably lots of warnings while compiling the server executables, but you can just ignore that. If you are having problems cloning eAthena, there are other URLs in the Git repository article (the push URL will only work if you are a TMW developer). Once this step is successful, let's grab the eAthena data from Git as well. This is where we keep all the server side configuration, scripts and other data.

We'll check it out to a eathena-data directory, but note that using $HOME/tmwserver requires less editing of configuration files later, since this is the default.

$ cd ..
$ git clone git://gitorious.org/tmw-eathena-data/mainline.git eathena-data
$ cd eathena-data

If you are having problems cloning eathena-data, there are other URLs in the Git repository article.

Copy over the server executables and monitor:

$ cp -iv ../eathena/login-server login-server
$ cp -iv ../eathena/char-server char-server
$ cp -iv ../eathena/map-server map-server
$ cp -iv ../eathena/eathena-monitor eathena-monitor
$ cp -iv ../eathena/eathena.sh eathena.sh

Optional step. If you did not check out the server-data in $HOME/tmwserver you can add a symbolic link, so that it looks like you did check it out there:

$ cd $HOME
$ ln -s path/to/were/you/put/eathena-data/ tmwserver

Troubleshooting

When having trouble compiling eathena under Ubuntu x86_64 and receiving an error like "Error: gnu/stubs-32.h: No such file or directory", just install the following lib:

sudo apt-get install libc6-dev-i386

When having trouble linking the map-server under Ubuntu x86_64 and receiving an error like "/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz", just install the following lib:

sudo apt-get install lib32z1-dev

Mandatory configuration

Now we need to edit some configuration specific to our setup.

Logging

Create a directory where server log files will be stored, usually just do mkdir log in the directory where your servers are located.

General configuration

First go to the eathena-data/conf directory and make a copy of each file ending in .example, removing that extension. These files are generally server-specific and we don't want changes made in the Git repository to unexpectedly affect your local configuration.

If you are just going to use the server yourself you can enter 127.0.0.1 as the value for all IP addresses. Also, if you have no clue about what ports are or which you will be using, leave the default values as they are.

The local configurations needed for the three servers are as follow:

login_local.conf

  • Set a password for the ladmin tool at admin_pass, or disable remote administration at admin_state.
    • You should configure the file ladmin_local.conf accordingly, if you choose to leave this tool enabled.
  • Also don't forget to set a game master password at gm_pass.

char_local.conf

  • Set a username and password to be used for inter-server communication at userid and passwd.
  • You may optionally want to customize your server name at server_name.
  • Specify the IP address and, if you changed it, the port of the login server as seen from the host on which you run the character server at login_ip and login_port (if they are on the same machine, use 127.0.0.1).
  • Specify the IP address of the character server as seen from the clients connecting to your server at char_ip. This should usually be your internet IP address.

map_local.conf

  • Set the same inter-server communication username and password as you did in char_local.conf.
  • Specify the IP address and, if you changed, the port of the character server as seen from the host on which you run the map server at char_ip and char_port (if they are on the same machine, use 127.0.0.1).
  • Specify the IP address of the map server as seen from the clients connecting to your server at map_ip.

Lastly, go to save/ and copy the account.txt.example file (as account.txt). If you changed the inter-server passwords, you need to change the username s1 and the password p1 of account 0. Don't change anything else about it.

Now make sure everything works by doing a test run of the eAthena server before you make any optional changes.

Path to server data

Please note, if you have checked out out the eathena-data to $HOME/tmwserver or have a symbolic link pointing here, you can skip these steps.

  • Edit eathena.sh and set SRVHOMEDIR to the location of your server-data checkout. Probably something like $HOME/.../eathena-data.
  • Edit conf/eathena-monitor.conf and adjust the paths according to the SRVHOMEDIR you previously set in eathena.sh

Optional configuration

Here are some pointers if you want to configure your server in other ways than the official TMW server. Feel free to browse any of the other configuration files to see what else you may want to change.

  • The maps and NPCs that should be available are set in map_athena.conf.
  • The starting location and the starting equipment for the player are set in char_athena.conf.
  • Access levels to GM commands are set in atcommand_local.conf.
  • “The message of today” text shown at login can be changed in motd.txt.
  • The command help texts can be changed in help.txt.

Specifying your own update host

When you want to provide your players with a different world from the official server, you need to set up your own update host. You can specify a different update host in conf/login_local.conf at update_host. The client stores updates downloaded from the update host in an update-host specific directory, in order to avoid filename collisions.

TODO: Provide more information about the files that an update host needs to server.

Running your server

We have two convenient scripts that allow us to start and stop the server with single commands. The eathena-monitor launches all servers and restarts them when they crash. The eathena.sh shell script is used to start/stop the eathena-monitor.

$ ./eathena.sh start
$ ./eathena.sh restart
$ ./eathena.sh stop

Note that there are also GM commands that allow you to restart for example the map server. This is preferred over using ./eathena.sh restart. Also be sure to announce the restart to your players, since this doesn't happen automatically.

Connect with your client and create your first account to test if everything works fine.

If you manually run the servers, the char server will segfault the first time it's able to connect with the login server. This is fine. Just restart it. The monitor will handle this automatically.

Troubleshooting

If your server fails to run and/or you cannot connect to it with your client, it is likely to be caused by one or several of the below points. But before you do anything else, check the logfile as it may say what is the cause.

  • Forgotten or mismatching usernames, passwords, ip addresses and ports.
    1. Check that you have followed all mandatory configuration steps.
  • Unavailable files.
    1. Check where you did download the server-data. If you did not put in the default directory, please make sure that you have either created a symlink that points to the default directory or that you have changed the needed configuration files.
    2. Check whether you have created symlinks to the three server executables.

Making yourself a GM

Specify your account ID as found in save/account.txt (usually 2000000 for the first account) in conf/gm_account.txt. The level 99 should be the highest. You can set up the GM commands in conf/atcommand_athena.conf.