Hello, in this tutorial, I will explain a step-by-step approach to configure, install and run Mangos on a CentOS 7 Linux system. To fully execute the installation, you need an original copy of the game client version you want to run.
This guide has been fully tested on an empty CentOS 7 system with minimal installation.
Setup the database:
CentOS is supporting MariaDB instead of MySQL by default. This part of the guide will help you to setup your instance of MariaDB.
Launch a terminal, and if it's not already the case, you need to become the 'root' user:
sudo su - root
Then, install MariaDB:
yum -y install mariadb-server
Once MariaDB is installed, start it:
systemctl start mariadb
I do advise you to add mariadb service at startup to execute it automatically:
systemctl enable mariadb
Let's secure your mariadb installation, execute the following command:
I advise you to setup the following parameters:
Setup a Root password Remove anonymous access Disable remote access for the root user Remove the test database Reload the privileges
Verify that you database configuration is working properly, you will need to provide the root password you have just defined:
mysqladmin -u root -p version
If everything is ok, you should have an output like the follow one:
Server version 5.5.52-MariaDB Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime x sec
Now that the setup of the database is done, we need to add the prerequisites for the mangos database configuration. We need to start by creating an user for mangos, login to the database using:
mysql -u root -p
Create the user you wish, the example given is creating an user 'mangos' who can connect from the 'localhost' and has the password 'password' (do not forget the ';') at the end:
CREATE USER 'mangos'@'localhost' IDENTIFIED BY 'password';
We then need to grant privileges to that user that we can use it later to setup the Mangos schemas (again, do not forget the ';' symbol):
GRANT ALL PRIVILEGES ON *.* TO 'mangos'@'localhost';
Exit the terminal:
Congratulations, you have setup the pre-requisites for the database on CentOS !
We are now at the interesting part, how do we install Mangos on CentOS ? Well, assuming you are logged in as 'root', go to the home directory:
And let's install a required dependency first, wget is a small utility that will allow you to download the installer script:
yum -y install wget
Now, we can download our installer:
Set the permissions to be allowed to execute it:
chmod 700 getmangos.sh
And execute it:
Before we go further, some explanations on the available activities:
- Install Prerequisites will install all the necessary dependencies for you to build & run mangos. Toggled by default.
- Set Download And Install Paths will allow you to specify where the sources must be downloaded and where the binaries must be installed. Toggled by default.
- Clone Source repositories will help you cloning the Mangos sources. Toggled by default.
- Build MaNGOS will assist you in the building process of MaNGOS. Toggled by default.
- Install MaNGOS will help you installing MaNGOS. Toggled by default.
- Install Databases will assist you in the database schemas creation. Toggled by default.
- Extract Resources will help you to extract the DBC, maps, mmaps and vmaps from the game client. Toggled by default.
- Create Code::Blocks Project File will create a project for the Code::Blocks editor. Do not toggle this option if you don't plan to edit the MaNGOS sources.
Now that you know everything, let the default options selected and select 'Ok' thanks to the Tab key. The script is now installing the necessary dependencies on your CentOS. You will be prompted to provide your agreement to install the build dependencies. Select 'Yes' two times.
Mangos provides you the opportunity to run it under another user than the 'root' one. This is a good practice to isolate softwares and limit the security impact in case of an exploited vulnerability. The default proposed run user is 'mangos' but you can change if you wish. Select 'Ok' to continue.
If you have already performed this step, the installer will ask you whether you want to keep that user. I advise you to reply 'Yes' except if you know what you are doing.
Choose WoW Release:
The next screen is requesting you to choose the WoW release you are willing to install. Select the one you that fits your wish and select 'Ok'.
The next screen is asking you to provide the source path. By default, the proposed format is /home/<run user>/<wow version>/src. For instance, for a run user 'mangos' and a wow version 'Vanilla', the proposed path will be:
Reply 'Yes' to create the directory if it does not exist. If it does exist and contains sources, the installer will ask you whether you want to delete the content or not.
The next screen is asking you to provide the installation path. This is the location from where you will execute the Mangos processes. By default, the proposed format is /home/<run user>/<wow version>. For instance, for a run user 'mangos' and a wow version 'Vanilla', the proposed path will be:
If it does exist and contains compiled sources, the installer will ask you whether you want to delete the content or not.
Clone or update MaNGOS:
The next step of the script is asking you whether you want to clone, update or use an existing copy of the MaNGOS sources. For a fresh installation, select the option '0 Clone a fresh copy of MaNGOS'. The installer will now connect to Github and check the available development branch, currently, the last stable release is the Rel21 and is hosted in the 'master' branch.
The installer is now cloning the server and database repositories.
You are now at the build step. Some explanations over this screen:
- Enable Debug will setup debug flags and more tracing on Mangos. Use this build option only if you're requested to to fix a bug. Building a software in debug mode significantly reduces its performances.
- Use Standard Malloc, toggle this option to use the standard memory allocation. Untoggle this option only if you know what you are doing.
- Use External ACE libraries. Allows you to use the ACE libraries coming from your system. There are very few cases when this option works, and also it will be removed in the future, so leave it untoggled (MaNGOS has an "internal" ACE anyway).
- Use PostgreSQL insteald of MySQL/MariaDB. Allows you to use another database provider than the default one. This option has not been tested and, if you have followed the tutorial so far, you should have setup MariaDB 😉
- Build Client Tools will build the extractors necessary to get dbc, maps, mmaps and vmaps out of the game client. Unselect this option only if you already have these resources extracted.
- Use SD3 will allow you to build the ScriptDev3 Engine provided with MaNGOS. We advise you to keep this option toggled except if you don't like living world based on C++ scripts.
- Use Eluna will allow you to build the Eluna Engine provided with MaNGOS. We advise you to keep this option toggled except if you don't like living world based on LUA scripts.
Select 'Ok' to proceed with the build process and confirm that would want to build MaNGOS. The installer is now building MaNGOS. Depending on the speed of your system, you have the time to drink a glass of water or a cup of coffee. 🙂
You will now be prompted to install Mangos. Select 'Yes' to install it.
Wait.. another database setup ?! Yes, but this time, we are populating the database with the mangos data. You have three options here:
- Install clean databases to setup a fresh database
- Update existing databases to update your old version of the database
- Skip database work... but it wouldn't make sense 🙂
Select the first option if you are performing a fresh installation. You will be prompted to select your type of database. If you followed the guide so far, you should select "MariaDB". The installer will then request your database information, if you followed the guide, you need to provide the following input:
Hostname: localhost Port: 3306 User: mangos Password: password
You can now choose into several options:
- ReInstall the realm database, containing all the realms information and the accounts
- ReInstall the world database, containing all the world configuration
- ReInstall the characters database, containing all the characters information
- Update the realmlist to setup an initial game server
By default, all options must be toggled. The installer will now perform the database import.
Extract Game Data:
This step will copy the extractors to the wow game location, extract dbc, maps, mmaps and vmaps and copy these extracted data to your installation directory. The installer will automatically look for a suitable WoW client into your /home directory. If it doesn't find anything, you will have to provide your game location path. If the provided path doesn't contain any game data, the installer will exit.
The extractor steps allows you to select the artifacts you want to extract:
- DBC and Maps, which are the minimum set of data you need to extract
- Mmaps which are the movement maps, based on vectoriel calculation, required for an efficient pathfinding
- Vmaps which are the virtual maps, used for collision detection and LoS detection
The Mmaps extraction is taking several hours, you will have the time to sleep or drink several coffees. 🙂
You almost did it ! Still few steps to perform before you can play on your preferred game. First of all, you need to switch to your run user. If you used mangos, the command will look like:
su - mangos
You need then to go to the configuration directory of your installation, if you installed Vanilla, it will look like the following command:
Copy the realmd.conf.dist and mangosd.conf.dist files to their expected name:
cp realmd.conf.dist realmd.conf cp mangosd.conf.dist mangosd.conf
Edit the realmd.conf and find the line LoginDatabaseInfo. Provide your database information, according to this guide and if you have installed Vanilla, it should look like:
LoginDatabaseInfo = "127.0.0.1;3306;mangos;password;zero_realm"
Save your file and edit the file mangosd.conf. You need to provide the database information for the three database we have configured with our installer:
LoginDatabaseInfo = "127.0.0.1;3306;mangos;password;zero_realm" WorldDatabaseInfo = "127.0.0.1;3306;mangos;password;zero_world" CharacterDatabaseInfo = "127.0.0.1;3306;mangos;password;zero_characters"
Save your file and go back to the 'root' user:
Make sure it keeps running !
What could be cooler than having the MaNGOS server starting automatically with your server ? Not much... so let's configure systemd to do so ! First of all, we need to tell it that we have two new services. Declare them by creating the corresponding files:
touch /etc/systemd/system/realmd.service touch /etc/systemd/system/mangosd.service # Or give it a better name like zero.service if it's a vanilla gaming server for instance.
Now, edit the /etc/systemd/system/realmd.service file and add the following content (Replace the installation path and the run user by the settings you have provided during the installation):
[Unit] Description=Realmd service After=network.target mariadb.service [Service] Type=simple User=mangos ExecStart=/home/mangos/zero/bin/realmd -c /home/mangos/zero/etc/realmd.conf Restart=on-abort [Install] WantedBy=multi-user.target
Save this file and edit the /etc/systemd/system/mangosd.service file (or the better name you gave to it) with the following content (same remark than above the installation path and the run user):
[Unit] Description=WoW Vanilla service After=network.target mariadb.service [email protected] [Service] Type=simple User=mangos ExecStart=/home/mangos/zero/bin/mangosd -c /home/mangos/zero/etc/mangosd.conf WorkingDirectory=/home/mangos/zero/bin StandardInput=tty TTYPath=/dev/tty3 TTYReset=yes TTYVHangup=yes Restart=on-abort [Install] WantedBy=multi-user.target
Mangos-Daemon as a Systemd service using screen (Added by @madmax May 2018) - If not using the above Mangosd.
[Unit] Description=MaNGOS world server daemon After=mariadb.service [Service] Type=oneshot ExecStart=/usr/bin/screen -mdS mangosd /home/mangos/zero/bin/mangosd -c /home/mangos/zero/etc/mangosd.conf PIDFile=/home/mangos/zero/var/cosmic.pid RemainAfterExit=true # Give a reasonable amount of time for the server to start up/shut down #TimeoutSec=60 [Install] WantedBy=multi-user.target
We are almost there ! You now need to tell systemd to reload its configuration:
And let's start our processes to verify that they work:
systemctl start realmd systemctl start mangosd
To verify that it worked, execute the following command:
systemctl status realmd systemctl status mangosd
If it's working properly, you should have an output indicating you the success status for both service. The last step is to tell systemd to execute them at startup, for this, execute the following commands:
systemctl enable realmd systemctl enable mangosd
Congratulations ! You are now done with the MaNGOS setup on CentOS 7 🙂 You can now reboot your computer to verify that everything is indeed started: