trash-art.at Blog

03Jan/172:56 PM

How to set up Manaserv on Linux

How to set up a manaserv server and client using Debian Linux(serverside) and Windows(clientside).

ManaSourceWe begin by downloading the Client for Windows(the version discussed here is 0.6.1 and a nightly build for Windows. Note that the stable build does not offer an option to choose the servertype we need) The client should launch right out of the directory it was extracted to.

Next we get ready to set up the server. We are here on Debian and start with creating a dedicated and true unix user including its' own home directory. The server will execute under this newly created user.

As root type in these commands:
1. mkdir /home/mana
2. useradd -g users mana -d /home/mana/ -s /bin/bash
3. passwd mana (you are asked to type it in twice to check for errors)
4. chown mana:users /home/mana

Our next step prepares the sytem to be able to compile the server from source.
(We ideally allready have a MYSQL Database-Server up and running since we won't compile using the default SQlite but MYSQL.) Since we are with Debian we use aptitude to install the needed dependencies. You should use the package manager you used before, just don't mix it. If it was apt-get, use apt-get, if it was aptitude, use aptitude.)
Since we want the latest files we do an "aptitude update" followed by "aptitude safe-upgrade". Since we are on Squeeze and not Wheezy we now change the sources.list to get the first needed package enet1.3. If we wouldn't change the apts' sources.list, we would have to compile enet1.3 from source since Squeeze offers enet 1.2 through aptitude only.

Our /etc/apt/sources.list looks something like this when prepared to fetch the enet 1.3 package:
# deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free
# deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free

# deb http://security.debian.org/ squeeze/updates main contrib non-free
# deb-src http://security.debian.org/ squeeze/updates main contrib non-free

# squeeze-updates, previously known as 'volatile'
# deb http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free
# deb-src http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free

deb http://ftp.de.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian wheezy main contrib non-free

You see that only the last two lines are in use. After the installation of enet1.3, modify your /etc/apt/sources.list to its' previous state. After you changed the sources.list to use the Wheezy packages, you must do an "aptitude update".
After the update just type in aptitude install libenet-dev (You will see that the package manager automatically suggests the relevant enet packages versioned 1.3 now.)
Don't forget to change back your sources.list including an aptitude update after your enet1.3 installation is done.

Now that we have enet1.3 we are ready to go on with the next packages.
Do the command(as root user):

aptitude install autotools-dev autoconf automake zlib1g zlib1g-dbg zlib1g-dev zlibc build-essential libguichan-dev libphysfs-dev libpng12-dev libpthread-stubs0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libxml2-dev libsdl-gfx1.2-dev lua5.1 libpthread-stubs0 libpthread-stubs0-dev libmysqlclient-dev cmake liblua5.1-0-dev

!Note: libcurl4-openssl-dev is listed on the wiki to be installed but it works flawlessly without.
You will also need GIT to get the server sourcecode which may allready be installed on your system.

Now that we hopefully have everything for a successfull compilation we go get the actual Server Data.
(the git as well as the compiling steps are done using the user "mana" and not as "root"):
Move to your /home/mana/ directory and create a folder to contain the server source data:
mkdir manaserv
Now we get the git repository. From the folder location /home/mana/ type the command:
git clone https://github.com/mana/manaserv manaserv
This will fetch compilable source data into the earlier created /home/mana/manaserv/ folder.
(Note: if the git operation freezes, you might quit it with the Strg-C shortcut and do it again; for some miraculous reason the previously created folder manaserv has to be created with mkdir again if the git command failed)

Now "cd" into /home/mana/manaserv/ and type the command:
cmake -DWITH_MYSQL=1 .(including the .)
(cmake . would set it up for SQlite instead of MYSQL) If you lack any needed packages the cmake will show an error. Install the missing package(s) and do the cmake -DWITH_MYSQL=1 . in /home/mana/manaserv/ again.

Now type the command to actually compile it: make
If everything went well you will get a "100%" message at the end of compilation.

The next step is to import the MYSQL data provided in /home/mana/manaserv/src/sql/mysql/
Within phpmyadmin create a new database and a privileged user for it. Use the Import option to add the provided tables(the file is called "createTables" and you won't need the other files if you don't plan to migrate an older database to be conform with a newer server version.

After having imported the tables we copy the main configuration file found in the docs folder.
cp /home/mana/manaserv/docs/manaserv.xml.example /home/mana/manaserv/src/manaserv.xml
Open the newly copied and renamed filde with an editor, maybe nano.
Go through the settings and adjust them.
(Don't forget to open the Firewall Ports 9601, 9602, 9603 and 9604.)
In our case we uncomment the section for MYSQL and type in all asked credentials. Next we need to define the worldDataPath like this(if using the original example data provided with the source):
<option name="worldDataPath" value="../example" />

Read through the file and adjust it to your setup like giving a "net_password" as well as the server IP adress where asked. Also adjust the "net_clientDataUrl" which in our case would be:
<option name="net_clientDataUrl" value="file:///home/mana/manaserv/example" />

The basic server setup is done now and we go on to prepare the client. Just copy the example folder from your server to your local machines client folder. The client needs a launchoption to make use of the provided example data.
Herefor we create a shortcut of the mana.exe file and add the following options to make it look like this:
C:\path_to_client\mana.exe -u -d C:\path_to_client\example
The -u option skips an updatecheck(an update server could be set up in a separate step) and the -d option defines the use of custom data, which has to be the same data which is also located on the server, in our case the example folder.

Now cd into /home/mana/manaserv/src and type in the command ./manaserv-account
This will start the account server and will also give logged output depending on your set log level.
Open up another ssh terminal to start the game server. Again cp into /home/mana/manaserv/src/ and type in: ./manaserv-game

That's it :-)

Your server should be up and running now. Time to launch the client using our modified shortcut. Type in the servers' adress, use port 9601 and ManaServ as the servertype. Click connect and you should be presented with an account registration screen. Congrats, and have fun diving into it!

UPDATE(3.1.2017): MMOD - Massively Multiplayer Online Doom - Just for fun LUA/manaserve/tiled learning project. >>Download MMOD Dev Package v1.0
MMOD - Massively Multiplayer online Doom LUA/manaserv/tiled learning project.