CMaNGOS WotLK Installation Guide

Document Last Modified: 2022-06-12 17:04:26

The following document covers how to build a CMaNGOS World of Warcraft: Wrath of the Lich King server which allows the usage of World of Warcraft v3.3.5a clients to connect and play World of Warcraft on.

Pre-installation Notes

My environment is 4x 2.26GHz CPUs, 8GBs of RAM, a 120GB drive and Ubuntu Server 20.04. The system also has its own static public IP address. I recommend utilizing Google if you need assistance in configuring system basics such as disk space allocation, networking or general system administrative tasks.

Update The System

If you've started with a fresh install of Ubuntu 22.04 it would be wise to run an update on the system so you can ensure you have the latest software packages.

$ apt -y update && apt -y upgrade

I recommend rebooting the system.

$ reboot

Creating the 'mangos' User Account

Now create a new system user in which you can run your CMaNGOS world(s) and realm daemon under.

$ useradd -m -d /home/mangos -s /bin/bash -c "MaNGOS" -U mangos

I recommend setting a password for the account.

$ passwd mangos

Software Prerequisites

  1. First you'll want to install some software which is essential to getting CMaNGOS built.
    $ apt -y install build-essential gcc g++ automake autoconf make \
    patch libtool libssl-dev grep binutils git \
    libc6 libbz2-dev cmake libboost-dev libboost-all-dev \
    screen software-properties-common
  2. Next we'll install MariaDB 10.6.x.
    $ curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
    $ bash mariadb_repo_setup --os-type=ubuntu  --os-version=focal --mariadb-server-version=10.6
    $ apt -y update
    $ apt -y install mariadb-server mariadb-client libmariadb-dev libmariadb-dev-compat
    $ systemctl enable mariadb
    $ systemctl start mariadb
    $ mariadb-secure-installation
  3. You can run the follow command to ensure you've installed MariaDB 10.6.x.
    # mysql --version
    mysql  Ver 15.1 Distrib 10.6.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Fetching the CMaNGOS Files

  1. As your mangos user run this command within it's home directory:
    $ git clone https://github.com/cmangos/mangos-wotlk.git mangos

    This makes a clones of the CMaNGOS source code into /home/mangos/mangos. The above command will clone the code for the Wrath of the Lich King core. You can clone other cores by changing the URL.

  2. The next step is to clone the database repository.
    
    $ git clone https://github.com/cmangos/wotlk-db.git
    ```This will create a new directory in `/home/mangos` called `wotlk-db`. The above command will specifically clone the database files for Wrath of the Lich King.
  3. At this point you should have a directory structure similar to this:
    /home/mangos
     -- mangos
     -- wotlk-db
  4. Create the following directories inside /home/mangos:
    • data
    • logs
    • build
    • World of Warcraft (this name is up to you, I just kept it the same as the client structure) At the bare minimum you should create the build directory. The others are optional.

Compiling the Source Code

  1. Go into your build directory and run the following command:
    $ cd /home/mangos/build
    $ cmake ../mangos -DCMAKE_INSTALL_PREFIX=\../mangos/run -DPCH=1 -DBUILD_PLAYERBOT=ON -DBUILD_AHBOT=ON -DBUILD_EXTRACTORS=ON
  2. Now we're going to ACTUALLY compile stuff, YAY!! Run the following command from the build directory. Of note, adjust the -j4 bit to how many processor cores your system has. Mine has four (4) so I put 4 there. On my test system I have 32 CPU cores, so I used -j32.
    $ make -j4
  3. Now we need to install our compiled binaries and such.
    $ make install

Obtain & Extract Game Resources

Take a copy of all the tools from the /home/mangos/mangos/run/bin/tools directory and place them into your /home/mangos/World of Warcraft/ directory. Your directory should look something like this:

mangos@us:~/World of Warcraft$ ls -la
total 13840
drwxr-xr-x 3 mangos mangos 4096 Oct 28 21:32 .
drwxr-xr-x 12 mangos mangos 4096 Oct 28 21:32 ..
drwxr-xr-x 3 mangos mangos 4096 Nov 26 2018 Data
-rw-r--r-- 1 mangos mangos 6094 Oct 28 21:32 ExtractResources.sh
-rwxr-xr-x 1 mangos mangos 7635000 Oct 28 21:32 MoveMapGen
-rw-r--r-- 1 mangos mangos 4931 Oct 28 21:32 MoveMapGen.sh
-rwxr-xr-x 1 mangos mangos 116560 Oct 28 21:32 ad
-rw-r--r-- 1 mangos mangos 316 Oct 28 21:32 offmesh.txt
-rwxr-xr-x 1 mangos mangos 4675528 Oct 28 21:32 vmap_assembler
-rwxr-xr-x 1 mangos mangos 1701416 Oct 28 21:32 vmap_extractor

Add executable permissions to the ExtractResources.sh and MoveMapGen.sh scripts:

$ chmod +x ExtractResources.sh MoveMapGen.sh

Now run the following (you may want to run this in screen as it can take a while):

$ ./ExtractResources.sh

Once this has finished you'll have several new directories - Buildings, Camera, dbc, maps, mmaps, and vmaps. Place those aforementioned directories into your data directory (/home/mangos/data). You can delete the Buildings directory, it's not needed to run the server.

Creating Necessary Databases

  1. This step you can perform while you're extracting resources in the previous step. We're going to import an SQL file that sets up our databases and 'mangos' MySQL user. Remember when prompted for a password it will be your root MySQL password, not your system root password. These commands need to be run from the /home/mangos directory.
    $ mysql -u root -p < mangos/sql/create/db_create_mysql.sql

    I personally edit this file before importing it to change the password for the 'mangos' MySQL user. You can do this by editing line 7:

    CREATE USER IF NOT EXISTS 'mangos'@'localhost' IDENTIFIED BY 'YOUR-PASSWORD-HERE';

    This will create the 'mangos' user with your own set password.

  2. Next I create a .my.cnf file in /home/mangos with the following contents:
    [client]
    user=mangos
    password=YOUR-PASSWORD-HERE

    You'll want to adjust the password line accordingly if you change the 'mangos' MySQL user password in the mangos/sql/create/db_create_mysql.sql file. Creating this file allows us to run the following commands without having to specify which MySQL user and password to use.

  3. Next import 3 SQL files which initialize the mangos, characters and realmd databases.
    $ mysql wotlkmangos < mangos/sql/base/mangos.sql
    $ mysql wotlkcharacters < mangos/sql/base/characters.sql
    $ mysql wotlkrealmd < mangos/sql/base/realmd.sql
    $ mysql wotlkrealmd < mangos/sql/base/logs.sql
  4. Now we're going to fill up our world database with some content! Run these commands from /home/mangos as the mangos user.
    $ cd /home/mangos/wotlk-db
    $ ./InstallFullDB.sh
  5. You will see a menu with several options. Hit 1. Then hit 1 again. Your configuration should look something like this:
    Manage all important settings
    -----------------------------
    Database host...........: 127.0.0.1
    Database port...........: 3306
    MySQL user..............: mangos (password is defined in InstallFullDB.config)
    MySQL user ip access....: 127.0.0.1
    MySQL binary path.......: /usr/bin/mysql
    MySQL dump binary path..: /usr/bin/mysqldump
    Core path...............: /home/mangos/mangos
    World database name.....: wotlkmangos
    Character database name.: wotlkcharacters
    Realm database name.....: wotlkrealmd
    Logs database name......: wotlklogs
    LOCALES.................: YES
    DEV_UPDATES.............: NO
    AHBOT...................: YES
  6. Once the settings are done, hit 9, then hit 2. This will update the wotlkmangos database.
  7. Next hit 3 which will install core updates. Once that is done running, hit 9 to exit the database tool.

Setup the CMaNGOS Configuration Files

Navigate into the directory /home/mangos/mangos/run/etc. This directory is the location of your world, realm, PlayerBot and AuctionHouseBot configurations. Run these commands to copy the default file to the one which is used when you start up realmd and mangosd:

$ cd /home/mangos/mangos/run/etc
$ cp mangosd.conf.dist mangosd.conf
$ cp realmd.conf.dist realmd.conf
$ cp playerbot.conf.dist playerbot.conf
$ cp ahbot.conf.dist ahbot.conf

Edit the mangosd.conf and realmd.conf files to your liking. If you want to utilize PlayerBot edit the playerbot.conf file. The same goes for AHBot, you can edit the ahbot.conf file and adjust the settings to your liking.

Updating Your Realm Information in MySQL

If you'd like you can login to MySQL and update the realm settings in realmd.realmlist if you wish.

USE wotlkrealmd;
SELECT * FROM realmlist;
UPDATE realmlist SET name='Your Realm Name' WHERE id='1';
UPDATE realmlist SET address='Your Servers IP Address' WHERE id='1';

I'd also recommend setting the icon, realmflags, and timezone fields, but they're not required to be changed from defaults.

Running the world and realm Daemons

At this point you should be able to run realmd and mangosd from /home/mangos/mangos/run/bin. I'd just recommend using a screen sessions for each daemon.

$ cd /home/mangos/mangos/run/bin
$ exec screen -dmS realmd /home/mangos/mangos/run/bin/realmd
$ exec screen -dmS mangosd /home/mangos/mangos/run/bin/mangosd -a /home/mangos/mangos/run/etc/ahbot.conf

Creating Yourself an Account

You can use the following command to create yourself an account on the server (do this after the mangosd daemon has started up and you're at the 'mangos>' prompt:

account create $username $password

Set Your Expansion

This command will set your account to be able to use Wrath of the Lich King. Again do this at the 'mangos>' prompt:

account set addon $username $expansion

Expansions

  • 0 - Vanilla
  • 1 - The Burning Crusade
  • 2 - Wrath of the Lich King

Set Your GM Level

You can adjust your accounts GM level using this command. Do this at the 'mangos>' prompt:

account set gmlevel $username $level

Levels

  • 0 - Player
  • 1 - Moderator
  • 2 - Game Master
  • 3 - Administrator