[MaNGoS] HOWTO: Install / Compile on Linux
Install / Compile MangOS on Linux
[This is a beta guide & my linux admin is rusty, so please feel free to update my mistakes]
1. What You Will Require:
[These are manditory!]
- 1.12.1 or 1.12.2 client
- Patch to 1.12.1 -> DOWNLOAD
- MangOS Source v0.5 -> DOWNLOAD
- MangOS Maps v1.12.1 -> DOWNLOAD
- MangOS DBC v1.12.1 -> DOWNLOAD
- MangOS SilverDB v0.5 -> DOWNLOAD
- MangOS SilverDB v0.51 [svn patches] -> DOWNLOAD
- MangOS PHP WebSite v0.9.1 -> DOWNLOAD INFO
- Apache + MySQL 5 + phpMyAdmin [in XAMPP package]-> DOWNLOAD
- Updated REALMD.SQL -> DOWNLOAD
2. Pre-Installation Setup
[Install & setup the MangOS MySQL Database]
- Most linux packages come with apache + mysql pre-installed... If not install XAMPP into /opt/xampp/
- Login to phpMyAdmin with root... Then create 2 new databases, MANGOS and REALMD
- While still in phpMyAdmin... Create a new user MANGOSUSER pass MANGOSPASS with access privelidges to the new databases
- Extract the mangos-0.5.tar.gz file into /opt/mangos/
- Extract the SilverDBv0.5.zip into /opt/mangos/sql/
- Extract the dbc_1.12.1_full.zip into /opt/mangos/dbc/
- Extract the maps-MANGOS-1.12.1.rar into /opt/mangos/maps/
- Extract the realmd-2006-10-12_v2.zip into /opt/mangos/sql/
- From the linux console import the file /opt/mangos/sql/realmd.sql into the REALMD database
- Use mysql -u[username] -p[password] realmd < /opt/mangos/sql/realmd.sql
- From the linux console import the file /opt/mangos/sql/mangos.sql into the MANGOS database
- Use mysql -u[username] -p[password] mangos < /opt/mangos/sql/mangos.sql
- From the linux console import the file /opt/mangos/sql/SDB.sql into the MANGOS database
- Use mysql -u[username] -p[password] mangos < /opt/mangos/sql/SDB.sql
2. Configure, Make, Install
[These are generic installation instructions]
- cd to the directory containing the package's source code and type ./configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --with-python --enable-cli --enable-ra --datadir=/opt
- If you're using csh on an old version of System V, you might need to type sh ./configure instead to prevent csh from trying to execute configure itself.
- Running configure takes awhile. While running, it prints some messages telling which features it is checking for.
- Type make to compile the package.
- Optionally, type make check to run any self-tests that come with the package.
- Type make install to install the programs and any data files and documentation.
- You can remove the program binaries and object files from the source code directory by typing make clean.
- To also remove the files that configure created (so you can compile the package for a different kind of computer), type make distclean.
- There is also a make maintainer-clean target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution.
4. Config Files for MangOS
[Make ur server more customized]
- Move /opt/mangos/src/mangos/MANGOS and /opt/mangos/src/realmd/REALMD to /opt/mangos/bin/
- Move /opt/mangos/src/mangos/MANGOS.CONF and /opt/mangos/src/realmd/REALMD.CONF to /opt/mangos/
- Configure /opt/mangos/MANGOS.CONF and /opt/mangos/REALMD.CONF for your needs... BUT most important put...
DataDir = "."
- Part of MANGOS.CONF usually looks like:
RealmID = 1
GameType = 1
DataDir = "."
LoginDatabaseInfo = "127.0.0.1;3306;MANGOSUSER;MANGOSPASS;realmd"
WorldDatabaseInfo = "127.0.0.1;3306;MANGOSUSER;MANGOSPASS;mangos"
5. Setting Up The Web Interface To Mangos
[Zyrax PHP Website for MangOS account creation]
- I will create a tutorial for this soon in the MangOS WWW Section...
- For the time being check out this tread -> Zyrax www Site for Mangos
6. Starting MangOS Server
[Without a script, console command]
- run the REALMD first, use ./opt/mangos/bin/realmd
- then run MANGOSD, use ./opt/mangos/bin/mangosd
[Using a script, makes life easy]
- Run as a background service
Code:
#!/bin/bash
# This script is copyright Weedysoft Inc. 2006
# Distributed under the terms of the GNU General Public License v2
#
# Massive Network Game Object Server
# Init Script
#
# I make no guarantees, it works for me and thats what counts. Don't come crying if it nukes your server.
# Made for sandoria.org
version=0.1.9
MANGOSDIR=/opt/mangos/
case "$1" in
"")
echo "${0##*/} version ${version}, Author: Weedy"
echo "Usage: ${0##*/} <options>" # No command-line parameters,
echo "" # or first parameter empty.
echo "Normal Options:"
echo " start stop restart"
exit $E_PARAM
;;
"start")
cd $MANGOSDIR
screen -dmS realmd ./bin/realmd
screen -dmS mangosd ./bin/mangosd
monitorMangosdPid=`ps ax | awk '($6 ~ /monitor-mangosd/) { print $1 }'`
if test "$monitorMangosdPid" = ""
then
screen -dmS monitor-mangosd ./src/mangosd/monitor-mangosd
fi
sleep 3
realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`
mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`
if test "$realmdPid" = ""
then
echo "Realmd failed to start"
fi
if test "$mangosdPid" = ""
then
echo "Mangosd failed to start"
fi
echo "Mangos is now online :-)"
;;
"stop")
realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`
mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`
runMangosdPid=`ps ax | awk '($6 ~ /run-mangosd/) { print $1 }'`
if test "$realmdPid" != ""
then
kill $realmdPid
wait $realmdPid >/dev/null 2>&1
fi
if test "$mangosdPid" != ""
then
(sleep 1; echo 'USER EDIT_ME_LEVEL3_GM'; sleep 1; echo 'PASS EDIT_ME_TO'; sleep 1;echo 'broadcast Server shuting down - 30s .save warning'; sleep 15; echo 'broadcast Server shuting down - 15s .save warning'; sleep 15; echo 'broadcast Server offline;-)'; sleep 1; echo 'exit'; sleep 1 ) | telnet localhost 34226
wait $mangosdPid >/dev/null 2>&1
fi
if test "$runMangosdPid" != ""
then
kill $runMangosdPid
wait $runMangosdPid >/dev/null 2>&1
fi
sleep 3
echo "Mangos is now offline :-("
;;
"restart")
realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`
mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`
runMangosdPid=`ps ax | awk '($6 ~ /run-mangosd/) { print $1 }'`
if test "$realmdPid" != ""
then
kill $realmdPid
wait $realmdPid >/dev/null 2>&1
fi
if test "$mangosdPid" != ""
then
(sleep 1; echo 'USER EDIT_ME_LEVEL3_GM'; sleep 1; echo 'PASS EDIT_ME_TO'; sleep 1;echo 'broadcast Server restarting - 30s .save warning'; sleep 15; echo 'broadcast Server restarting - 15s .save warning'; sleep 15; echo 'broadcast Server offline;-)'; sleep 1; echo 'exit'; sleep 1 ) | telnet localhost 34226
wait $mangosdPid >/dev/null 2>&1
fi
if test "$runMangosdPid" != ""
then
kill $runMangosdPid
wait $runMangosdPid >/dev/null 2>&1
fi
echo "Mangos is now offline, restarting;-)"
cd $MANGOSDIR
screen -dmS realmd ./bin/realmd
screen -dmS mangosd ./bin/run-mangosd
sleep 3
realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`
mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`
if test "$realmdPid" = ""
then
echo "Realmd failed to start"
fi
if test "$mangosdPid" = ""
then
echo "Mangosd failed to start"
fi
echo "Mangos is now online :-)"
;;
esac
exit $?
- Auto restarting script
Code:
#cat run-mangosd
#!/bin/bash
# Massive Network Game Object Server
# autorestart Script
DPATH=/opt/mangos/bin
while :
do
echo "MaNGOS daemon restarted"
echo `date` >> crash.log &
$DPATH/mangosd | tail -n 20 >> crash.log
echo " " >> crash.log &
pid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`
wait $pid
echo `date` ", MaNGOS daemon crashed and restarted." >> serverlog
done
7. Donate
[support it, for it to evlove]
If you want to support developers donate HERE...
Enjoy!
NOTE: I have only done a few major linux server builds and this guide is vague at best...
so please feel free to update anything that i may have missed... we only learn from being shown our mistakes...
easy way to get it running :)
ok, u have problem - try it this way :) 10 steps - it's easy :D hehheeh
1.
install svn (subversion)
(debian e.g.) sudo apt-get install subversion
2.
create dir for mangos:
lala:/opt# mkdir mangos
3.
download newest ver by exec this:
notice - there is a link to svn, but you need to type it the as it is.
lala:/opt# svn checkout https://svn.sourceforge.net/viewvc/mangos/trunk /opt/mangos
4.
u have to have following:
- gcc 3.3 (for latest source code revision, u can use gcc3.4 and gcc4)
- g++ 3.3(for latest source code revision, u can use g++3.4 and g++4)
- make
- automake (1.5 and above)
- autoconf
- glibc & glibc-dev(glibc headers)
- mysql 4.1
- apache2 + php5
- phpmyadmin (good choice)
(i have mysql5 couse i had some problems with 4.1)
5.
now it's time to do it
lala:/opt/mangos# ./configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --with-python --enable-cli --enable-ra --datadir=/opt
and wait - if some errors occure just read the output to solve the problem (in most cases glibc, pthread (postix thread) and some other).
If all went ok go to to next one
6.
run this one and have a cup of coffe -> it'll take some time :)
lala:/opt/mangos# make
7.
ok, so you'r not sleeping - good :)
now it's time to install it
lala:/opt/mangos# sudo make install
so - it's installed now - great :) but, it's not done yet.
u have to download maps -> link
and extract them into maps dir (in this archive is maps folder, so just copy&paste it in mangos dir.
and you need one more tihng DBC -> link
extract it into mangos dir (u have dbc dir in this archive so just copy&paste it into mangos dir).
8.
ok, you can start the server. go to mangos/bin directory and from first shell (or term window) start ./realmd by typing ./realmd
now start mangos from second shell or term window (also from your bin directory) type ./mangosd
it will end like this (if all went ok)
Loading Teleport Coords...
Loading Game Object Templates...
>> Loaded 180105 game object templates
Scripts Library was successfully loaded.
Initializing Scripts...
Reference thread created.
1 reference-thread added.
Grid compression apply on creatures....
Grid compression apply on gameobjects....
WORLD: SetInitialWorldSettings done
WORLD: Starting Event System
Setting Grid clean up delay to 300 seconds.
Setting map update interval to 100 milli-seconds.
User thread created.
pollPendingThreads()
1 user-thread added.
User thread created.
Thread starting...
pollPendingThreads()
1 user-thread added.
Thread starting...
mangos>
9.
so now u have a server.
you can download acc creation page -> here
and if you want to add new realm (i've done that from phpmyadmin - open database realmd, click on realmlist - on left side, then on the right side click on insert. Fill in the field "name" and address (if you want to allow your network clients to connect) with your IP address of the "mangos" computer.
10.
patch your wow to 1.12.1 or 1.12.2 and you can play.
--------------------------------------------------------------------------------------------------------------------
MySql tutorial
MySql is required for mangos to work, optional is PHPMyAdmin and PHP.
i.e. (debian) apt-get install mysql-server phpmyadmin php5 (to be able to install php5 and mysql 5 maybe you'll need to modify your apt source list - but that's way out of this tutor).
When you install MySql, download newest SDB (HERE - SDB forum - registration needed).
Ok, you have latest database, now let's create database. If you installed phpmyadmin, point your browser to i.e. http://localhost/phpmyadmin/index.php login to your mysql server with usrname & passwd, and you'll see a field - Create new database, there create database called mangos and once again create database realmd. Becouse phpmyadmin has a limitation of filesize to import, got to shell/terminal and type: lala:/where/u/xtracted/sdb/ mysql -p mangos < name-of-sql.sql (i.e. lala:/opt/mangos/sql# mysql -p mangos < mangosdb.sql)
It will take some time to import about 100-120mb of data.
Repeat the same action for realmd.sql (i.e. lala:/opt/mangos/sql# mysql -p realmd < realmd.sql ).
So you have your databases up and running. You need to edit realmd database table realmlist to set it the way you want (realmname, ip .. . .).
In case that it is needed, update your mangos db (in your mangos dir, there is dir sql, and inside is dir updates. There are located updates for mangos and realmd. So, point your browser to http://localhost/phpmyadmin/index.php login and on the left side select database mangos, then go to import, click browse and navigate to your mangos/sql/updates dir. select the update you want (recommended is to exec ALL UPDATES newer than your DB release) and hit go. If you get error, in most cases it means that the update you'r trying to do is already included in your database, but read the error output.
So, this is really short mysql tutorial, i'll try to add some more things later.
------------------------------------------------------------------------------------------------------------------
To update your mangos (core and sql) you can do it this way:
lala:/# svn up https://svn.sourceforge.net/viewvc/mangos/trunk /opt/mangos
it will download all updated files newer than your release, but you have to read a bit to figure out if some major update has been made (like transports.sql) becouse transports.sql needs transports.cpp and transports.h to work fine. That's just an example,
I hope this can help someone.
I'll export my DB FULL WITH TESTING CHARS SOON.
TESTING REALMD: UploadTemple.COM - Free File Hosting up to 30MB!
TESTING MANGOS: UploadTemple.COM - Free File Hosting up to 30MB!
(for acc usernames and passwords open realmd.sql, mangos.sql is patched to 2633_character_spell_cooldown.sql, that's the last patch).