Hi everyone,
I recently installed MaNGOS(Zero) on Ubuntu 22.04 and thought it would be nice to share my step-by-step guide with you. You can use this guide for all cores, just replace GIT repository URL accordingly.
_______________________________________________________________________________________________________________________________
PREREQUISITES
You should have a running server with Ubuntu Server 22.04 operating system.
Before starting with the guide you should update the OS:
sudo apt update && apt upgrade
Upgrading to higher release of Ubuntu Server is on own risk. You should backup your DB before!
Also you will need an installation of the game client with the addons installed for which you would like to create the server for.
_______________________________________________________________________________________________________________________________
PREPARATION
1. Create system user to be used for installation, if not already available. We will use in the guide a specific user named "mangos":
adduser mangos
1.1 You can add root rights to the user, otherwise you need to execute some parts of the guide with root:
usermod -aG sudo mangos
2. Install usefull tools for this guide
MaNGOS requires some libraries to be built and to run properly. We also need some programs to run further commands or simply to handle some scripts which are in the repo (e.g : python scripts).
sudo apt install git make cmake libssl-dev libbz2-dev build-essential mariadb-server mariadb-client default-libmysqlclient-dev libace-dev python2 net-tools screen gdb
3. Create folder structure
You can structure your fodlers as you like, you just have to take care to change the folder names accordingly in the scripts below. I try to seperate the different components and wanted to have the option to install different cores in parallel.
You can check your user name with the command:
whoami
If you are using user "mangos", go to the home directory.
cd ~
Then create folders:
mkdir ~/mangos
mkdir ~/mangos/zero
mkdir ~/mangos/zero/db
mkdir ~/mangos/zero/bin
mkdir ~/mangos/zero/gamedata
mkdir ~/mangos/zero/logs
4. prepare database
Login to the MariaDB with:
sudo mysql
4.1 create a new user for mangos
Execute the follwoing create statement in the DB, replace <password> with a secret password which you can remember. Also grant the user with all required DB rights (very powerful rights, so don't share this user with anybody):
CREATE USER 'mangos'@'localhost' IDENTIFIED BY '<password>'; GRANT ALL PRIVILEGES ON *.* TO 'mangos'@'localhost' WITH GRANT OPTION; exit;
Afterwards you are able to login to MariaDB with new user:
mysql -u mangos -p<password>
_______________________________________________________________________________________________________________________________
INSTALL DATABASE
1. Go to the db folder and download the database from the GIT repository. If you want to install a different version, exchange the url accordingly:
cd ~/mangos/zero/db git clone https://github.com/mangoszero/database.git --recursive
2. This will create a new sub-folder database and downloads all required tools and scripts to install the database for the Mangos core selected. Go to new sub-folder and start installation script:
cd ~/mangos/zero/db/database bash ./InstallDatabase.sh
You will see the following screen:
3. Press "N" to start process. It should automatically identify your MariaDB installed on your server.
3.1 In general you can accept the default values in brackets, but following information needs to be set correctly:
- The user name for MariaDB: mangos
- The password for the user to allow scritp to create all required tables: <password>
-
Set the names for DB schemas (it's recommended to use separate schemas for characters and world for each core, so adjsut the numbering if needed)
- Character DB: mangos_character0 (0 - Classic; 1 - TBC; 2 - WOTLK; ...)
- World DB: mangos_world0
- Realm DB: mangos_auth (Note: you just need one Realm DB, even if you run multiple cores on your server!)
After providing all informaion, the script will install all databases and tables.
3.2 To configure the database, get at first your IP address by executing the command:
ifconfig
Note down your IP and open MariaDB again:
mysql -u mangos -p<password>
You can check the realmlist with the following SQL, note down the proper ID of the server you want to configure:
select * from realmlist;
Update the realmlist with proper name and IP address, use the right ID:
UPDATE realmlist SET name = “<Your Server-Name>” WHERE id = <ID>; UPDATE realmlist SET address = “<Server-IP address>” WHERE id = <ID>;
The database is now ready!
_______________________________________________________________________________________________________________________________
BUILD MANGOS
Next we will install the server related to the Mangos core DB you installed before.
1. Go to the core version folder and download the server from GIT repository (don't forget to change the URL to appropriate core version, if needed). It creates a new sub-fodler "server" and stores all data in it:
cd ~/mangos/zero/ git clone https://github.com/mangoszero/server.git --recursive
2. Build the core
After download, we have to build the core by executing e.g. the following command:
cmake -S ~/mangos/zero/server/ -B ~/mangos/zero/build/ -DBUILD_MANGOSD=1 -DBUILD_REALMD=1 -DBUILD_TOOLS=1 -DUSE_STORMLIB=1 -DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3=1 -DPLAYERBOTS=1 -DPCH=1
3. The script creates all necessary build files and stores then in the sub-folder "build". If it's done we can switch to the folder and build/install mangos (a server with minimum 2 cores/cpus is recommended):
make -j<# of CPUs assigned to your server> make -j<# of CPUs assigned to your server> install
4. Copy server files to our "bin" folder after the install scripts finished successfully:
cd ~/mangos/zero/build/install/bin cp mangosd ~/mangos/zero/bin/ && cp realmd ~/mangos/zero/bin/
5. Copy game extractor files to our "gamedata" folder:
cp ./tools/*-extractor ~/mangos/zero/gamedata/ cp ./tools/*.sh ~/mangos/zero/gamedata/ cp ./tools/offmesh.txt ~/mangos/zero/gamedata/
_______________________________________________________________________________________________________________________________
EXTRACT GAMEDATA
You will require an iinstallation of the game client on your local machine and a sFTP connection to your server to copy whole game fodler to the server. Safe the client in folder: ~/mangos/zero/gamedata/! If this is done you can continue.
1. Go to "gamedata" folder and change executable rights to extractor script and make all files read-/writeable:
cd ~/mangos/zero/gamedata chmod -R a+w ~/mangos/zero/gamedata chmod a+x ExtractResources.sh
2. Execute the Extractor Script and follwo the onscreen instructions (minimum of 4 GB RAM is required, recommended are 8 GB):
- extract everything (dbc, maps, mmaps, vmaps)
- choose all CPUs available on your server to extract MMaps (1-4)
- extract MMaps without delay
After starting the process it will take a lot of time to complete. If the message "Finished creating MoveMaps" appears it's done. Check that no errors occured!
3. Clean up unnecessary files, you can delete all folders and files from "gamedata" folder except:
- dbc
- maps
- mmaps
- vmaps
_______________________________________________________________________________________________________________________________
CONFIGURE SERVER
1. Go to main server folder and copy server config files:
cd ~/mangos/zero cp -R ~/mangos/zero/build/etc ./ cd etc
2. In the folder "etc" you find now all config files, copy the default files for editing and use by the server:
cp ahbot.conf.dist ahbot.conf cp mangosd.conf.dist mangosd.conf cp realmd.conf.dist realmd.conf cp aiplayerbot.conf.dist aiplayerbot.conf
3. You should edit all files according to your needs, especially the db connection information. For comfortable editing use "nano":
nano <filename>
4. Start script for services to run the server:
cd ~/mangos/zero/bin nano wowadmin.sh
Insert into the file the following script and save (replace the "/path/to/your/realmd" and "mangosd" to proper path, if you changed them:
#!/bin/bash
THIS_FULLPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)/`basename "${BASH_SOURCE[0]}"`
THIS_FOLDERPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)
APATH=/home/mangos/mangos/zero/bin/realmd
WPATH=/home/mangos/mangos/zero/bin/mangosd
ASRV_BIN=realmd #This usually doesnt change. TrinityCore: authserver MaNGOS: realmd ArcEmu: whocares?
WSRV_BIN_ORG=mangosd #This usually doesnt change. TrinityCore: worldserver MaNGOS: mangosd ArcEmu: whocares?
WSRV_BIN=mangosd
WSRV_SCR=mangosd
echo "run" > gdbcommands
echo "shell echo -e \"\nCRASHLOG BEGIN\n\"" >> gdbcommands
echo "info program" >> gdbcommands
echo "shell echo -e \"\nBACKTRACE\n\"" >> gdbcommands
echo "bt" >> gdbcommands
echo "shell echo -e \"\nBACKTRACE FULL\n\"" >> gdbcommands
echo "bt full" >> gdbcommands
echo "shell echo -e \"\nTHREADS\n\"" >> gdbcommands
echo "info threads" >> gdbcommands
echo "shell echo -e \"\nTHREADS BACKTRACE\n\"" >> gdbcommands
echo "thread apply all bt full" >> gdbcommands
DEBUG=false
#WORLD FUNCTIONS
startWorld()
{
if [ "$(screen -ls | grep $WSRV_SCR)" ]
then
echo $WSRV_BIN is already running
else
cd $WPATH
screen -AmdS $WSRV_SCR $WPATH/$WSRV_BIN $DEBUG
echo $WSRV_BIN is alive
fi
}
restartWorld()
{
screen -S $WSRV_SCR -X stuff "saveall$(printf \\r)"
echo saved all characters, and server restart initialized
screen -S $WSRV_SCR -X stuff "server restart 5$(printf \\r)"
}
stopWorld()
{
screen -S $WSRV_SCR -X stuff "saveall
"
echo saveall sent, waiting 5 seconds to kill $WSRV_BIN
sleep 5
screen -S $WSRV_SCR -X kill &>/dev/null
echo $WSRV_BIN is dead
}
monitorWorld()
{
echo press ctrl+a+d to detach from the server without shutting it down
sleep 5
screen -r $WSRV_SCR
}
#AUTH FUNCTIONS
startAuth()
{
if [ "$(screen -ls | grep $ASRV_BIN)" ]
then
echo $ASRV_BIN is already running
else
cd $APATH
screen -AmdS $ASRV_BIN $APATH/$ASRV_BIN
echo $ASRV_BIN is alive
fi
}
stopAuth()
{
screen -S $ASRV_BIN -X kill &>/dev/null
echo $ASRV_BIN is dead
}
restartAuth()
{
stopAuth
startAuth
echo $ASRV_BIN restarted
}
monitorAuth()
{
echo press ctrl+a+d to detach from the server without shutting it down
sleep 5
screen -r $ASRV_BIN
}
#FUNCTION SELECTION
case "$1" in
$WSRV_BIN )
if [ "$2" == "true" ]
then
while x=1;
do
gdb $WPATH/$WSRV_BIN --batch -x gdbcommands | tee current
NOW=$(date +"%s-%d-%m-%Y")
mkdir -p $THIS_FOLDERPATH/crashes
mv current $THIS_FOLDERPATH/crashes/$NOW.log &>/dev/null
killall -9 $WSRV_BIN
echo $NOW $WSRV_BIN stopped, restarting! | tee -a $THIS_FULLPATH.log
echo crashlog available at: $THIS_FOLDERPATH/crashes/$NOW.log
sleep 1
done
else
while x=1;
do
./$WSRV_BIN
NOW=$(date +"%s-%d-%m-%Y")
echo $NOW $WSRV_BIN stopped, restarting! | tee -a $THIS_FULLPATH.log
sleep 1
done
fi
;;
$ASRV_BIN )
while x=1;
do
./$ASRV_BIN
NOW=$(date +"%s-%d-%m-%Y")
echo $NOW $ASRV_BIN stopped, restarting! | tee -a $THIS_FULLPATH.log
sleep 1
done
;;
"wstart" )
startWorld
;;
"wdstart" )
DEBUG=true
startWorld
;;
"wrestart" )
restartWorld
;;
"wstop" )
stopWorld
;;
"wmonitor" )
monitorWorld
;;
"astart" )
startAuth
;;
"arestart" )
restartAuth
;;
"astop" )
stopAuth
;;
"amonitor" )
monitorAuth
;;
"start" )
startWorld
startAuth
;;
"stop" )
stopWorld
stopAuth
;;
"restart" )
restartWorld
restartAuth
;;
* )
echo Your argument is invalid
echo "usage: start | stop | restart | wstart | wdstart | wrestart | wstop | wmonitor | astart | arestart | astop | amonitor"
exit 1
;;
esac
5. Start the server with command:
bash wowadmin.sh start
_______________________________________________________________________________________________________________________________
PLAY GAME
1. update your realmlist.wtf in your game client folder.
- you can find the file in your %WoWDir%\realmlist.wtf
- Set the realmlist to your new IP (you should save the old realmlist.wtf as backup):
set realmlist <IP of your server>
2. The standard users are accessible directly, if server is up and running:
- User: PLAYER - Password: PLAYER
- User: ADMINISTRATOR - Password: ADMINISTRATOR
- User: GAMEMASTER - Password: GAMEMASTER
- User: MODERATOR - Password: MODERATOR
3. To create a new account, go to your server and execte command:
cd ~/mangos/zero/bin bash wowadmin.sh wmonitor
In the world monitor console, enter the following commands:
account create <account name> <password> account set addon <account name> #
replace <account name> with new name and set a proper password, also grant the addons to be used for the user by changing # to a proper number: 0 - Classic; 1 - TBC; 2 - WOTLK; ...)
To exit the monito, press CTRL +a +d at the same time.
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now