Building TrinityCore with TrinityDB r33 on Ubuntu 10.04

Setting up TrinityCore on Ubuntu 10.04
The awesomeness of 5-boxing localhost



This original guide describes the complete process of setting up TrinityCore rev9535  with TrinityDB r33 (TDB) on a new Ubuntu 10.04 or 9.10 installation. This server build is compatible with the current 3.3.5 retail clients. During the bulk of the installation, I worked from the generally excellent Linux-specific instructions at http://www.trinitycore.info/index.php?title=Installing_TrinityCore_on_recent_Linux-based_systems which contains distribution-specific details for RedHat and Debian-like systems. The only place where those directions were necessarily incomplete was the TrinityDB update process, which required some troubleshooting due to the changing nature of the unstable release DB updates.


Setting up the base system (optional)

I began with a fresh installation of Ubuntu 10.04 using Wubi, which was patched up with the current updates (Update Manager will pop up and offer these updates to you):
libfreetype6 linux-headers-2.6.32-24 linux-headers-2.6.32-24-generic linux-image-2.6.32-24-generic linux-libc-dev

I have also tested this process on Ubuntu 9.10, which happily worked exactly as 10.04 for the purpose of build dependencies.

Installing to a VirtualBox or VMWare instance should also work just fine, although I haven't tested a build on those platforms.


Installing TrinityCore dependencies


First, install the Ubuntu packages required for building TrinityCore.
$ sudo aptitude install build-essential autoconf libtool gcc g++ make cmake subversion mercurial patch wget links zip unzip unrar openssl libssl-dev mysql-server mysql-client libmysqlclient15-dev libmysql++-dev libreadline5-dev zlib1g-dev libbz2-dev

Now create a separate 'trinity' user for the server to run under (or 'tcore' or whatever you like). Then, switch to this user and start setting up the dependencies which we must build. Note that I give 'trinity' sudo on Ubuntu by putting it in the admin group, in order to install some libraries systemwide. If you're preparing a public server, you should remove the 'trinity' user's sudo privileges after setup is complete.
$ sudo adduser trinity
$ sudo usermod -G admin -a trinity
$ su - trinity
Building ACE 5.7.8

One of the TrinityCore dependencies is the ACE framework. The latest version, 5.7.8, is recommended by the TrinityCore developers. I confirmed that Ubuntu 10.04's ACE packages are older than 5.7.8:
$ apt-cache policy libace-dev | grep Candidate
Candidate: 5.6.3-6

So, it's still appropriate to build by hand:

$ cd ~/
$ wget http://download.dre.vanderbilt.edu/previous_versions/ACE-5.7.8.tar.gz
$ tar xvzf ACE-5.7.8.tar.gz
$ cd ~/ACE_wrappers/
$ mkdir build
$ cd build
$ ../configure    $ make
$ sudo make install

Note: If you get an segfault at this step on 'make', and you are like me, you are probably on your third fresh install of Wubi in a row and forgot to restart since installing kernel updates.


Building TrinityCore

Next, it's time to build the Trinity Core server itself - starting by checking out source from the repository. Still as user 'trinity':
$ cd ~/
$ hg clone http://trinitycore.googlecode.com/hg/ trinitycore
Now we make a build directory in the 'trinity' home directory, and run the Cmake configuration script:

$ mkdir build
$ cd build
$ cmake ../trinitycore/ -DPREFIX=/home/trinity/server -DSQL=1 -DTOOLS=1
For the build, I passed the '-j 2' switch to use both cores - use different values after '-j' depending on the number of your cores.:
$ make -j 2
$ make install
For future updates to the TrinityCore server, do this:

$ cd ~/trinitycore/
$ hg pull -u
$ cd ~/build
$ make clean
Then, repeat the steps to first configure with Cmake, then compile and install listed above.

Setting up TrinityDB r33 (TDB)

Warning! It took a lot of grepping around the updates folders to get me through this part of the installation. If you don't follow the order of operations described here, or you install additional update files not mentioned, there's no guarantee it will work. Heck, even if you do follow this order, you may have to correct something different which I didn't have to deal with. Here be Dragons.

Check out the database using hg:
$ cd ~/
$ hg clone http://trinitydb.googlecode.com/hg/ trinitydb
Now create the three databases, 'world', 'auth' and 'characters' including mysql user privileges for 'trinity'. Don't run these again for future updates, or you'll reset your entire database and lose any current data:
$ mysql -u root -p < server/share/trinity/sql/tools/create_mysql.sql
$ mysql -u root -p auth < trinitycore/sql/base/auth_database.sql
$ mysql -u root -p characters < trinitycore/sql/base/characters_database.sql

Now for some 'world' database updates which come from the trinitydb sandbox. The last major release was 8874, and there's also an update pack for 8875 through 8996, but we're patching even further up to date from there in a minute.

$ cd ~/trinitydb/full_db/
$ unzip TDB_335.10.32_8874.zip
$ mysql -u trinity --password="trinity" world < TDB_335.10.32_8874.sql
$ cd ../updates/335.10/
$ mysql -u trinity --password="trinity" world < 33_01_corepatch_world_8875_8996.sql
$ mysql -u trinity --password="trinity" world < 33_02_procedures_world.sql
$ mysql -u trinity --password="trinity" world < 33_03_updatepack_world.sql

Now import lots of updates from trinitydb, continuing basically where 8896 left off from, in the previous trinitycore sql updates:
$ cd ~/trinitycore/sql/updates/3.3.5a_old
$ mysql -u trinity --password="trinity" world < ../3.3.2_old/7552_world_battleground_template.sql
$ mysql -u trinity --password="trinity" world < ../3.3.2_old/7432_world_access_requirement.sql
$ mysql -u trinity --password="trinity" world < ../2.4.3_old/90_world.sql
$ mysql -u trinity --password="trinity" world < 8897_world_npc_vendor.sql
$ mysql -u trinity --password="trinity" world < 8897_world_trinity_string.sql
$ mysql -u trinity --password="trinity" world < 8905_world_spell_proc_event.sql
$ mysql -u trinity --password="trinity" world < 8906_world_spell_proc_event.sql
$ mysql -u trinity --password="trinity" world < 8915_world_trinity_string.sql
$ mysql -u trinity --password="trinity" world < 8920_world_spell_dbc.sql
$ mysql -u trinity --password="trinity" world < 8920_world_spell_linked_spell.sql
$ mysql -u trinity --password="trinity" world < 8921_world_spell_dbc.sql
$ mysql -u trinity --password="trinity" world < 8925_world_spell_group.sql
$ mysql -u trinity --password="trinity" world < 8957_world_command.sql
$ mysql -u trinity --password="trinity" world < 8957_world_disables.sql
$ mysql -u trinity --password="trinity" world < 8957_world_trinity_string.sql
$ mysql -u trinity --password="trinity" world < 8971_world_command.sql
$ mysql -u trinity --password="trinity" world < 8971_world_trinity_string.sql
$ mysql -u trinity --password="trinity" world < 8975_world_spell_dbc.sql
$ mysql -u trinity --password="trinity" world < 8988_world_playercreateinfo.sql
$ cd ~/trinitycore/sql/updates
$ for i in `ls *_world_*.sql`; do mysql -u trinity --password="trinity" world < $i; done

The first few older updates are to fix problems with several recent updates which referred to nonexistent tables or columns. The new updates are not perfect yet, after all this is an unstable revision...

Procedure for updating database in future: run these commands to update your DB sandbox, then update from the new files since your last build.

$ cd ~/trinitydb
$ hg pull -u

DBC, maps and vmaps:

I copied a 3.3.5 retail client directory over from a Windows partition; you could also install through Wine directly to Ubuntu if desired.
$ cd ~/
$ cp -R /host/Users/Public/Games/World\ of\ Warcraft/ .
Now, extract maps and copy to the server: 
$ cd World\ of\ Warcraft/
$ /home/trinity/server/bin/mapextractor
$ cp -r dbc/ maps/ /home/trinity/server/data/ 
And vmaps:
$ /home/trinity/server/bin/vmap3extractor
$ mkdir vmaps
$ /home/trinity/server/bin/vmap3assembler Buildings vmaps
$ cp -r vmaps/ /home/trinity/server/data/
Afterwards you can remove the extracted data from your client directory:

$ rm -rf dbc/ maps/ vmaps/


Configuring the worldserver and authserver
$ cd ~/ 
$ cd server/etc/
$ cp authserver.conf.dist authserver.conf 
$ cp worldserver.conf.dist worldserver.conf 

Setting up logs a bit better than the default, which dumps them into the bin directory:
$ cd ~/
$ mkdir -p server/log/worldserver
$ mkdir -p server/log/authserver

A few modifications are needed to worldserver.conf; set these values: 
DataDir = "/home/trinity/server/data/"

LogsDir = "/home/trinity/server/log/worldserver/"
Changes in authserver.conf:
LogsDir = "/home/trinity/server/log/authserver/"
BindIP = "127.0.0.1"

Running TrinityCore 'worldserver' and 'authserver'

For server startup, it's nice to run each daemon in the foreground in a separate terminal, as the worldserver daemon will spawn an interactive control console upon startup:

The two server binaries which were just built reside here.
/home/trinity/server/bin/authserver
/home/trinity/server/bin/worldserver
I created convenient start scripts in the 'trinity' user's home directory.
$ echo "/home/trinity/server/bin/authserver" > authserver_start.sh
$ echo "/home/trinity/server/bin/worldserver" > worldserver_start.sh
$ chmod +x *_start.sh
And created stop scripts, although in practice you can just Ctrl-C in their terminals to shut down.
$ echo "kill -9 `pidof authserver`" > authserver_stop.sh
$ echo "kill -9 `pidof worldserver`" > worldserver_stop.sh
$ chmod +x *_stop.sh
Running the start scripts in separate terminals under the 'trinity' user, there will be several warnings/errors in the worldserver startup log but nothing critical.

$ ./authserver_start.sh

$ ./worldserver_start.sh

The authserver starts up quickly with a quiet log; the worldserver takes a minute or so to start up on my AMD Vision dual core system, and uses around 200MB of memory while running. What do they look like in the process list? Easy to spot:

trinity  25052 25051  6 09:57 pts/0    00:00:09 /home/trinity/server/bin/worldserver
trinity  25127     1  0 10:00 pts/1    00:00:00 /home/trinity/server/bin/authserver


Client Configuration


The realm is running - great! Time to test a client connection. You'll need Wine to run the client:

$ sudo apt-get install wine1.2
Make sure your realmlist references are to localhost. Here's my Data/enUS/realmlist.wtf for the client:
set realmlist 127.0.0.1
set patchlist 127.0.0.1
set realmlistbn ""
set portal us
And the WTF/Config.wtf:
SET realmList "127.0.0.1"
SET patchlist "127.0.0.1"
SET locale "enUS"
SET portal "us"
SET hwDetect "0"
SET gxRefresh "60"
SET gxMultisampleQuality "0.000000"
SET gxFixLag "0"
SET videoOptionsVersion "3"
SET movie "0"
SET Gamma "1.000000"
SET showToolsUI "1"
SET Sound_OutputDriverName "System Default"
SET Sound_MusicVolume "0.40000000596046"
SET Sound_AmbienceVolume "0.60000002384186"
SET farclip "777.000000"
SET specular "1"
SET groundEffectDensity "24"
SET projectedTextures "1"
SET gxWindow "1"
SET gxResolution "800x600"
Once the client is launched, you need to make an account to log in with: let's do a GM account first. We will use the interactive shell provided by TrinityCore. Go to the worldserver's shell, and hit 'enter', then give the following commands to create a GM account and give permissions for 2 expansion packs:
TC> account create admin PASSWORD
TC>Account created: ADMIN
TC> account set gmlevel admin 3 -1
TC>You change security level of account ADMIN to 3.
TC> account set addon admin 2
TC>Account ADMIN (Id: 1) have up to 2 expansion allowed now.
You may also wish to create a regular user for testing:
TC>account create user PASSWORD
TC>Account created: user
TC> account set addon user 2
TC>Account USER (Id: 2) have up to 2 expansion allowed now.
If you want to delete an account:
TC>account delete user07
TC>Account deleted: USER07

By default, new GM account characters are created as level 80. Regular user account characters come in as level 1. This and many other parameters can be adjusted in worldserver.conf to your liking.

Enjoy your new TrinityCore server! Comments/corrections are welcome as regards the build process on your system, especially on Ubuntu 10.04 or 9.10, and please keep in mind that future Trinity releases will almost certainly slightly change the database installation process.

3 comments:

  1. please 1 tutorial with Crash Logs... Thanks.

    ReplyDelete
  2. asdY: I omitted a step from the database imports, now corrected in the article. Do this if your log error was 'query ERROR: Table 'world.spell_script_names' doesn't exist':

    $ cd ~/trinitycore/sql/updates
    $ for i in `ls *_world_*.sql`; do mysql -u trinity --password="trinity" world < $i; done

    As for troubleshooting the logs - a simple "grep spell_script_names *" in the updates folder quickly got me through the above error to see that I had omitted the latest updates. Let me know if you're getting some different kind of error.

    ReplyDelete
  3. mane ...1 tutorial with crash logs (GDB) for linux. This tutorial is very hard for me http://www.trinitycore.info/index.php?title=Howto_gdb

    ReplyDelete

Comments welcome!

Recent Posts