How-to:Linux

From TrinityCore Wiki
Jump to: navigation, search

Contents

TrinityCore is a rather complex and demanding software, and as such it may seem quite daunting to install and maintain. This howto will attempt to help with this, and also show how this can be done in a way that also shows you the basics of how linux compilations works.
We also advice you to read your distributions documentation on how to install packages, and also have at least knowledge on how it works with regards to adding users.

Most of this howto is based on the use of a Debian-based distribution, though we'll try to inform as best as we can when something differs totally.

Important: As the TrinityCore project is highly active, portions of the guide may be outdated. In case something fails, please check the forum, which will usually have the answer already.

Getting started

We advice you to run/install TrinityCore on a dedicated machine, or a machine that you know you have full control over.
We also advice you to NOT install the software on a shared server solution or any server where other users may have access or might require resources to be available at all times.
Your server may be abruptly killed by an angry administrator or system staff for overuse of system resources.

Package requirements

This list gives an absolute minimum of packages required to work with a basic install of TrinityCore, and is in no way meant as "the ultimate solution of packages".
Please read the distribution documentation or other howtos on other packages / solutions that you might want installed, for example LAMP (Linux w/Apache, MySQL and PHP).

Debian-based distributions

sudo apt-get install build-essential autoconf libtool gcc g++ make cmake git-core patch wget links zip unzip unrar
sudo apt-get install openssl libssl-dev mysql-server mysql-client libmysqlclient15-dev libmysql++-dev libreadline5-dev zlib1g-dev libbz2-dev

RedHat-based distributions

Redhat-based distributions do not (as far as we know) include CMake by default, and require extra repositories to be enabled.
Please refer to the distributions archive and/or secondary repositories (ex. RPMForge).

Installation of the packages mentioned underneath will require either root-privileges, or the use of sudo prepended to the respective commands.

yum groupinstall "development tools"
yum groupinstall "development libraries"
yum install gcc-g++ git-core wget links zip unzip unrar
yum install mysql-server mysql-client mysql-devel
yum install openssl

Not included in default package-repositories (as mentioned above)

yum install cmake

Creating a user to work with

Start with logging in to your Linux-machine and create an account for the server itself - on most recent distributions this can easily be done with the following command :

sudo adduser <username>

Note : Change <username> into the preferred username of your server-account - we will as far as possible avoid using specific usernames in this howto.

Installing ACE (Adaptive Communication Environment)

TrinityCore requires a specific communication-library for inter-process communication, and as such needs special attention on that matter. This is because most distributions (even the most recent ones) do not supply the version required by TrinityCore as part of their basepackages.

To start the installation, log in to your previously created user:

su - <username>
cd ~/

Note: Replace <username> with the username you made in Creating a user to work with.

Downloading and unpacking the ACE-library

wget http://download.dre.vanderbilt.edu/previous_versions/ACE-6.0.0.tar.gz
tar xvzf ACE-6.0.0.tar.gz
cd ACE_wrappers/
mkdir build
cd build

Note: Additional downloads can be found at Obtaining ACE, TAO, CIAO, and DAnCE (You will want the "ACE only tar+gzip format")

Configuring, compiling and installing ACE

Choose one of the following methods (not both):

Method 1: Systemwide installation

Recommended method. This will install ACE for all users of the machine. It will build the library as a user without any specific privileges, and then install it into /usr/local as root (the superuser).

../configure --disable-ssl
make
sudo make install
Method 2: Local installation

Use this method to install ACE for only a single user.

../configure --prefix=/home/<username>/.sys/ --disable-ssl
make
make install
FreeBSD Users

You should apply this patch to the ace library before you compile it.

Installing OpenSSL (aka libSSL)

The entire procedure here is for people that do believe they need the latest revision - normally the version that comes with your distribution is sufficient enough.
The procedure described here has been created on a time that the version 0.9.8o was the newest one, it also should work on newer ones.
So if you want a newer (or maybe older) version check ftp://ftp.debian.org/debian/pool/main/o/openssl/

32-bit Debian-based distributions
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl-dev_0.9.8o-4squeeze1_i386.deb
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-4squeeze1_i386.deb
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/openssl_0.9.8o-4squeeze1_i386.deb
sudo dpkg -i libssl0.9.8_0.9.8o-4squeeze1_i386.deb
sudo dpkg -i openssl_0.9.8o-4squeeze1_i386.deb
sudo dpkg -i libssl-dev_0.9.8o-4squeeze1_i386.deb
64-bit Debian-based distributions
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl-dev_0.9.8o-4squeeze1_amd64.deb
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-4squeeze1_amd64.deb 
wget ftp://ftp.debian.org/debian/pool/main/o/openssl/openssl_0.9.8o-4squeeze1_amd64.deb 
sudo dpkg -i libssl0.9.8_0.9.8o-4squeeze1_amd64.deb 
sudo dpkg -i openssl_0.9.8o-4squeeze1_amd64.deb 
sudo dpkg -i libssl-dev_0.9.8o-4squeeze1_amd64.deb

Other distributions

For cases where you want to run an even newer release of OpenSSL than mentioned here, or your distribution not supplying a version that isn't of recent date, please check your distributions repositories or documentation.
You can also retrieve it as sourcecode at http://openssl.org/source (feel free to use newer packages if you really feel like it). To build it from sourcecode, here's a primer :

wget http://openssl.org/source/openssl-0.9.8o.tar.gz
tar -xvf openssl-0.9.8o.tar.gz
cd openssl-0.9.8o
Alternative 1 : Local installation
./config --prefix=/home/<username>/.sys shared
make
make install

Replace <username> with the username you chose when creating the account.

Alternative 2 : Systemwide installation
./config shared
make
sudo make install

Please note that any old revision of the OpenSSL package installed by the distribution may/will interfere with the new version. See your distribution documentation for information on how to remove it to be able to use the new one.
If you have done the systemwide install, you will no longer need any extra parameters for SSL when compiling TrinityCore.

Optional software

These tools are only needed or useful if you are connecting from a Windows host to your Linux machine

Graphical database-viewing/editing

Please note that the software called Navicat is NOT supported due to issues with how it handles SQL-files with "/* */"-style comments. We advice all users to stay well clear of this program unless they really are looking for issues.

Remote console connects to the server
Filetransfer through SFTP or FTP

Building the server itself

Getting the sourcecode

cd ~/
git clone git://github.com/TrinityCore/TrinityCore.git 

A directory trinitycore will be created automatically and all the source files will be stored in there.

FreeBSD G3D Patch

FreeBSD users will need to apply the patch located here for g3d to compile properly, before doing anything else.

Compiling the sourcecode

Creating the build-directory

To avoid issues with updates and colliding sourcebuilds, we create a specific build-directory, so we avoid any possible issues due to that (if any might occur)

mkdir build
cd build

Configuring for compiling

To configure the core, we use space-separated parameters attached to the configuration-tool (cmake) - do read the entire section before even starting on the configuration-part.
This is for your own good, and you HAVE been warned. A full example will also be shown underneath the explanations.

cmake ../TrinityCore/ [additional parameters]
Parameter explanations

full path to your libACE.so file INCLUDING the filename - do not use if you have ACE installed systemwide:

-DACE_LIBRARY=<path to ACE library>

path to the libACE include directory - do not use if you have ACE installed systemwide:

-DACE_INCLUDE_DIR=<path to ACE includes/headers>

path to your OpenSSL library - do not use if you have OpenSSL installed systemwide:

-DOPENSSL_LIBRARIES=<path to OpenSSL library>

path to your OpenSSL includes directory - do not use if you have OpenSSL installed systemwide:

-DOPENSSL_INCLUDE_DIR=<path to OpenSSL includes>
-DSERVERS             Build worldserver and authserver
-DSCRIPTS             Build core with scripts included
-DTOOLS               Build map/vmap extraction/assembler tools
-DUSE_SCRIPTPCH       Use precompiled headers when compiling scripts
-DUSE_COREPCH         Use precompiled headers when compiling servers
-DUSE_SFMT            Use SFMT as random numbergenerator
-DWITH_WARNINGS       Show all warnings during compile
-DWITH_COREDEBUG      Include additional debug-code in core
-DPREFIX              Set installation directory
-DCONF_DIR            Set configuration directory
-DLIBSDIR             Set library directory
-DCMAKE_C_FLAGS       Set C_FLAGS for compile (advanced users only)
-DCMAKE_CXX_FLAGS     Set CXX_FLAGS for compile (advanced users only)

Note : * means "used by default", and does not need to be set.

The above parameters when combined into a full example :

cmake ../TrinityCore/ -DPREFIX=/home/<username>/server -DWITH_WARNINGS=1

The above build the servers, set installation base directory to /home/<username>/server and show all warnings during compile.
Note that you WILL have to configure the server well if you ever want to use the RA-access functionality.

Building the core

After configuring and checking that everything is in order (read cmakes output), you can build Trinity (this will take some time unless you are on a rather fast machine)

make
make install

If you have multiple CPU cores, you can enable the use of those during compile :

make -j <number of cores>
make install 

After compiling and installing, you will find your core binaries in /home/<username>/server/bin, and the standard configuration files in the /home/<username>/server/etc folder.
(As usual, replace <username> with the username you created earlier). Now you can continue reading on and learn how how to update the sourcetree.

Keeping the code up to date

TrinityCore developers are always at work fixing and adding new features to the core. You can always check them here. To update the core files, do the following :

cd ~/TrinityCore/
git pull origin master

Now return to the compilation-section again, and repeat the instructions there.

Installing libMPQ (MoPaQ) MPQ-reader library

Installation of the libMPQ library is only required if you want to extract the datafiles, and/or compile the tools.
Do note that the library has been hardlinked to the binary in later revisions, and is not "enforced" unless the tools are required.

Configuring, compiling and installing libMPQ

IMPORTANT : If you are the owner of the machine, and at this stage want the MPQ-library to be available for other users on your Linux-machine (and also making it easier for yourself at later stages), please follow alternative 2

Change directory to ~/TrinityCore/dep/libmpq/ before doing this

Alternative 1 : Local installation
sh ./autogen.sh
./configure --prefix=/home/<username>/.sys/
make
make install

Again, replace <username> with the username you chose when creating the account.

Alternative 2 : Systemwide installation
sh ./autogen.sh
./configure
make
sudo make install

As stated above, alternative 2 will build the library as a user without any specific privileges, and then install it into /usr/local as root (the superuser), reachable for other users that wish to use it for their own projects.
It is safe to allow this library to be installed systemwide.

Installing MySQL Server

When configuring MySQL make sure you remember the password you set for the default root account and that you enabled both MyISAM and InnoDB engines.

You can leave all the other settings as default. You might want to enable remote access to your MySQL server if your are also testing a website for your Trinity server or if you have friends testing with you which need access from remote. Remember that this will decrease the security level of your MySQL server!

INSTALLING THE DATABASES

About once per month all of the updates made from all previous months are combined into a few bulk .sql files to easily import them into your databases. These updates are similar to how Service Packs are released for Windows. Furthermore, smaller, individual .sql updates are occasionally added as the core is fixed by the developers (these can be seen in Git Extensions while selecting individual commits in the commit view with the Diff tab selected). This offers two options:

  1. (Beginner) It is highly recommended to keep your current revision (the commit in bold text in Git Extensions) on a commit with a description similar to "DB: TrinityDB revision XX: move SQL updates to the old directory" (example). These commit descriptions mark each monthly compilation, and are also useful for knowing when a new compilation is released and can be downloaded/imported. Doing this will keep your databases 100% up-to-date each month.
  2. (Advanced) If you decide to update your revision outside of a commit with the above description, you must also import all of the smaller .sql updates (C:\Trinity\sql\updates folder) that have been done with EACH commit up to yours, if there are any. Not importing these additional updates cause a majority of user errors. This will ensure that your databases are 100% up-to-date.

This is described in more detail in the following instructions.

Downloading the Database

  1. Download the latest database compilation from TrinityCore Github Downloads.
    • The Download Packages at the top are the ones you want. Find the package with the latest date and download it.
      • For example, a file such as TDB_full_335.11.42_2011_08_27.rar tells us three things:
        • TDB: Trinity Database
        • 335.11.42: The version of the database and the client it belongs to. 335 = WoW version 3.3.5, 42 = the 42nd full revision.
        • 2011_08_27: The date - Aug 27th, 2011
    • The file is in .rar format, so you will need an archive program like 7zip to unpack it.

Note: There are multiple .sql files to choose from in the .rar archive. If this is your first time installing TrinityCore, you will want to import the file with "TDB_full" at the beginning. The other files are for updating existing world and characters databases from a previous compilation. This makes it easy to update your databases from one compilation to the next as explained in the section above.

Installing The Trinity Databases

Trinity needs three databases to run - Auth, Characters, and World:

auth - holds account data - usernames, passwords, GM access, realm information, etc.
characters - holds character data - created characters, inventory, bank items, auction house, tickets, etc.
world - holds game-experience content such as NPCs, quests, objects, etc.

Note: The auth database was previously named "realmd". If you are having trouble and searching the forum for solutions, try searching for realmd instead of auth.

The following steps are done using the database management program you installed in Step #5 of Software Required (ex. HeidiSQL or SQLYog):

  • In HeidiSQL, click on the database you want to use in order to "select" it, then click Tools > Load SQL File... > (select the file) > Run file(s) directly
  • In SQLYog, click on the database you want to use in order to "select" it, then click Database > Import > Execute SQL Script


  1. Create the three databases by importing C:\Trinity\sql\create\create_mysql.sql. You now have three databases - auth, characters, and world. You may need to refresh your program in order to see the new databases.
  2. Click on the "auth" database and import the auth database structure by importing C:\Trinity\sql\base\auth_database.sql.
  3. Click on the "characters" database and import the characters database structure by importing C:\Trinity\sql\base\character_database.sql.
  4. Click on the "world" database and import the world database structure by extracting and importing the "TDB_full" .sql file you downloaded from the Downloading the Database section.

Note: If this is your first time installing TrinityCore, continue with SETTING UP THE SERVER

Keeping the DB up to date

Both core and DB fixes will be committed to the TrinityCore repository, which you may also view in Git Extensions by following the "Fetch" instructions in Keeping the Source Up-to-Date. Pending fixes can be found on our tracker with data from the developers and contributors.

As mentioned earlier, it is recommended to stay on the same revision as the TDB_full database (Beginner). If you choose to brave the wilds beyond the current monthly revision, use the (Advanced) instructions below.

Note: You can run the following query on the World database to see your current DB and core revision:
SELECT * FROM `version`;

This instruction assumes that you have already completed the (Beginner) Keeping the Source Up-to-Date, which means you now have a newly downloaded revision archive from the TrinityCore Downloads. This instruction also assumes that you have completed the initial Downloading the Database which had you import the TDB_FULL.sql, and it is now approximately one month later - a new revision has been released.

Note: If you have made any custom changes to your database, you may wish to backup (export) all three of them (world, characters, and auth) before performing the next few steps.

  • (Beginner)
    1. Extract the TDB_FULL.sql file from the archive and import it into your world database.
    2. If they exist, also import the characters_ and auth_ .sql files into their respective databases.
    3. Once this is finished and you have already compiled your source, you may run the worldserver.exe to load your server. The revision update is complete.

Note: It is at this point that most user errors occur. If your worldserver.exe closes abruptly, make sure that your core's version matches your database version. Check that the `version` table in your world database matches the commit hash listed beside the archive you downloaded at TrinityCore Downloads.

  • (Advanced)

If you update your source beyond a monthly revision, you will likely have additional updates in the C:\Trinity\sql\updates folder. The folders within show which database they need to be imported to. For example, the "world" folder has all of the files that need to be imported to your world DB.

File naming conventions follow simple and consistent rules:

yyyy_mm_dd_id_world_tablename.sql -> World DB    
yyyy_mm_dd_id_character_tablename.sql -> Characters DB    
yyyy_mm_dd_id_auth_tablename.sql -> Auth DB
(yyyy - the year; mm - month; dd - day; id - incremental daily id

Note: The incremental daily id starts at 00, with 00 needing to be imported first, then 01, then 02, etc.

It is imperative to know the date of your previous revision when updating in order to import all of the updates from that revision to your current one. Then, simply follow these steps:

  1. Browse into your C:\Trinity\sql\updates\world folder and import all *_world_*.sql files into your world DB that have a date later than your previous revision.
  2. Do the same above step for the characters and auth folders, if they exist. If these folders don't exist, there have not been any characters or auth database updates.

Note: If you are comfortable with executing batch files, you are welcome to use the batch file located on the Combine SQL Updates thread in the TrinityCore forum to make the importing process easier. Also note that doing this will also gather up .sql files you may have already imported. In most cases this is safe, but you should use this batch file at your own risk.

Pro Tip: If your world database is ever corrupted (ex. creatures or objects are accidentally deleted), it is easy to revert it back to its original state by re-importing the TDB_FULL.sql into your world database. If you updated your core using the (Advanced) instructions, make sure you also re-import all of the necessary C:\Trinity\sql\updates as explained above.

Setting up the server

Now that you have the source compiled and the databases installed, you need to set up the server.


Extracting dbc, maps and vmaps files

In order to run, TrinityCore needs dbc- and map-files. In addition, if you want to enable vmaps (Making NPCs unable to see through walls etc.) you will need to extract them as well.
Warning: use Trinity's extractors. If you use extractors from other projects it is almost certain that your Trinity Core will not recognize the extracted data!
To get the Trinity extractors you have to build the project with option -DTOOLS=1 (#Parameter_explanations).

dbc and maps files

cd <your WoW client directory>
/home/<username>/server/bin/mapextractor
mkdir /home/<username>/server/data
cp -r dbc maps /home/<username>/server/data


Visual Maps (aka vmaps - optional)

You can also extract vmaps which will take quite a while depending on your machine (1-2 hours).

cd <your WoW client directory>
/home/<username>/server/bin/vmap3extractor
mkdir vmaps
/home/<username>/server/bin/vmap3assembler Buildings vmaps
cp -r vmaps /home/<username>/server/data
cp Buildings/* /home/<username>/server/data/vmaps

Configuring the server

First of all you need to create 2 files : worldserver.conf and authserver.conf in your /home/<username>/server/etc/ folder.
You'll find 2 files named worldserver.conf.dist and authserver.conf.dist. Copy these to their namesakes without the .dist extension.

cp worldserver.conf.dist worldserver.conf
cp authserver.conf.dist authserver.conf

Now you can go ahead and edit the two files (worldserver.conf and authserver.conf) to your liking, with the following notes in mind about them :

worldserver.conf

Edit MySQL account username and password (instead of trinity;trinity).

LoginDatabaseInfo     = "127.0.0.1;3306;trinity;trinity;auth"
WorldDatabaseInfo     = "127.0.0.1;3306;trinity;trinity;world"
CharacterDatabaseInfo = "127.0.0.1;3306;trinity;trinity;characters"

IMPORTANT - If you choose NOT to use vmaps, you must edit the following in the worldserver.conf or your server will not start: :

    vmap.enableLOS = 1 -- set this to 0
    vmap.enableHeight = 1 -- set this to 0
    vmap.petLOS = 1 -- set this to 0
    vmap.enableIndoorCheck = 1 -- set this to 0 

authserver.conf

Edit MySQL account username and password (instead of trinity;trinity).

LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth"

Realmlist table

You need to make sure that the authserver directs incoming connections to your realm.
In the auth database there is a table called realmlist, where you need to edit the field address according to your needs :

127.0.0.1                -- Leave default localhost if you are connecting alone from the same machine TrinityCore runs on.
<Your LOCAL NETWORK ip>  -- Use the machine's LAN ip if you want other computers from the same network as the TrinityCore server to connect to your server.
<Your PUBLIC NETWORK ip> -- Use your PUBLIC ip if you have friends and testers which need to connect your server from the internet.

Support and conclusion

This guide is for beginners and states what to do and what to edit, assuming you left everything else with default values. Visit the following threads and post questions if you still need special support:

Warning: The TrinityCore development team/owners and the TrinityDB team/owners DO NOT in any case sponsor nor support illegal public servers. If you use these projects to run an illegal public server and not for testing and learning it is your own personal choice.

SPECIAL NOTES!

Things to notice :

-DLARGE_CELL=0         has been deprecated and is not used at all (remove this if ever used before)
-DMYSQL=1              has been deprecated and is not used at all (remove this if ever used before)
-DSSLLIB=<path>        has been deprecated and is not used at all (remove this if ever used before)
-DRA=0                 has been deprecated, it is handled directly in worldserver.conf
-DCLI=0                has been deprecated, it is handled directly in worldserver.conf
-DWITH_SQL             has been deprecated, SQL files are kept in the sourcetree "sql"-folder during installation
-DWITH_COREDEBUG=0     not required, as its default is : 0

The new method for custom SSL-libraries are:

-DOPENSSL_LIBRARIES=<path to OpenSSL libraries directory>
-DOPENSSL_INCLUDE_DIR=<path to OpenSSL includes directory>

The paths for installation can be done without any other parameters but this :

-DPREFIX=/path/to/where/you/want/core/to/be/installed

It will create the following structure:

<path>/bin/             - binaries will be placed here
<path>/etc/             - configfiles will be placed here

Also, compile has been tested on Debian 5.0.4 x32/x64, Ubuntu 10.04 x32/x64, Ubuntu 11.04 x64, Ubuntu Server 11.04 x64, Centos 5.4 x32/x64 - all without problems IF YOU DO NOT MESS AROUND ON YOUR OWN!
If you have issues with OpenSSL-libraries, look at http://trinitycore.info/index.php/Howto_linux_tc2#Installing_OpenSSL_.28aka_libSSL.29

Do NOT add your own compiled libraries on recent distributions, this is highly unneeded, and will just add confusion.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox