Jump to content

[tutorial]Compiling Mangos-Zero under Linux (CentOS 6.3)


Auntie Mangos
 Share

Recommended Posts

  • 42 years later...

previous tutorial was outdated and i've placed it in a post below.

this one will apply to new source code.

still, server will be set on CentOS 6.3 (minimum version).

tutorial should be valid on 32 and 64 bit machines.

i'm leaving setting static ip, firewall, system updates to user (and

anything else you would like to add/customize in your linux).

and one more thing. source code is updated very often lately. check github each day

if you don't want to miss anything. of course, before any update, make a backup of

server files and database

Warning! whole precess is made on root account. you can add normal

user and switch to it. but i'm laze and i'll add normal user at the very end.

1. install basic packages used in build process (with their dependencies!).

yum install gcc gcc-c++ make openssl-devel mysql-devel
yum install git mysql-server

curl [url]http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz[/url] -o cmake.tar.gz
tar -zxf cmake.tar.gz
cd cmake-2.8.10.2
./configure --prefix=/usr/local && make && make install
cd .. && rm -rf cmake*

2. get the source code for server and scripts

git clone [url]https://github.com/mangoszero/server[/url]
git clone [url]https://github.com/mangoszero/scripts[/url] server/src/bindings/scripts

3. edit CMakeLists.txt

cd server/src/bindings
vi CMakeLists.txt

remove # before add_subdirectory

replace universal with scripts

4. create directory where server will be stored

mkdir /opt/mangos

it can be other place like /srv/mangos or something else.

5. compilation time

cd ~/server
mkdir build && cd build
cmake ../ -DPREFIX=/opt/mangos

there are few other parameters for cmake, like -DDEBUG=1, very

usefull if you want to mess with the server code and then debug it.

other parameter -DACE_USE_EXTERNAL=1. if you have installed ACE lib from

source on the server and library is placed somewhere in the system,

use this parameter. where it can be used? what i saw on old forum, if

you set up multiple realms on the machine, library will be loaded only

once to the memory (but i might be wrong with this statement).

make && make install

if your processor has more then one core, replace upper statement with

(where n is number of cores)

make -j n && make install

6. dbc files, vmaps, maps and mmaps

those files are required to run server. building process will be different

if you planing to extract/build them under windows and linux.

6.1. windows path

you need to have a WoW client installed (lets say, it will be placed in c:\\WoW)

you need to have Ms Visual Studio (2010 and something earlier. i'm not sure witch

one was marked as VS90).

you need to have a copy of server source files (same version as on linux box).

6.1.1. dbc files

cd server\\contrib\\extractor

there is already built ad.exe file, but you can rebuild it by opening VC100_AD.sln

or VC90_AD.sln and build solution.

copy ad.exe to WoW Client folder and run it. dbc folder will be created.

it will be used later

6.1.2. maps and vmaps

maps are used for building vmaps. so we need to create them first.

cd server\\contrib\\vmap_extractor_v3
cd win

open vmapExtractor3_VC90.sln or vmapExtractor3_VC100.sln and build solution.

from server\\contrib\\vmap_extractor_v3\\bin\\Architecture_ReleaseOrDebug

(where architecture might be Win32, im not sure if there is a 64bit version) copy

vmapExtractor3.exe to WoW folder and run it. Buildings will appear.

cd server\\contrib\\vmap_assembler

open vmap_assemblerVC90.sln or vmap_assemblerVC100.sln and build solution.

from server\\contrib\\vmap_assembler\\bin\\Architecture_ReleaseOrDebug copy

vmap_assembler.exe to WoW folder. open cmd and change current folder to WoW

folder (in cmd).

mkdir vmaps
vmap_assembler.exe Buildings vmaps

6.1.3. mmaps

because mmap system is currently a bit broken (read on forum about it) and it takes A LOT OF TIME

to generate mmaps. it might be pointless to build those maps now. but if you still want, then.

cd server\\contrib\\mmap\\win

open MoveMapGen_VC90.sln or MoveMapGen_VC100.sln and build solution.

from server\\contrib\\mmap\\bin\\Architecture_ReleaseOrDebug copy MoveMapGen.exe

to Wow folder.

mkdir mmaps
MoveMapGen.exe

go sleep, wake up and go to work. come back and see if they are all build. really, it takes so

much time.

because we are on windows box, we need to copy dbc\\ maps\\ vmaps\\ (and maybe mmaps) to our linux box.

use winscp or something similar to copy those folders, by now to your home directory. in next section

we will setup some config files and then we can copy those files to proper place

6.2. linux path

you need to have a copy of client files somewhere in the system. they can be in a subdirectory in your

home directory. lets say we have it in WoW direcory.

6.2.1. dbc files

cd server/contrib/extractor
cmake -i && make
cp ad ~/WoW/

running cmake -i will popup some questions, just press enter.

cd ~/WoW
./ad

just like on windows system, dbc directory will be created.

6.2.2. maps and vmaps

because vmap_extractor depends on libmpq, we need to build it first.

cd server/dep/libmpq
./autogen.sh && ./configure && make

cd server/contrib/vmap_extractor_v3
cmake .
make

copy vmapextractor from server/contrib/vmap_extractor_v3/vmapextract to WoW directory

and run it. Buildings directory should appear.

cd server/contrib/vmap_assembler
cmake .
make

copy vmap_assembler to WoW directory.

cd ~/WoW/
mkdir vmaps
./vmap_assembler Buildings vmpas

6.2.3. mmpas

same situation as with windows. but if you still want to build mmaps then.

cd server/contrib/mmap
cmake .
make

copy MoveMapGen and mmap_extract.py to WoW directory.

cd ~/WoW/
python mmap_extract.py

again you have ended with dbc/ maps/ mmaps/ and vmaps/ directories. wait with copying them

till you read next section.

7. setup

time to mess with config files

cd /opt/mangos/etc
mv mangosd.conf.dist mangosd.conf
mv realmd.conf.dist realmd.conf
mv scriptdev2.conf.dist scriptdev2.conf

first edit mangosd.conf. i'll just point lines that i've changed. of course, you can change others

to achieve something else. every option is well documented in config file so i'll skip mine comments on them

line 63 set to "/opt/mangos/share/mangos" # DataDir

line 64 set to "/opt/mangos/log" # LogsDir

line 74 set to IP address of machine where server runs # BindIP

line 205 set to any value you want, it's a player limit, set it to 25000 ;-) # PlayerLimit

line 221 set to 0 (zero), why? because there is a lot of problems with mmaps, so it's just safe to turn it off # mmap.enabled

next section is mainly for logging. letting as more info as possible to log is very useful in case of a crash or any other bad situation.

you can change those, but are not obligated to do so. server will work fine without those changes.

line 354 set to 1 # LogTime

line 357 set to 3 # LogFileLevel

line 365 set to 1 # LogFilter_PlayerMoves

line 367 set to 1 # LogFilter_AIAndMovegens

line 372 set to "World.log" # WorldLogFile

line 378 set to "Gm.log" # GmLogFile

line 381 set to "Ra.log" # RaLogFile

line 382 set to "13 7 11 9" # LogColors

End of not obligatory part.

line 688 set to 0 (zero) if you want pve server or leave 1 ant it will be pvp # GameType

line 689 set to 8 (any other option is described in config file) # RealmZone

line 692 set to 2 # StrictPlayerNames

line 693 set to 2 # StrictCharterNames

line 694 set to 2 # StrictPetNames

line 695 set to 5 # MinPlayerName

line 703 set to anything you want (eg max lvl 60 or smaller value) or leave default value # StartPlayerLevel

line 704 set to anything you want (it's character starting money in coper. if you want eg 1g then set it to 10000) # StartPlayerMoney

line 782 set to 1 (on pve servers should be fine. if you want very restricted pvp server, leave default value) # AllowTwoSide.Accounts

lines 1469 to 1475 are also not obligatory but allowing remote access can give you possibility to use later great tool Mangolin (author says it's not working on classic server i'm using it without any problem). so

line 1470 set to 1 # Ra.Enable

line 1471 set to the same IP where server runs # Ra.IP

End of mangosd.conf file changes!

open realmd.conf file

line 111 set to "opt/mangos/log" # LogsDir

line 114 set to IP where realmd will run (mine is the same as mangosd machine IP) # BindIP

line 116 set to 3 # LogLevel

line 117 set to 1 # LogTime

line 121 set to "13 7 11 9" # LogColors

And that's all with configuration.

8. server data files

cd /opt/mangos
mkdir log
mkdir -p share/mangos/{dbc,maps,vmaps}

now copy content of dbc, maps and vmaps directories from WoW direcory their directories in /opt/mangos/share/mangos/

because i've been creating those files under Windows, so i'm using WinSCP to copy thos to my linux box.

9. database

first we need to go back to server source directory.

cd ~/server/sql

mysql -u root -p < create_mysql.sql
mysql -u root -p characters < characters.sql
mysql -u root -p mangos < mangos.sql
mysql -u root -p realmd < realmd.sql

time to apply SD2 sql files

cd ~/server/src/bindings/scripts/sql
mysql -u root -p < scriptdev2_create_database.sql
mysql -u root -p scriptdev2 < scriptdev2_create_structure_mysql.sql
mysql -u root -p mangos < mangos_scriptname_full.sql
mysql -u root -p scriptdev2 < scriptdev2_script_full.sql

time to apply data from mangos zero database

cd ~
git clone [url]https://github.com/mangoszero/database[/url]
cd database/_tools
/bin/sh make_full_db.sh
mysql -u root -p mangos < full_db.sql

10. last settings in databese

mysql -u root -p
USE realmd;
UPDATE realmlist SET name="Hellscream", address="IP_OF_YOUR_SERVER_MACHINE", icon=4, realmflags=0, timezone=1 WHERE id=1"

That's all.

you can start now each process in different console window to see what's going on.

cd /opt/mangos/bin
./mangosd
./realmd

one more thing. to add new account from command line (mangosd console window), type

account create Noname 12345

where Noname is a username and 12345 is a password

by default such user has gmlevel = 0 (it's just a plain player).

you can change it typing:

account set gmlevel [username] [number 0-3, 0 being player and 3 being administrator]

like i said earlier, there is a great tool called Mangolin, witch allows you to do all the administration tasks (like creating new accounts). really worth a try.

11. i have forgot. add new user

server should be run as unprivileged user. you need to add new linux user who will start the server processes.

useradd mangos
passwd mangos

insert password to mangos user.

chown -R mangos:mangos /opt/mangos

now relog to mangos user. and run again mangosd and realmd.

the end.

any suggestions are always welcome.

kupix

Link to comment
Share on other sites

EDIT: it's a bit outdated tutorial. it stays here if someone want to use Luda's repo.

i hope it helps a bit. here is my tutorial how to setup mangos-zero on centos linux ([email protected] clone).

i've been running whole as a virtual machine (64bit machine, 4 cores, 8GB ram, 25GB hdd) mainly because i havent got any dedicated machine.

it will be clear install of centos 6.3 minimum version.

during instalation set static address ip.

update system:

yum update

install packages with their dependencies:

yum install gcc
yum install gcc-c++
yum install make
yum install git
yum install libcurl-devel
yum install openssl-devel
yum install expat-devel
yum install perl-ExtUtils-ParseXS
yum install tcl tcl-devel tk
yum install gettext
yum install mysql-devel
yum install mysql-server

next package is used only because author doesn't want to learn vi/vim ;)

yum install mc

relog as added user and make a drirectory for source codes

mkdir dev && cd dev

download cmake and compile it (the one provided with centos is a bit old and

code won't compile with it, at least without messing with cmake config files):

curl [url]http://www.cmake.org/files/v2.8/cmake-2.8.10.tar.gz[/url] -o cmake.tar.gz
tar -zxf cmake.tar.gz && cd cmake-2.8.10
./configure --prefix=/usr && gmake -j 5
su -c "make install"
cd .. && rm -rf cmake-2.8.9/ && rm cmake.tar.gz

before we go further with compilation, we need to clone newest git. just like cmake, the one

provided by centos is a bit old and you won't be able to push commits into github repository with

it. later we will remove the old version. instalation process is described in INSTALL

file witch can be found in git source directory

git clone [url]https://github.com/git/git.git[/url] && cd git
make configure
make prefix=/ust/local all
su -c "make prefix=/usr/local install"
cd .. & rm -rf git/

now we are ready to compile server.

git clone [url]https://github.com/mangos-zero/server.git[/url]
cd server/src/bindings
git clone [url]https://github.com/mangos-zero/scriptdev0.git[/url]
cd ~/dev/server
mkdir build
cd build

create destination catalogue for mangos server and make it usable for user created at the

begining of this tutorial

su -c "mkdir /opt/mangos"
su -c "chown -R mangos:mangos /opt/mangos"

now i could split this tutorial into two pieces, depends if we want to use ACE library installed

in our system (we don't have it) or the one provided with server code.

i will use first path. compile it and install

cmake ../ -DDEBUG=1 -DPREFIX=/opt/mangos

there are also other parameters like -DACE_USE_EXTERNAL or -DPCH. use what you want.

-DDEBUG=1 stands for building mangos server in debug mode (more verbose in console/log, i think)

-DPREFIX stands for instalation catalogue

make -j 4 && make install

now it's time to prepare database

cd ~/dev/server/sql

you can edit this file and provide better password for mangos user (or even change the user name)

anyway customize it at your own will.

mysql -u root -p < create_mysql.sql

mysql -u root -p characters < characters.sql
mysql -u root -p mangos < mangos.sql
mysql -u root -p realmd < realmd.sql

cd ../src/bindings/scriptdev0/sql/
mysql -u root -p < scriptdev0_create_database.sql
mysql -u root -p scriptdevzero < scriptdev0_create_structure_mysql.sql
mysql -u root -p mangos < mangoszero_scriptname_full.sql
mysql -u root -p scriptdevzero < scriptdev0_script_full.sql

cd ~/dev/
git clone [url]https://github.com/mangos-zero/database.git[/url]
cd database

now edit mysql_info file and provide username (mangos) and password (mangos) to access server

databases. i have used mcedit (provided with midnight commander).

mcedit mysql_info

edit line 12. and 13. of course, if you have installed database on other machine you need

to provide adress of that machine (in this case, change line 14.).

because i'm installing db on the same machine as server, edit just username and password.

now the fun part. dont know why but scripts witch will be imported into database have

invalid databases names (zp_realm instead of reamd, zp_world instead mangos, zp_characters

instead of characters, zp_scripts instead of scriptdevzero).

so we need to edit every single script in directories witch name starts with zp_ (in database

directory).

i don't have good solution for it. i had to edit every single file. best part of it, is

that the db name is at very begining of each file.

...few minutes later.

(edit: i have commited "patch" for this. it can be found on this forum: mangos-zero->database->patch submission. it's a simple shell script witch rename all the names in a few seconds. consider this as a better solution, instead of manual editing each file).

./mysql_import
cd ~/dev

grab acid for mangos zero

curl [url]https://sd2-acid.svn.sourceforge.net/svnroot/sd2-acid/trunk/classic/1.0.4/1.0.4_acid.sql[/url] \\
-o acid.sql
mysql -u root -p mangos < acid.sql

after those steps, server and db is almost prepared. now it's time for some setup.

here are my setting i've made to get working PvE Blizz-like Server.

cd /opt/mangos/etc
mv mangosd.conf.dist mangosd.conf
mv realmd.conf.dist realmd.conf
mv scriptdevzero.conf.dist scriptdevzeroconf

now edit mangosd.conf.

line 62: leave '1' as it is or set it to 1 (value corresponds to realm id from realmlist datatable, realmd db)

line 63: change to "/opt/mangos/share/mangos"

line 64: change to "/opt/mangos/log"

line 73: change to ip where the server will run (you''ll use it later while preparing WoW client)

line 196: change to appropriate value, i have set 10000

between lines 338 and 368, you can set logging variables. i have changed almost everything in this section. my setup

LogSQL = 1
PidFile = ""
LogLevel = 3
LogTime = 1
LogFile = "Server.log"
LogTimestamp = 1
LogFileLevel = 1
LogFilter_TransportMoves = 3
LogFilter_CreatureMoves = 3
LogFilter_VisibilityChanges = 3
LogFilter_Weather = 3
LogFilter_DbStrictedCheck = 3
LogFilter_PeriodicAffects = 3
LogFilter_PlayerMoves = 1
LogFilter_SQLText = 1
LogFilter_AIAndMovegens = 1
LogFilter_PlayerStats = 1
LogFilter_Damage = 1
LogFilter_Combat = 1
LogFilter_SpellCast = 1
WorldLogFile = "World.log"
WorldLogTimestamp = 1
DBErrorLogFile = "DBErrors.log"
CharLogFile = "Char.log"
CharLogTimestamp = 1
CharLogDump = 1
GmLogFile = "Gm.log"
GmLogTimestamp = 1
GmLogPerAccount = 1
RaLogFile = ""
LogColors = ""

those settings are very usefull while you are messing with the code or db.

line 662: i have set 0, because i wanted pve server. leave 1 if you want pvp.

line 663: change to 8, Server Realm zone, now it's set up to English

line 664: change to 0, dbc language setting, now it's English

line 669: change to 5 (or anything else)

line 670: change to 3 (or anything else)

line 678: it's a player's starting money (in copper, eg 100 copper = 1silver). it can be changed, but you can leave it as it is.

line 713: change to anything what you like, it's a message displayed in console after starting a game.

line 753: change to 1 if you want to allow account create in both opposite factions

it was the last change in this file. now edit realmd.conf

line 111: change to "opt/mangos/log"

line 114: change to ip of the machine where the realmd will be run (for development or just for testing it is set as the same variable in

previous file.

line 116: change to 3. it will produce a lot more log info

line 117: change to 1

line 118: change to Realmd.log (if it's not set, or leave as it is)

line 119: change to 1

line 120: change to 3

thats all in this file. i haven't edited the last file. there was nothing interesting for me to change or set.

now it can be run:

./mangosd
./realmd

run each in different console, because they produce a lot of info on the screen (witch can be also found in log files).

now it's time to add a player.

in console where mangosd is running, press enter. ">" should appear.

type:

account create Phenomenon 123

where Phenomenon is login and 123 is password.

to change GM level, use:

account set gmlevel [username] [number 0-3, 0 being player and 3 being administrator]

after first command gmlevel will be set to 0 as default

the last part it db setup. check what you got in realmlist datatable (realmd db)

i had "Argent Dawn" realm but with different address, realmflag and timezone

change those values to this:

update realmlist
set address="YOUR IP FROM BindIP Variable in realmd.conf",
set realmflags = 64,
set timezone = 1
where id = 1;

thats all. i hope you'll get running zero server.

kupix

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use