Jump to content
  • We are looking for staff for the Wiki area!
    If interested please
    click here and select "Documentation Team"

  • [Last procedure check : 2020-07-13 ]

    Hi everyone,

    I re-write the procedure since there are many questions about linux install procedure.
    Many of them are no more applicable today and the  getmangos.sh script needs rework as I write this article.


    PREREQUISITES

    I am assuming you are running your server on a Linux Operating system with Ubuntu Server 18.04 flavor.

    Your OS should be up to date. If not, log in as root and run :

    apt update && apt upgrade

    PART 1 : Configuring the environment

    This tuto will use the MaNGOS zero repo URL but it is replicable with all of our cores repos. Just change the git repo URL and you will be fine.

    > Creating system user

    Be sure you have created a Linux user for your server, since it is not a good idea to run it as root for obvious security reasons.

    We will then assume you have created a mangos linux user using the command : 

    adduser mangos

    To be more handy you can add this user to the sudoers in order to be able to run administrative commands.

    usermod -aG sudo mangos

    After this point, be sure to be logged-in as mangos Linux user. We do not need root account anymore (or perhaps once or twice.. but..never mind ! do not use root when not needed)

    > Installing useful programs

    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 O_o)

    apt install git make cmake libssl-dev libbz2-dev build-essential default-libmysqlclient-dev libace-6.4.5 libace-dev python

    > Preparing your system folders

    A good practice is to separate locations for the needs :

    • sources, db sql files and build folder under the mangos system user : /home/mangos/
    • binaries, confs, logs, gamedata in /opt/

    Thus you can create the folders when logged-in as mangos system user :

    mkdir /home/mangos/sources
    mkdir /home/mangos/build
    mkdir /home/mangos/db

    Then the /opt/ folder is only accessible to root so you need to use sudo and impersonate root to make things there.
    The aim to to create a fodler using the root account then giving the good rights to be able to use it with the mangos system user.

    The opt folder will a have a wow subfolder in which the mangos folder will be. It would let you install other cores if you want to (Trinitycore, Cmangos etc..) all should be installed in /opt.

    sudo su
    cd /opt/
    mkdir wow
    chown -R mangos:root wow
    chmod g+s wow
    exit

    Now you will have a wow folder in /opt/ that will be writable by the mangos system user.

    Create all necessary useful folders to handle future files using mangos system user : 

    cd /opt
    mkdir wow/install && mkdir wow/install/mangos && mkdir wow/install/mangos/bin && mkdir wow/install/mangos/bin/logs && mkdir wow/install/mangos/conf 
    cd /opt/wow && mkdir gamedata && mkdir gamedata/1.12 && mkdir gamedata/1.12/mangos

    > Getting Game data

    Since MaNGOS is an educationnal project we will not redistribute exctracted game data.

    In order to be able to run your server, you will need to extract these data from your game folder using the extractor programs that are built when you build the project.

    To run the server the best way, you will have to extract :

    • dbc
    • maps
    • vmaps (takes a long time)
    • mmaps (takes a long time)

    Please remind to put all extracted data on the folders you pre-created on previous steps.

    If you work with a VM you can use Linux extractors against a shared game folder betwwen your PC and the Linux VM, or if you have the Game folder on your server, you will have to use extractors in this folder.

    More information on this topic : 


    PART 2 : Getting the sources & Compiling the core

    Note that we always use the mangos system user.

    Get into your source folder :

    cd /home/mangos/sources

    Retrieve the sources (WARNING do not forget to get them recusrsively !!) :

    git clone https://github.com/mangoszero/server.git . --recursive --depth=1

    Well, that good now we are going to build the solution.

    /!\ WARNING ABOUT ACE DEPENDENCIES  /!\
    It is possible that the build fails due to he ACE linked sources in the "dep" folder. It is related to a bug between Linux build and Windows build.
    The main "server" repository is set to refer to a speficif commit that allows by default a correct build on Windows. If you are on Linux you will probably have to manuall pull & checkout the "dep" folder (wich is a git submodule) : 

    cd /home/mangos/sources/dep
    git pull
    git checkout master

    Keep in mind that this example show a default build. You can tweak teh buidl option in cmake to build or not some parts of the software.

    cd /home/mangos/build
    cmake ../sources/ -DCMAKE_INSTALL_PREFIX=/opt/wow/install/mangos -DCONF_INSTALL_DIR=/opt/wow/install/mangos/conf

    When it's finished, depending on the number of your cores you will adapt the following make command :

    make -j<NbCores>
    (e.g : for an intel i7 octocore you can tupe  'make -j8')

    The build process should begin, and when it's finished, you will have to install the built binaries : 

    make install

    After that, all binaries and default conf files woudl have been copied to their destination folders which you have set in the previous cmake command.


    PART 3 : Installing MySQL

    First things first : you have to install MySQL server.

    With Ubuntu Server 18.04 the reference MySQL version is 5.7.30 (this statement is valid at the date when this guide is written, it can evolve in the future).

    To install mysql-server :

    sudo apt install mysql-server

    After installation, you may wonder : "Why the program did not ask me for a root password ?".

    Well, on new MySQL versions, the default auth protocol is set to "auth_socket" but all our software will use a password to connect to the database.

    Don(t worry, we are going to create a user that would be able to authenticate with standard credentials :

    sudo su
    mysql

    Now you are logged-in to mysql command prompt with the root account. you will notice no password was asked to you because roto user uses auth_socket protocol to authenticate.

    Now you are going to create the MySQL mangos user :

    CREATE USER 'mangos'@'localhost' IDENTIFIED BY 'mangos';
    GRANT ALL PRIVILEGES ON *.* TO 'mangos'@'localhost' WITH GRANT OPTION;

    The "WITH GRANT OPTION" is not mandatory but can be useful for future use if you want to administer other users with this mangos account.

    Then leave MySQL command prompt and root shell :

    exit;
    exit

    PART 4 : Database Setup

    > Main databases (auth, characters, world)

    You first have to clone the database repo in the db folder :

    cd /home/mangos/db/
    git clone https://github.com/mangoszero/database.git . --recursive --depth=1
    ./InstallDatabases.sh

    You will be prooted a screen with several questions :

    934443229_InstallDB.PNG.0bf9ff4c37fdea7bf578455240e2c620.PNG

    installdb2.PNG.28d6d02d040fb38421835715d6ac0a90.PNG

     

     

    You will also be prompted to determine your dabases names.

    A good practice is to set the realm db name to : mangos_auth, and also to suffix all others db names with the core versions you are running  (e.g characters db for mangos zero : mangos_characters0 , world db : mangos_world0 )

    Note : you need only 1 realm database if you run several cores (mangos zero, mangos one etc..) on teh same server, BUt you will need 2 db (characters and world) for each core you run.

    > Apply database updates

    On a fresh install, World updates should also be applied.

    In order to see if it is Ok, check on the World db (the process is the same for other databases) : connect to mysql using mangos user :

    mysql -u mangos -pmangos mangos_world0
    SELECT * FROM db_version ORDER BY VERSION DESC, structure DESC, content DESC LIMIT 0,1;
    exit;

    If the return show you the same version that the most recent file in the World/Updates/Rel21 folder. You are OK.

    The version number alwas increase so it will be easy to determien if your version/structure/content is ok or not.

    If not, then go to the World update folder (World/Updates/Rel21) and apply missing updates to the databases.

    mysql -u mangos -pmangos mangos_world0 < nameOfUpdateSQlFile.sql

    > Translations

    In case you run a non english speaking server, you can apply translation fiels to the world database.

    You will find the correct sql files to apply in the Translations folder :

    cd /home/mangos/overload/db/Translations

    Since I cannot ensure the Linux scripts are working, here is how to do manually : Apply the 3 first .sql files in teh folder :

    mysql -u mangos -pmangos mangos_world0 < 1_LocaleTablePrepare.sql
    mysql -u mangos -pmangos mangos_world0 < 2_Add_NewLocalisationFields.sql
    mysql -u mangos -pmangos mangos_world0 < 3_InitialSaveEnglish.sql

    Of course you will have to replace the db name "mangos_world0" with your db name etc... if you have changed default db names and user and password :)

    You will need to go to the translation folder of the desired language (e.g for French language ) :

    cd /home/mangos/db/Translations/Translations/French
    

     

    db3.PNG.930b2498bbd2a14a514e5a26950ad039.PNG

    The more easy solution would be to compile all files in one and import it

    cat *.sql > full.sql
    mysql -u mangos -pmangos mangos_world0 < full.sql
    rm full.sql

    There, your translations should be applied.


    PART 5 : Configuring *.conf files for executables

    Go to the conf folder an create a copy of each .dist file :

    cd /opt/wow/install/mangos/conf/
    cp realmd.conf.dist realmd.conf && cp mangosd.conf.dist mangosd.conf

    Change database connection information in each file in order to allow your binaries to connect to the database.

    Update your game data path in mangosd.conf too.
    Update the logs folder to "logs" value (relative to binary)

    dirs.PNG.fe4801cbaa0b1e391251e9bbf253851e.PNG

     

    A lot of behaviours can be configured in these files. Please consider studying it carefully.


    PART 6 : Auto-restarting

    When operating a game server it is nice to use an auto-restarter.

    Otherwise, you will have to keep up 2 terminals for realmd and mangosd.

    ./opt/wow/install/mangos/bin/realmd
    
    and
    
    ./opt/wow/install/mangos/bin/mangosd 

    That can be really annoying because daemons would be killed after terminal exit.

    Read this article to know how to use a restarter on Linux operating systems : 


    PART 7 : Final comments :D

    > Nice to have

    When your system is running, you could perhaps check : 

    • Do you have a DB backup system ? You can easily put one in place with a CRON job :) 
    • Do you have a backup system for your conf files ?
    • Do you have a flushing system for the server log files if you keep them timestamped ?

    > About errors at core start-up

    You can have some DB errors at startup like this one :

    dberr.thumb.PNG.8f2e06d46f132061c62da534acea9991.PNG

     

    It means you have applied DB updates beyond core expectation but since it is only content related, it is not a big issue.

    The core would not start id the version or structure is different, but the core can start with a content mismatch.

    > How to first connect whith default accounts ?

    If you have any questions - please ak on the forum on on Discord when anybody is connected :) 

    Cheers !


    User Feedback

    Recommended Comments

    Specu

    Posted

    Well you should replace mysql with mariadb-server ;) While installing DB will not work with script, you can do it with manual import.

    Elmsroth

    Posted

    On 7/20/2020 at 11:42 PM, Elmsroth said:

    Hi @Specu it can be replaced by mariadb yes - but you will get warnings when using Mysql workbench app.

    Moreover, mariadb is the default SQL server for debian but for Ubuntu 18.04 it is still MySQL :

    https://packages.ubuntu.com/fr/bionic/default-mysql-server

     :) (but you can install mariadb instead with apt install mariadb-server   then also install mariadb-client)

     

    dbq

    Posted

    Hi  Elmsroth
    I follow every step up to the Extract where you direct me to the other post. The compilation and building seemed OK.
    From there I realised I could not find wow.exe.

    Can you share any pointer where I could make mistake?


    Many thanks.

    dbq

    Posted

    Quote

    Please remind to put all extracted data on the folders you pre-created on previous steps.

    Did you mean the "gamedata" folder you mentioned earlier? Like:

    mv maps /opt/wow/gamedata/
    mv dbc /opt/wow/gamedata/
    mv vmaps /opt/wow/gamedata/
    mv mmaps /opt/wow/gamedata/

     

    JLS

    Posted

    Ubuntu 18.04 comes default with cmake 3.10.2. When running this command, you might receive this error:

    cmake ../sources/ -DCMAKE_INSTALL_PREFIX=/opt/wow/install/mangos -DCONF_INSTALL_DIR=/opt/wow/install/mangos/conf
    
    
    CMake Error at CMakeLists.txt:20 (cmake_minimum_required):
      CMake 3.12 or higher is required.  You are running version 3.10.2
    -- Configuring incomplete, errors occurred!
    

    To fix this, you can upgrade cmake to a newer version. For example, here are the commands to upgrade to 3.16.7:

    cd ~/
    mkdir tmp
    cd tmp
    wget https://cmake.org/files/v3.16/cmake-3.16.7-Linux-x86_64.tar.gz
    tar zxvf cmake-3.16.7-Linux-x86_64.tar.gz
    sudo mv cmake-3.16.7-Linux-x86_64     /opt/cmake-3.16.7
    sudo ln -sf  /opt/cmake-3.16.7/bin/*    /usr/bin/
    cmake --version
    rm -rf ~/tmp/

     

    JLS

    Posted

    If using WSL2 on Windows, you will run into this error when installing & starting mysql:

    sudo su
    root@DESKTOP-2NUPEGC:/home/mangos/build# mysql
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    root@DESKTOP-2NUPEGC:/home/mangos/build# sudo /etc/init.d/mysql start
     * Starting MySQL database server mysqld                                                                                No directory, logging in with HOME=/
    mkdir: cannot create directory ‘//.cache’: Permission denied
    -su: 19: /etc/profile.d/wsl-integration.sh: cannot create //.cache/wslu/integration: Directory nonexistent
    

    This issue is noted here. To resolve this, follow this comment noted in the link:

    Quote

    The problem is with the script "/etc/profile.d/wsl-integration.sh". As a quick workaround insert the following line before the first line in "/etc/profile.d/wsl-integration.sh" (use sudo to edit the file):

    # Check if we have HOME folder
    if [[ "${HOME}" == "/" ]]; then
      exit 0
    fi


    I mean before the line:

    WSL_INTEGRATION_CACHE=$HOME/.cache/wslu/integration`

     



    Guest
    This is now closed for further comments

×
×
  • 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