[原创]linux下编译安装魔兽世界服务端mangos

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
lostapple
帖子: 2
注册时间: 2007-08-21 22:54

[原创]linux下编译安装魔兽世界服务端mangos

#1

帖子 lostapple » 2007-09-07 14:55

linux新手练习记录,不知道有没有人感兴趣的,呵呵。也请熟手评点。

参考网址:
index.php 中文ubuntu论坛
http://www.mysql.com mysql官方
http://www.mangosproject.org/forum mangos官方论坛
http://sdb.unix7.net/forums/index.php 数据库sdb及脚本ScriptDev2官方论坛
http://www.xren.org/bbs/thread.php?fid-52.html 中文数据库


一、安装服务器
1、从官方下载ubuntu-7.04-dvd-i386.iso并刻盘安装。

我自己的分区方案
/ 5G
/mydown 5G 下载的源代码、备份保存等
/usr 6G
/tmp 2G
/var 4G
/swap 1G
/opt 30G 安装的系统mysql、mangos等

刚装完SERVER:
文件系统 1M-块 已用 可用 已用% 挂载点
/dev/sda2 4695M 233M 4224M 6% /
varrun 506M 1M 506M 1% /var/run
varlock 506M 0M 506M 0% /var/lock
procbususb 506M 1M 506M 1% /proc/bus/usb
udev 506M 1M 506M 1% /dev
devshm 506M 0M 506M 0% /dev/shm
/dev/sda5 4695M 138M 4319M 4% /mydown
/dev/sda10 27626M 173M 26051M 1% /opt
/dev/sda7 1877M 35M 1746M 2% /tmp
/dev/sda6 5629M 322M 5021M 7% /usr
/dev/sda8 3753M 195M 3367M 6% /var

全部装好调试正常(mysql、mangos):
文件系统 1M-块 已用 可用 已用% 挂载点
/dev/sda2 4695M 233M 4224M 6% /
varrun 506M 1M 506M 1% /var/run
varlock 506M 0M 506M 0% /var/lock
procbususb 506M 1M 506M 1% /proc/bus/usb
udev 506M 1M 506M 1% /dev
devshm 506M 0M 506M 0% /dev/shm
/dev/sda5 4695M 1012M 3444M 23% /mydown
/dev/sda10 27626M 3858M 22365M 15% /opt
/dev/sda7 1877M 35M 1746M 2% /tmp
/dev/sda6 5629M 441M 4903M 9% /usr
/dev/sda8 3753M 249M 3314M 7% /var

2、修改源:
sudo vi /etc/apt/sources.list,全部清除用下面的内容替换(适合电信用户,飞快)

deb http://ubuntu.cn99.com/ubuntu/ feisty main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ feisty-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ feisty-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ feisty-proposed main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ feisty-backports main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ feisty main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ feisty-security main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ feisty-updates main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ feisty-proposed main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ feisty-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ feisty main restricted universe multiverse

sudo apt-get update
sudo apt-get upgrade

3、安装ssh(终端服务,供远程登录操作):
sudo apt-get install ssh
sudo vi /etc/ssh/sshd_config
修改配置,主要改了下端口
sudo /etc/init.d/ssh start/stop/restart

4、安装smb(读取网络上其它windows系统的共享目录,交换文件用)
sudo apt-get install smbfs
sudo mkdir /media/wfiles
sudo mount -t smbfs -o unicode,codepage=unicode,iocharset=utf8,username=共享用户名,password=密码 //地址/共享目录名 /media/wfiles

二、编译准备工作
安装库:
sudo apt-get install subversion gcc make autoconf libtool automake zlibc g++ libncurses5-dev openssl libmysql++-dev libssl-dev
说明:subversion是源码下载工具;openssl、libssl-dev是支持openssl的库;其他是编译环境。

三、编译安装mysql
(注:可以直接用sudo apt-gei install mysql-server mysql-clint安装,这步可以略,但路径及参数设置不同,要自己调整)

sudo groupadd mysql
sudo useradd -g mysql mysql
cd /mydown
sudo tar zxvf /media/wfiles/mysql-5.0.45.tar.gz (这个是从mysql官方下载的linux源码包)
cd mysql-5.0.45
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/opt/mysql --enable-assembler --with-charset=utf8 --with-collation=utf8_general_ci --with-unix-socket-path=/opt/mysql/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static (这里的编译参数可调整,具体要看mysql手册)
make
sudo make install
sudo cp support-files/my-medium.cnf /etc/my.cnf
修改my.cnf,主要修改路径,并且把地址改位为localhost,这样是使用unix socket连接,可以提高性能。

cd /opt/mysql
sudo mkdir tmp
chown -R root .
sudo chown -R mysql var tmp
sudo chgrp -R mysql .

sudo cp /mydown/mysql-5.0.45/support-files/mysql.server /etc/init.d/mysql
sudo chmod +x /etc/init.d/mysql
sudo bin/mysqld_safe --user=mysql &
sudo update-rc.d mysql defaults
bin/mysqladmin -u root password 'xxxxxx'

允许远程登录:在本机mysql下:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxxx' WITH GRANT OPTION;
grant select,update,insert,delete on *.* to root@% identified by "密码";

这里有个奇怪的事情,就是按我前面写的步骤编译安装完后,本机居然是没有mysql的客户端的,因为不想去细究了,所以后来直接用sudo apt-get install mysql-client装上了,反正服务器已经是我编译的了,客户端无所谓。不过这样装的话,需要把我自己的/etc/my.cnf 拷贝到/etc/mysql去覆盖。
装完记得用mysql进去show variables看看所有的字符集是否都设成utf8了,如果是lant1之类的在导库的时候会产生乱码。


四、编译安装mangos和sdev2

sudo mkdir /mydown/mangos
下载/更新mangos源码
sudo svn checkout https://mangos.svn.sourceforge.net/svnroot/mangos/trunk /mydown/mangos

sudo mkdir /mydown/mangos/src/bindings/ScriptDev2
下载/更新sdev2源码
sudo svn checkout https://scriptdev2.svn.sourceforge.net/ ... scriptdev2 mydown/mangos/src/bindings/ScriptDev2

修改源码(这个跟windows下的是一样的)

1、支持cwow
src/shared/Common.h

#define EXPECTED_MANGOS_CLIENT_BUILD {6898, 0}
改为
#define EXPECTED_MANGOS_CLIENT_BUILD {6898,6904, 0}

2、单人进raid副本
src/game/map.h

bool IsRaid() { return(i_mapEntry && (i_mapEntry->map_type == MAP_RAID)); }
改成
bool IsRaid() { return false; }

3、初始人物等级、金钱
src/game/player.cpp

SetUInt32Value( UNIT_FIELD_LEVEL, 1 ); //set level = 1 for created characters
改为
SetUInt32Value( UNIT_FIELD_LEVEL, 60 ); //set level = 60 for created characters
SetMoney(88880000); //set money=8888G for created characters

4、虚弱时间10分钟改为1分钟
src/game/player.cpp

Aur->SetAuraDuration(delta*1000);
改为
Aur->SetAuraDuration(delta*100);

5、守卫问路汉化
替换 mangos/src/bindings/ScriptDev2/scripts下的sc_defines.h和guard目录下的15个守卫文件。
这里很郁闷的一个问题,网上的汉化文件都是windows下的文件,到linux下需要转换,否则编译会出错,不过我用dos2unix等工具转了都不成功,后来是一个个把汉化的文字拷贝进源e文文件里才通过的。

6、根据scriptdev2/patches下面文件内容修改有关make文件以便编译mangos把sdev一起编译进去。(这里应该可以用工具自动打 patch的,不过我看他版本号不对,修改才3个地方,就手工改了。以下内容,-行表示删除,+行表示添加,实质就是把 src/bindings/universal改成src/bindings/ScriptDev2)
1)configure.ac
- src/bindings/universal/Makefile
+ src/bindings/ScriptDev2/Makefile
+ src/bindings/ScriptDev2/sql/Makefile
+ src/bindings/ScriptDev2/sql/Updates/Makefile

2) src/bindings/Makefile.am
-SUBDIRS = universal
+SUBDIRS = ScriptDev2

3) src/mangosd/Makefile.am
-mangos_worldd_LDADD = ../bindings/universal/libmangosscript.la ../game/libmangosgame.a ../shared/libm
angosdatabase.a ../shared/libmangosconfig.a ../shared/libmangosauth.a ../shared/libmangosshared.a ../s
hared/libmangosvmaps.a ../shared/libmangosnetwork.a ../framework/libmangosframework.a ../../dep/src/zt
hread/libZThread.la ../../dep/src/g3dlite/libg3dlite.a
-mangos_worldd_LDFLAGS = -L../../dep/src/zthread -L../../dep/src/g3dlite -L../bindings/universal/ $(M
YSQL_LIBS) $(POSTGRE_LIBS) -L$(libdir) $(ZLIB) $(COMPATLIB) $(SSLLIB) -export-dynamic
+mangos_worldd_LDADD = ../bindings/ScriptDev2/libmangosscript.la ../game/libmangosgame.a ../shared/lib
mangosdatabase.a ../shared/libmangosconfig.a ../shared/libmangosauth.a ../shared/libmangosshared.a ../
shared/libmangosvmaps.a ../shared/libmangosnetwork.a ../framework/libmangosframework.a ../../dep/src/z
thread/libZThread.la ../../dep/src/g3dlite/libg3dlite.a
+mangos_worldd_LDFLAGS = -L../../dep/src/zthread -L../../dep/src/g3dlite -L../bindings/ScriptDev2/ $(
MYSQL_LIBS) $(POSTGRE_LIBS) -L$(libdir) $(ZLIB) $(COMPATLIB) $(SSLLIB) -export-dynamic


编译:
cd /mydown/mangos
sudo mkdir bin
sudo autoreconf --install --force
sudo mkdir /opt/mangos
sudo ./configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --with-python --enable-cli --enable-ra --datadir=/opt/mangos
sudo make
sudo make install

导入数据
mysqladmin -uroot -p create mangos
mysqladmin -uroot -p create realmd
mysql -uroot -p realmd</mydown/mangos/sql/realmd.sql
mysql -uroot -p mangos</media/wfiles/data4415.sql

修改配置,改/opt/mangos/etc下两个conf文件。

执行
cd /opt/mangos/bin
sudo nohup ./mangos-realmd &
sudo nohup ./mangos-worldd &
输出内容在nohup.out这个文件中。
上次由 lostapple 在 2007-09-10 16:09,总共编辑 1 次。
lostapple
帖子: 2
注册时间: 2007-08-21 22:54

#2

帖子 lostapple » 2007-09-07 15:13

另外请教下,为什么用top查看时,清单里mangos占用CPU为100%,但是在顶上汇总的地方CPU是23.2%?

top - 15:12:21 up 3:20, 1 user, load average: 1.00, 1.00, 0.96
Tasks: 64 total, 3 running, 61 sleeping, 0 stopped, 0 zombie
Cpu(s): 23.2%us, 26.8%sy, 0.0%ni, 50.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1035508k total, 637332k used, 398176k free, 7984k buffers
Swap: 979924k total, 0k used, 979924k free, 376164k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6472 root 15 0 211m 164m 5212 R 100 16.3 189:45.60 mangos-worldd
1 root 18 0 2912 1844 524 S 0 0.2 0:01.47 init
2 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0
alexwym
帖子: 12
注册时间: 2006-12-01 12:39

#3

帖子 alexwym » 2008-07-28 18:55

朋友,你的mangos运行在ubuntu下现在一切正常吗?
头像
sevk
帖子: 2060
注册时间: 2007-05-08 16:26
系统: arch
来自: 火星内核某分子内某原子核内
联系:

#4

帖子 sevk » 2008-08-28 22:34

四、编译安装mangos和sdev2 ,这个爽!
笔记本 :
F208S : gentoo
A460P i3G D6 : UBUNTU + WIN7
UN43D1 : UBUNTU + WIN7
1000人超级QQ群 LINUX + WIN : 31465544 或 18210387
死亡阴影
帖子: 130
注册时间: 2007-11-28 8:52
联系:

#5

帖子 死亡阴影 » 2008-09-12 9:43

LZ你的方法能看到NPC和怪吗
syshack
帖子: 15
注册时间: 2008-01-24 13:24

#6

帖子 syshack » 2008-09-13 23:24

强大 回家试验下
mech
帖子: 466
注册时间: 2007-09-06 16:07

#7

帖子 mech » 2008-09-14 10:04

这个这个模拟器?
头像
yysq009
帖子: 2682
注册时间: 2007-01-28 23:00
来自: @江西|南昌@
联系:

#8

帖子 yysq009 » 2008-09-14 10:23

那位 做个 服务器来。 爽下先! 单挑 蛋蛋

Do as you would be done by !
zzldccpro
帖子: 4
注册时间: 2009-01-01 21:07

Re: [原创]linux下编译安装魔兽世界服务端mangos

#9

帖子 zzldccpro » 2009-01-01 21:13

目前芒果已经出到了应对3.05版本的服务端,程序版本好像是2.81。而且声明用了.NET3.5
我很想把它移植到我的ubuntu8.04服务器上。不知道有没有什么办法。还望赐教!!
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08

Re: [原创]linux下编译安装魔兽世界服务端mangos

#10

帖子 yoyu007 » 2009-01-02 12:35

过时的文章


http://getmangos.com/community/showthread.php?t=5131

MaNGoS now supports the latest client version 3.0.3 build 9183. Enjoy it!

Please update yours dbc, maps and vmaps.

To convert your current characters and their items use following sql updates:
Code:

2008_12_22_18_characters_characters.sql
2008_12_22_19_characters_item_instance.sql

MERRY CHRISTMAS!

PS: 2.4.3 may continue to be be supported for some time. The "mangos-0.12" branch has been created for it where some fixes may be backported from master if we have time. To create and switch to a local branch named 243 that points to the mangos-0.12 remote branch, you may use the following command: git checkout -b 243 origin/mangos-0.12
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08

Re: [原创]linux下编译安装魔兽世界服务端mangos

#11

帖子 yoyu007 » 2009-01-02 12:41

用这个服务器更好,用的mangos内核,直接包含SD2,不需要patch

Trinity is a fork of MaNGOS first and foremost. It came about due to some development style conflicts with the MaNGOS devs. The Trinity team feels that revision control should be handled in a different way, a stable branch and an unstable (or development branch), plus potentially many others. Another reason for the fork is that we felt that scripting belonged in the core. Yes, folks, that means no more having to build SD2 + MaNGOS :). Lastly, we wanted to have much better DB interaction.

OK, that is a lot of talk, but doesn't say what most people want to know -- WHAT *IS* Trinity. Trinity is the latest MaNGOS rev + SD2 rev with a lot of patches added in. Patches that should have been included in the core a LONG time ago. Trinity has also been cleaned up -- A LOT, and will continue to be cleaned up and optimized.

OK, so when can I get it? You know the standard issue UDB answer is "soon". The slightly longer answer is that there is still a lot of work to do before we want to release a public core. This isn't just MaNGOS patched with some patches. They are actually integrated in properly, so that they can be maintained.

Stay tuned!

-- Brian

Very short answer :
- It is a combined MMOG-server core and database project, including an integrated AI

Normal answer :
- a rewrite of MaNGOS including long-not-included patches that has been checked and verified for stability by most of the active developers
- includes further integration with the AI-system (formerly separated as ScriptDev2), plus additional information given out from the UDB database project, making it a complete and working core-system (ACID-scripting)

It is released in this way (explanation included) :
* STABLE (release)
- includes functionality tested, verified and known working fully, without insane glitches and/or issues
- might be slightly outdated, but it will work, and it will be be stable
- backports from unstable will be done when required/needed

(releases are done on a irregular basis - ie. when the codebase is stable enough for it to be considered release material)

* UNSTABLE (development)
- everything that is currently in progress of being fixed, worked on, or has major flaws/glitches/issues
- integration of new patches, testing for issues, fixes, hacks, hammerings, source flattened and pancaked out
- a HIGHLY unstable sourcetree, not to be used unless you are testing patches for inclusion or verification-purposes

(code from the unstable repositories are not to be considered user-material unless developing a fix/patch or testing something that is already in unstable)

http://www.trinitycore.info/w/Main_Page
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08

Re: [原创]linux下编译安装魔兽世界服务端mangos

#12

帖子 yoyu007 » 2009-01-02 12:42

http://www.trinitycore.info/w/Linux_Build_HOWTO

Tools you will need

g++
gcc
make
automake
autoconf
libmysql++-dev
subversion (for checking out Trinity Database)
mercurial (for checking out the core)
openssl
libssl-dev
zlib1g-dev
libtool
libmysqlclient15-dev
patch
build-essential
mysql-client
unix/linux rar tools
common sense

Getting Started

First step is to setup a user account to run trinity under (NEVER RUN IT AS ROOT!)

adduser trinity

You might be tempted to add a password to the trinity account so that you can log into it. This isn't really necessary thanks to the su and sudo tools. first we're going to check out the code into the trinity home directory. The first step is to become the trinity user.


su - trinity

Mercurial Configuration and Checkout

next we're going to configure hg to allow use of the patch queue system. we'll need to create the /home/trinity/.hgrc config file and add the following lines to it:

[extensions]
hgext.mq=

Now we're going to clone the patch queue provided by raczman. This will later allow us to apply patches to our server such as the famous auction house bot, and TeleNPC. To clone the repository (repo) run the following:

hg qclone http://www.bitbucket.org/raczman/trinitycore-patches

Configuration of Trinity Core

once this completes we're going to run the autoreconf tool to generate our configuration tools

cd trinitycore-patches
autoreconf --install --force

First lets create a directory to make the binaries in:

mkdir /home/trinity/539

next we're going to run our configure script, a lot of this is borrowed from the FAQ. These are the options we can use with the configure script, it's pretty easy to understand

--enable-cli - Enable the command line interpreter.
--enable-ra - Enable the remote console.
--enable-doxygen - Enable documentation generation. Requires doxygen utility.
--with-mysql - Enable MySQL support.
--with-postgresql - Enable PostgreSQL support.
--prefix=/(location) - this tells the configure script where to install the trinity base to
--sysconfdir=/(location) - this tells trinity where to look for the configuration files
--datadir=/(location) - this tells trinity where the data files are going to be located

so here is what I use to build my server:

cd /home/trinity/539
/home/trinity/trinitycore-patches/configure --enable-cli --enable-ra --with-mysql --prefix=/home/trinity/bin --sysconfdir=/home /trinity/etc --datadir=/home/trinity/data
make
make install

congrats! We now have a trinity build installed!
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08

Re: [原创]linux下编译安装魔兽世界服务端mangos

#13

帖子 yoyu007 » 2009-01-02 12:44

1.2 Installing the database and updates

Our next step is to get the database up and running. first thing is first, lets check out the database. Trinity database still uses SVN, so you all should be familiar with this process, but for those who are not:

Code:

cd /home/trinity
mkdir tdb
svn checkout http://svn.assembla.com/svn/trinitydatabase/trunk/ ./tdb

lets head into the trinity source directory and get the base layout done for our database created, and our base sql files loaded.
Code:

cd /home/trinity/trinitycore-patches/sql
mysql -u root -p <create_mysql.sql
mysql -u trinity -p characters<characters.sql
mysql -u trinity -p realmd<realmd.sql

We now have our three databases, characters, realmd, and world. We have some base info in the realmd and characters database. Time to get the TDB rollup packs installed and fill up the world database.

Code:

cd /home/trinity/tdb/full_database/
unrar x TDB_0.0.1.rar
mysql -u trinity -p world<TDB_0.0.1.sql
cd /home/trinity/tdb/updates
mysql -u trinity -p characters<5_corepatch_characters_51_to_250.sql
mysql -u trinity -p realmd<5_corepatch_realmd_51_to_250.sql
mysql -u trinity -p world<5_corepatch_world_51_to_250.sql
mysql -u trinity -p world<5_updatepack_world.sql

Now we have the meat of the database installed. We just have to apply all the patches to the databases that are above revision 250. If you see in the updates installed above, it takes all databases from the revision 50 and applies all patches up to revision 250.

Lets take care of the characters database first, you'll use this command to apply the sql files listed below IN ORDER!!!!

first change directory to the sql updates location:
cd /home/trinity/trinitycore-patches/sql/updates

mysql -u trinity -p characters<(sql file)

1. 262_characters.sql
2. 360_characters.sql
3. 410_characters.sql

next realmd:

mysql -u trinity -p realmd<(sql file)

1. 262_realmd.sql

finally, world:

mysql -u trinity -p world<(sql file)

1. 262_world.sql
2. 262_world_runthisonlyonce.sql
3. 273_world_scripts.sql
4. 285_world.sql
5. 287_world_scripts.sql
6. 329_world_spell_proc_event.sql
7. 332_world_spell_script_target.sql
8. 333_world_spell_proc_event.sql
9. 334_world_trinity_string.sql
10. 341_world.sql
11. 356_world.sql
12. 373_world_scripts.sql
13. 377_world_scripts.sql
14. 381_world.sql
15. 389_world.sql
16. 400_world.sql
17. 426_world_scripts.sql
18. 427_world_scripts.sql
19. 444_world.sql
20. 452_world.sql
21. 455_world.sql
22. 471_world.sql
23. 480_world_scripts.sql
24. 488_world_script.sql
25. 488_trinity_script_text.sql
26. 502_trinity_scripts.sql
27. 505_world.sql
28. 506_world.sql
29. 513_world_scripts.sql
30. 519_world.sql
31. 537_world.sql

There we have it! Database is now fully patched and nearly ready to go!
yoyu007
帖子: 195
注册时间: 2007-09-02 10:08

Re: [原创]linux下编译安装魔兽世界服务端mangos

#14

帖子 yoyu007 » 2009-01-02 12:50

建议用比mangos更好的服务器ArcEmu

http://www.arcemu.org/

目前不支持3.03,我没编绎
死亡阴影
帖子: 130
注册时间: 2007-11-28 8:52
联系:

Re: [原创]linux下编译安装魔兽世界服务端mangos

#15

帖子 死亡阴影 » 2009-02-23 18:20

我全部都搞过 能见NPC和怪
不过 汉化不是很好
而且别的机子登录进去,就会卡在选服务器那(不断的要你选服务器)
iptables 和数据库都没禁止
感觉非常奇怪
回复