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

  • Installing MaNGOS on Ubuntu 18.04 LTS (LXD container)


    Specu

    With LXD you can easy take snapshots and move your server to another physical machine.

    Guide is fully tested on MaNGOS Zero with bots module enabled.

    Check the video with installation process:

    https://asciinema.org/a/299001

    If you do not want to use LXD, simple pass LXD instruction and go further.

    Let's start

    LXD installation & configuration:

    sudo apt install lxd && reboot

    Reboot is needed for reloading groups that will be assigned to your account.

    sudo lxd init

    with above command anserw defaults to all questions.

    Create container for our server:

    lxc launch ubuntu:bionic mangos-zero

    check if your container is running:

    lxc list
    +-------------+---------+-----------------------+-----------------------------------------------+------------+-----------+
    |   NAME      |  STATE  |         IPV4          |                     IPV6                      |    TYPE    | SNAPSHOTS |
    +-------------+---------+-----------------------+-----------------------------------------------+------------+-----------+
    | mangos-zero | RUNNING | *.*.*.* (eth1)        |                                               | PERSISTENT | 3         |
    +-------------+---------+-----------------------+-----------------------------------------------+------------+-----------+

    now we will connect to our container:

    lxc exec mangos-zero bash

    Please verify that you are on your contierner, you should have promt like this

    root@mangos-zero:~#

    if not you must try again with previous command providing your container name.


    MaNGOS server installation

    Install necessary packages:

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

    We need also install additional mysql package. I've attached file in this post so you don't need to search it.

    Download this file and send to your container. Open another terminal window and type:

    lxc file push /DOWNLOADED_DIRECTORY/mysql-apt-config_0.8.14-1_all.deb mangos-zero/root/

    Go back to first terminal where you are logged to your container and type:

    dpkg -i /root/mysql-apt-config_0.8.14-1_all.deb

    on installation window check mysql 5.7 is selected and hit Enter, when window will close type:

    apt update && apt full-upgrade -y

    When all packages are installed, secure your mysql installation.

    Please type and anserw to few questions to secure your mysql server.

    mysql_secure_installation

    Create new username and password to access our mysql server:

    mysql
    GRANT ALL ON *.* to 'mangos'@'localhost' IDENTIFIED BY 'set_database_password';

    Getting MaNGOS source code, compile and configuration.

    We will create new folder for sources:

    mkdir /opt/mangos && cd /opt/mangos

    Now we will download server and database sources to created folder.

    MaNGOS zero source (if you want different mangos version please change mangoszero to different repo name):

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

    Database files:

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

    Compiling MaNGOS (if your CPU have less than 4cores change -j4 to -j2 for two core CPU):

    cd server && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/bin/mangos && make -j4 && make install

    above command will create build folder, compile and install compiled server.

    Database installation:

    cd /opt/mangos/database && chmod -R +x *.sh && ./InstallDatabases.sh

    above command will fix script permissions and install your database.

    GameData files extraction:

    This can me done inside or outside the container, choice is yours how you do it. Remember that extraction take some time, so go take a cup of tea/coffe and cookie and wait. (ETA 1-2h)

    We need proper files for exctraction, go to your mangos installation and copy those files to yor game client:

    cd /usr/local/bin/mangos/bin/ && chmod -R +x *.sh && cp -av tools/* ExtractResources.sh MoveMapGen.sh mmap_excluded.txt offmesh.txt /GAME_CLIENT_DESTINATION

    now go to your game client and run:

    ./ExtractResources.sh

    Server configuration:

    First we have to fix path to MaNGOS configruation. We can do this in config files or simply creating a symlink. In this tutorial we will create symlink to keep defaults.

    cd /usr/local/bin/mangos/ && ln -s ../etc

    Now we have to copy config files:

    cd etc/ && cp -av mangosd.conf.dist mangosd.conf && cp -av realmd.conf.dist realmd.conf

    In realmd.conf find "LoginDatabaseInfo" and change database username and password to credentials we created before.

    In mangosd.conf find "LoginDatabaseInfo", "WorldDatabaseInfo", "CharacterDatabaseInfo" and change database username and password to credentials we created before.

    Systemd configuration:

    Create systemd configuration to autostart your realmd and mangosd. In LXD I recommend to run mangosd in screen, we prepare such a configuration in this tutorial.

    Realmd service:

    cat > /etc/systemd/system/realmd.service <<EOF
    [Unit]
    Description=MangosZ server
    After=network.target mysql.service
    
    [Service]
    Type=simple
    User=root
    ExecStart=/usr/local/bin/mangos/bin/realmd -c /usr/local/bin/mangos/etc/realmd.conf
    WorkingDirectory=/usr/local/bin/mangos/bin/
    Restart=on-abort
    
    [Install]
    WantedBy=multi-user.target
    EOF

    Mangosd service:

    cat > /etc/systemd/system/mangosd.service <<EOF
    [Unit]
    Description=MangosZ server
    After=network.target mysql.service
    
    [Service]
    Type=simple
    User=root
    #ExecStart=/usr/local/bin/mangos/bin/mangosd -c /usr/local/bin/mangos/etc/mangosd.conf
    ExecStart=/usr/bin/screen -mdS mangosd /usr/local/bin/mangos/bin/mangosd -c /usr/local/bin/mangos/etc/mangosd.conf
    WorkingDirectory=/usr/local/bin/mangos/bin/
    PIDFile=/usr/local/bin/mangos/etc/mzero.pid
    RemainAfterExit=true
    Restart=on-abort
    
    [Install]
    WantedBy=multi-user.target
    EOF

    Reload systemd with:

    systemctl daemon-reload

    Enable services for autostart:

    systemctl enable realmd
    systemctl enable mangosd

    Start services:

    systemctl start realmd
    systemctl start mangosd

    Checking status of running services:

    systemctl status realmd
    systemctl status mangosd

    If you want to attach to mangosd console, simply type:

    screen -r mangosd

    to detach mangosd screen press keyboard combination:

    CTRL+A+D

    Update IP address in database, so you can connect to your server:

    mysql realmd -h localhost -u mangos -p

    check your values in realmlist table

    select address,localAddress from realmlist;
    +---------------+---------------+
    | address       | localAddress  |
    +---------------+---------------+
    | 192.168.1.180 | 192.168.1.180 |
    +---------------+---------------+

    then update address and localAddress values with two query (replace IP_ADDRESS with yours)

    update realmlist set address='IP_ADDRESS';
    update realmlist set localAddress='IP_ADDRESS';

    Last thing is to restart both services and try to connect.

    At the end I wan't to share with you LXD container image, I made this tutorial based on it. Container do not include GameData so you have to extract it by yourself.

    MaNGOS-Zero LXD container based on Ubuntu 18.04

    How to use it? Download the file and type in terminal (you must have LXD)

    lxc image import mangoszero-serv.tar.gz --alias mangosz-img
    lxc launch mangosz-img mangos-zero

    mysql-apt-config_0.8.16-1_all.deb


    User Feedback

    Recommended Comments

    This is exactly what i need to get an istallation on my Ubuntu server.. only one thing  you gloss over the LXD parts without any detailed installation guides. sadly i am new to LXD and i am getting promted with guestions your guide tells me to answer yes to the leads on to things that i am utterly unably to (due to my own ignorance i admit) finish. 

    id love to run my lil test server in an Linix env for the very usability you state but alass i cant figure out how to use it. :(

    other than that Exellent guide i am shure ill get it to work without LXD.

    Link to comment
    Share on other sites

    i dont understand !!

    for the comannd :

    sudo lxd init

    can you explain !! what is the good command for this question? you tell respond Y to all question

    root@localhost:~# sudo lxd init

    Would you like to use LXD clustering? (yes/no) [default=no]: y

    What name should be used to identify this node in the cluster? [default=localhost]: 

    What IP address or DNS name should be used to reach this node? [default=212.227.191.39]: 

    Are you joining an existing cluster? (yes/no) [default=no]: y

    IP address or FQDN of an existing cluster node:

     

    Link to comment
    Share on other sites

    I have just tried to install this from a fresh Ubuntu 18.04 install. I am having a lot of problems where the provided commands are not finding the proper programs. It seems as if the version numbers have been changed on the server and the command is looking for a non existent file.  Anyone else seeing this happening? I just reformatted my machine and am going to try again.

    Link to comment
    Share on other sites

    4 minutes ago, razz2u2 said:

    I have just tried to install this from a fresh Ubuntu 18.04 install. I am having a lot of problems where the provided commands are not finding the proper programs. It seems as if the version numbers have been changed on the server and the command is looking for a non existent file.  Anyone else seeing this happening? I just reformatted my machine and am going to try again.

    Hi,

    It would help us understand better what's going on if you posted terminal logs.
    What step are you stuck on?

    Link to comment
    Share on other sites

    On 12/25/2019 at 5:47 PM, Natrist said:

    I have the SQL server up and am able to start the magosd and realmd .   I can connect to the SQL server from the host machine. The thing that has me stumped now is how do you access it through the network from a windows machine. I can ping the host ip address from windows machine,  but not the SQL ip address. I am also trying to access the database via HeidiSQL. That is not seeing the server either. 

     

     

    Link to comment
    Share on other sites

    Pinging the vm seems to work so i doubt thats the problem(i may be wrong though, haven't messed with that stuff in a while), it might be some rule or setting in the lxd configuration files to only accept some stuff from the host machine so try looking in the settings and mess with that

    Link to comment
    Share on other sites

    @razz2u2

    First of all in default configuration LXD is set up with lxdbr interface. Also you cant access your container from network even from LAN.

    If you want to access to your container from LAN you have to assign another profile to your container or change default one. New profile must be set up with network bridge or using macvlan (L2 layer) - both methods are good.

    In other words, by default your container is in 10.x.x.x subnet, if you want to assign subnet from your router DHCP i.e. 192.168.x.x, you MUST change or add bridge or macvlan profile. Then your container will have IP in 192.168.x.x subnet instead 10.x.x.x (lxdbr).

    Here how it should look:

    $~: lxc list
    +----------+---------+-----------------------+
    |   NAME   |  STATE  |         IPV4          |
    +----------+---------+-----------------------+
    | mangos0  | RUNNING | 192.168.x.x (eth1)    |
    +----------+---------+-----------------------+
    | test1    | RUNNING | 10.x.x.x (eth0)       |
    +----------+---------+-----------------------+
    | test2    | RUNNING | 10.x.x.x (eth0)       |
    +----------+---------+-----------------------+
    
    $~: lxc info mangos0
    Name: mangos0
    Remote: unix://
    Architecture: x86_64
    Created: 2019/10/30 17:48 UTC
    Status: Running
    Type: persistent
    Profiles: macvlan
    
    $~: lxc profile show macvlan
    config: {}
    description: macvlan profile
    devices:
      eth0:
        name: eth1
        nictype: macvlan
        parent: enp2s0
        type: nic
      root:
        path: /
        pool: default
        type: disk
    name: macvlan
    used_by:
    - /1.0/containers/mangos0


    Configuration such as this needs intermediate knowledge about LXD and network, so I do not recommend it for newbies.

    Edited by Specu
    Link to comment
    Share on other sites

    i get this messages,when i run systemctl realmd status

    Jan 12 01:01:02 mangos-two realmd[11325]:                         Content: 4
    Jan 12 01:01:02 mangos-two realmd[11325]:                     Description: Remove dbDocs
    Jan 12 01:01:02 mangos-two realmd[11325]:   You need database Version: 21
    Jan 12 01:01:02 mangos-two realmd[11325]:                       Structure: 2
    Jan 12 01:01:02 mangos-two realmd[11325]:                         Content: 1
    Jan 12 01:01:02 mangos-two realmd[11325]:                     Description: Add_Field_Comments
    Jan 12 01:01:02 mangos-two realmd[11325]: You must apply all updates after [A] to to use MaNGOS with this database.
    Jan 12 01:01:02 mangos-two realmd[11325]: These updates are included in the database/Realmd/Updates folder.
    Jan 12 01:01:02 mangos-two systemd[1]: realmd.service: Main process exited, code=exited, status=1/FAILURE
    Jan 12 01:01:02 mangos-two systemd[1]: realmd.service: Failed with result 'exit-code'.
     

    i have this installed

    lxc launch ubuntu:bionic mangos-two

    what shoud i do? thanks in advance!

    Link to comment
    Share on other sites

    42 minutes ago, Natrist said:

    Hi,

    You need to update your realmd database.

    yes ,and when i update the world database,but another problem arises.

    root@mangos-two:/opt/mangos/database/World/Updates/Rel21# mysql -umyname -pmypass mangos2 < Rel21_10_147__Marsh_Caribou.sql
    mysql: [Warning] Using a password on the command line interface can be insecure.
    ===== Status =====      ===== DB is on Version: =====
    * UPDATE FAILED *       Twilight Thug - Script Update
    root@mangos-two:/opt/mangos/database/World/Updates/Rel21# mysql -umyname -pmypass mangos2 < Rel21_10_148_Script_update_for_Mobu.sql
    mysql: [Warning] Using a password on the command line interface can be insecure.
    ===== Status =====      === Expected ===        ===== Found Version =====
    * UPDATE SKIPPED *      Rel21_10_147 - IS NOT APPLIED   21_10_146 - Twilight Thug - Script Update

    Link to comment
    Share on other sites

    9 minutes ago, onixiya said:

    You'll need to run the code in the sql file manually

    i just did as you say, code one by one ,manually , it stucked at Rel21_10_147__Marsh_Caribou.sql, but 21_10_109 to 21_10_145 goes fine

    Link to comment
    Share on other sites

    On 1/12/2020 at 2:59 AM, 汪可微 said:

    Rel21_10_147__Marsh_Caribou.sql import failed,i don't know why ,and how to fix it.

    @汪可微 @onixiyaI noticed that on line #47 it says INSERT INTO `creature_TEMPLATE` where it should say INSERT INTO `creature_template`.

    Change the capital TEMPLATE to all lowercase, and it will work.
    I've spoken with @Necrovoice and he should be updating the github repo as well.

    Link to comment
    Share on other sites

    On 2/5/2020 at 10:01 AM, Fyre said:

    @汪可微 @onixiyaI noticed that on line #47 it says INSERT INTO `creature_TEMPLATE` where it should say INSERT INTO `creature_template`.

    Change the capital TEMPLATE to all lowercase, and it will work.
    I've spoken with @Necrovoice and he should be updating the github repo as well.

    Yes this has been corrected.

    • Like 2
    Link to comment
    Share on other sites

    On 2/5/2020 at 11:01 PM, Fyre said:

    @汪可微 @onixiyaI noticed that on line #47 it says INSERT INTO `creature_TEMPLATE` where it should say INSERT INTO `creature_template`.

    Change the capital TEMPLATE to all lowercase, and it will work.
    I've spoken with @Necrovoice and he should be updating the github repo as well.

    nice job!  i can finally save my private server ~

    Link to comment
    Share on other sites

    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/eastern_kingdoms/stranglethorn_vale.cpp.o
    /opt/mangos/server/src/modules/SD3/scripts/eastern_kingdoms/burning_steppes.cpp: In member function ‘virtual void npc_klinfran_the_crazed::npc_klinfran_the_crazedAI::UpdateAI(uint32)’:
    /opt/mangos/server/src/modules/SD3/scripts/eastern_kingdoms/burning_steppes.cpp:729:44: error: no matching function for call to ‘npc_klinfran_the_crazed::npc_klinfran_the_crazedAI::DemonDespawn(bool)’
                             DemonDespawn (false) ;
                                                ^
    /opt/mangos/server/src/modules/SD3/scripts/eastern_kingdoms/burning_steppes.cpp:654:14: note: candidate: void npc_klinfran_the_crazed::npc_klinfran_the_crazedAI::DemonDespawn(Unit*, bool)
             void DemonDespawn(Unit* playerFacing = nullptr, bool triggered = true)
                  ^~~~~~~~~~~~
    /opt/mangos/server/src/modules/SD3/scripts/eastern_kingdoms/burning_steppes.cpp:654:14: note:   no known conversion for argument 1 from ‘bool’ to ‘Unit*’
    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/eastern_kingdoms/westfall.cpp.o
    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/eastern_kingdoms/wetlands.cpp.o
    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/kalimdor/ashenvale.cpp.o
    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/kalimdor/azshara.cpp.o
    [ 56%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/kalimdor/boss_azuregos.cpp.o
    [ 57%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/kalimdor/darkshore.cpp.o
    [ 57%] Building CXX object src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/kalimdor/desolace.cpp.o
    src/modules/SD3/CMakeFiles/mangosscript.dir/build.make:710: recipe for target 'src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/eastern_kingdoms/burning_steppes.cpp.o' failed
    make[2]: *** [src/modules/SD3/CMakeFiles/mangosscript.dir/scripts/eastern_kingdoms/burning_steppes.cpp.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    CMakeFiles/Makefile2:913: recipe for target 'src/modules/SD3/CMakeFiles/mangosscript.dir/all' failed
    make[1]: *** [src/modules/SD3/CMakeFiles/mangosscript.dir/all] Error 2
    Makefile:129: recipe for target 'all' failed
    make: *** [all] Error 2
     

    Link to comment
    Share on other sites

    Hey, thanks for the guide.

    Except for my container is running in Proxmox, I have followed this guide to the letter.  I am able to authenticate in the game client, but the realm is showing offline.

        1. I can verify the firewall (ufw) is inactive.

        2. I assume the extracted resources (maps, vmaps, etc.) go into "/usr/local/bin/mangos/bin/" but I would love verification of this.

        3. screen -r mangosd returns "There is no screen to be resumed matching mangosd."

    If it's not too much trouble, please let me know what I might be missing so that I can get this instance functional.

    Thanks all!!!

    Link to comment
    Share on other sites



    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