MaNGOS Compiling on Ubuntu

From WoWVWiki

Jump to: navigation, search

This guide will help you quickly setup a Mangos Server with SD2/Acid support on the UDB database.
Follow this guide in the same order listed in the contents, if all goes well you will have a server in 2 hours.


Contents

Before we start

This is written with the following assumptions:

  1. You are building a revision within 50 of 8797.
  2. Your using 32-bit Ubuntu Server 8.04 / 8.10 or Debian 5.0
  3. You have the required map, vmap, and dbc files.
  4. You have at least some knowledge of the Linux command line.
  5. You have direct or ssh access to the machine.
  6. You have some good music to listen to, gotta have good music.
  7. You have 2 hours to waste.


Install the software

This will install the packages required by MaNGOS.

Your going to get a MySQL root password prompt if you havn't setup MySQL before, pick a secure password, make sure you remember this.

~# cd ~
~# apt-get update
~# apt-get install build-essential gcc g++ cpp automake git-core autoconf make patch libmysql++-dev libtool libcurl4-openssl-dev libssl-dev grep binutils subversion zlibc libc6 nano mysql-server unrar-free


OpenSSL 0.8.9k

As of right now, the libopenssl that Ubuntu supplied was 0.9.8g and realmd requires 0.9.8k, I found a temp fix, I'm sure this is the wrong way and its using Debian sources.

wget http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8k-7_i386.deb http://ftp.de.debian.org/debian/pool/main/o/openssl/openssl_0.9.8k-7_i386.deb http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl-dev_0.9.8k-7_i386.deb
dpkg --install libssl0.9.8_0.9.8k-7_i386.deb
dpkg --install libssl-dev_0.9.8k-7_i386.deb
dpkg --install openssl_0.9.8k-7_i386.deb


Get the source

We get the current mangos version and SD2 version.

~# git clone git://github.com/mangos/mangos.git
~# cd mangos
~# svn co https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2/ src/bindings/ScriptDev2/


Patch MaNGOS w/ SD2

Where going to apply the SD2 patch

~# git am src/bindings/ScriptDev2/patches/MaNGOS-*


Compile MaNGOS

Now where going to compile, this takes anywhere from 30 minutes up to a few hours.

This is going to get everything ready, we will compile in the "objdir" so if we are to ever recompile for some reason, we can just remove this folder and have a clean slate.

~# autoreconf --install --force
~# mkdir objdir
~# cd objdir

This will configure MaNGOS.

~# ../configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --datadir=/opt/mangos

The last step is to start the compiler, this part takes the longest.

~# make -j [#ofCores]
~# make install

If you have a quad core CPU then "-j 4" is what you would use, dual core "-j 2". With experience compiling source, for each core, add about 375MB of ram usage, at 4 cores, compiling uses up to 1.5GB of RAM, if your server runs out of ram during the compile process make WILL fail, be aware of this.

Below is what a memory error would look like, if you get this, try lowering your # of cores used during the compile process.

virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
make[3]: *** [DestinationHolder.o] Error 1
make[3]: *** Waiting for unfinished jobs....
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
make[3]: *** [FleeingMovementGenerator.o] Error 1
virtual memory exhausted: Cannot allocate memory
make[3]: *** [ChannelHandler.o] Error 1
make[3]: *** [Creature.o] Error 1


All-In-One

This is an All-In-One for steps 1-4. If you copy-and-paste this line, you must be logged in as root. This only works for "first time" installations.

set -x;cd ~;apt-get update;apt-get install build-essential gcc g++ cpp automake git-core autoconf make patch libmysql++-dev libtool libcurl4-openssl-dev libssl-dev grep binutils subversion zlibc libc6 nano mysql-server unrar-free;wget http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8k-5_i386.deb http://ftp.de.debian.org/debian/pool/main/o/openssl/openssl_0.9.8k-5_i386.deb;dpkg --install libssl0.9.8_0.9.8k-5_i386.deb;dpkg --install openssl_0.9.8k-5_i386.deb;git clone git://github.com/mangos/mangos.git;cd mangos;svn co https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2/ src/bindings/ScriptDev2/;git am src/bindings/ScriptDev2/patches/MaNGOS-*;autoreconf --install --force;mkdir objdir;cd objdir;../configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --datadir=/opt/mangos;make;make install;


Setup MaNGOS

We need to enter the MaNGOS install directory.

~# cd /opt/mangos/

First we copy the config files the compiler made, we don't rename them because you might mess one up, this way, you have a backup.

~# cp etc/mangosd.conf.dist etc/mangosd.conf
~# cp etc/realmd.conf.dist etc/realmd.conf

Now we edit them. Update the database setting to include your root password. You can use the editor of choice, I choose to use nano.

~# nano etc/mangosd.conf
~# nano etc/realmd.conf

I'm going to assume you know how to change the files respectively, if you do not, you probably shouldn't be trying to setup a server.


Download the Database

This will download the world database. We are using UDB and Acid in this tutorial.

cd ~ && mkdir udb && cd udb
svn co https://unifieddb.svn.sourceforge.net/svnroot/unifieddb unifieddb

cd ~ && mkdir acid && cd acid
svn co https://sd2-acid.svn.sourceforge.net/svnroot/sd2-acid sd2-acid 


Setup the Database

You should have created a MySQL user when you installed Ubuntu. We will create a Mangos user with a default example password of "password". Change the password to something else, or you will be pwnd in short order. We are using the example password of "password" in this tutorial as an example only.

mysql -p

Enter the password you chose when you installed MySQL, then add a mangos user.

CREATE USER 'mangos'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'mangos'@'localhost';
CREATE USER 'mangos'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'mangos'@'%';
FLUSH PRIVILEGES;
exit;


Create the MaNGOS database

This will create the tables we need.

mysql -u mangos -ppassword < /opt/mangos/mangos/sql/create_mysql.sql
mysql -u mangos -ppassword < ~/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_database.sql
mysql -u mangos -ppassword scriptdev2 < ~/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_structure_mysql.sql


Populate the database

This will create the default scheme for each table.

mysql -u mangos -ppassword mangos < /opt/mangos/mangos/sql/mangos.sql
mysql -u mangos -ppassword characters < /opt/mangos/mangos/sql/characters.sql
mysql -u mangos -ppassword realmd < /opt/mangos/mangos/sql/realmd.sql
mysql -u mangos -ppassword scriptdev2 < ~/mangos/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql


World Database

This will actually make the world have NPC's and proper gear.

cd ~/udb/trunk/Full_DB 
unzip *.zip
mysql -u mangos -ppassword mangos < ./<file_you_just_unzipped>.sql
mysql -u mangos -ppassword mangos < ~/acid/sd2-acid/trunk/wotlk/<highest-number>/<highest-number>_acid.sql
mysql -u mangos -ppassword mangos < ~/mangos/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql


Database Updates

Now apply MySQL updates in the /opt/mangos/mangos/sql/updates/ folder, starting from the oldest to latest UDB version.
In my case there've been 200 patches and i don't want to import each manually with phpmyadmin, so i wrote a small python script which does the work for me. Put the script in /opt/mangos/mangos/sql/updates/ and make it executable chmod +x {SCRIPTNAME}
Now here it is

#!/usr/bin/env python
import glob, os
patches = glob.glob('*.sql')
patches = sorted(patches)

for x in patches:
  db = x.split("_")[2].replace('.sql', '')
  os.system("mysql -u mangos -ppassword -v " + db + " < " + x)


Realm Database

Where going to update the realm name and IP so it can be accessed from other computers.

mysql -u mangos -ppassword
use realmd;
UPDATE realmlist SET name = 'Your Realm Name' WHERE id = 1;
UPDATE realmlist SET address = 'Your IP' WHERE id = 1;
exit


Datafiles

Be sure you have enabled sshd on your Ubuntu box in case you are using the Desktop version.

~# apt-get install openssh-server
~# /etc/init.d/ssh start

Copy the data extraction tools from the ~/mangos/contrib folder in the MaNGOS source to your Windows game machine. You can copy to/from your Windows machine with the open source WinSCP program, as it supports SFTP.

Place the files listed below in your retail game client's installation folder. Find them in the contrib/vmap_extract_assembler_bin/ and contrib/extractor/ directories.

contrib/extractor/
    ad.exe
contrib/vmap_extract_assembler_bin/
    makevmaps_SIMPLE.bat
    make vmaps.bat  
    splitConfig.txt  
    vmap_assembler.exe  
    vmapextract_v2.exe

This run could take a long time, and will require ~ 2GB of free space. When its done you will have 4 new folders. You need to upload the "maps", "dbc", and "vmaps" directories to the Ubuntu server. Place these in the /opt/mangos/bin folder (or whatever path you chose for the installation of the MaNGOS server binaries).


Clean Up

Now we can clean up the mess we made.

~# rm /root/*.rar -f
~# rm /root/*.sql -f
~# rm /root/*.deb -f


Starting the Server

Your going to need two shell windows open for this next part.

In your first screen, change to your MaNGOS bin.

~# cd /opt/mangos/bin
~# ./mangos-realmd

Now switch to your second screen, and change to the same directory.

~# cd /opt/mangos/bin
~# ./mangos-worldd

If all is well you should now have a server running.



Languages: English | Deutsch | Español | Français | Italiano | Danish | Magyar | Suomi

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox