魔獸世界服務(wù)端AzerothCore核心Centos系統(tǒng)編譯教程

魔獸世界服務(wù)端AzerothCore核心Centos系統(tǒng)編譯教程
?

大家好,我是艾西今天跟大家分享下用linux系統(tǒng)怎么編譯一個自己的魔獸世界服務(wù)端
準(zhǔn)備工作:服務(wù)器一臺、?安裝軟件、下載源碼、?地圖文件、?修改配置文件
修改文件執(zhí)行權(quán)限、?修改配置文件、編譯及啟動、編譯項目
數(shù)據(jù)庫表修改、游戲測試
(創(chuàng)建GM賬戶、?客戶端登錄游戲、GM指令?這幾項比較簡單不做介紹)
linux系統(tǒng)服務(wù)器1臺8H16G Centos7 系統(tǒng)服務(wù)器能夠訪問外網(wǎng)
?

安裝軟件:輸入代碼指令sudo apt-get update && sudo apt-get install git cmake make gcc g++ clang libmysqlclient-dev libssl -dev libbz2- dev libreadline dev libncurses dev mysql-server libboost- all-dev
?

輸入Y等待安裝完成就行了
?
輸入clang --version 回車
輸入cmake - -version回車
輸入sudo apt-get install g++-8 gcc-8 回車
?
到這一步我們用于編譯魔獸服務(wù)端的框架就算安裝完成了
(MySQL≥5.7.0、Boost≥1.74、OpenSSL≥1.0.x、CMake≥3.16、Clang≥1.0)
?
核心安裝:輸入指令git clone xxxxs://github . com/ azerothcore/ azerothcore -wotlk. git --branch master --single-branch azerothcore ?(時間較長等待安裝完成就好)
如果長時間沒有下載安裝完成的響應(yīng),那么到網(wǎng)站上去下載也是可以的
?

?
下載完成的文件上傳到服務(wù)器上再手動解壓出來輸入指令
unzip azerothcore-wotlk-master .zip
?

?
?
?
?
解壓完成后就會有一個azerothcore-wotlk-master文件記得把文件名后綴-wotlk-master刪掉
?

?
?
服務(wù)端編譯:
輸入指令
cd azerothcore (進(jìn)入azerothcore文件夾)
mkdir build(創(chuàng)建一個build文件夾)
cd build (進(jìn)入到build文件)
?
輸入指令:
cmake ../
-DCMAKE_INSTALL_PREFIX=$HOME/azeroth-server/ -DCMAKE_C_COMPILER=/usr/bin/clang
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
-DWITH_WARNINGS=1 -DTOOLS_BUILD=all
-DSCRIPTS=static -DMODULES=static(對整個需要編譯的文件夾進(jìn)行整理)
?
nproc --all??(可以看到我們需要編譯的核心數(shù)量)
?
輸入指令make -j 6?(開始編譯時間較久耐心等待)
?

?
輸入指令:make install?在我們文件目錄就能看到azeroth-server文件
?
?
服務(wù)器安裝:直接準(zhǔn)備一個客戶端上傳到服務(wù)器里
?

?
將azeroth-server目錄bin文件內(nèi)的map_extractor、mmaps_ generator、vmap4assembler、vmap4extractor 復(fù)制到游戲客戶端文件內(nèi)
輸入指令:
cp/home/ubuntu/azeroth-server/bin/map_ extractor /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)
?
cp/home/ubuntu/azeroth-server/bin/mmaps_ generator /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)
?
cp/home/ubuntu/azeroth-server/bin/vmap4_assembler /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)
?
cp/home/ubuntu/azeroth-server/bin/vmap4_extractor/home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)
?

?
?
完成后輸入指令./map_extractor
輸入指令./vmap4_extractor
輸入指令./vmap4_assembler Buildings vmaps
輸入指令.mkdir mmaps
輸入指令./mmaps_generator
以上所有的加載完后會得到4個文件夾
dbc,、maps、?vmaps?、mmaps
將這四個文件夾全部移動到zaeroth-server文件
?
?
?
配置數(shù)據(jù)庫:/home/ubuntu/azeroth -server/etc/ 文件夾內(nèi)的
authserver.conf.dist(管理用戶數(shù)據(jù))
worldserver .conf.dist(游戲相關(guān)配置文件夾)
?
雙擊authserver.conf.dist文件用Visual Studio程序打開
?

?
怎么找到我們mysql的用戶名和密碼呢?
在服務(wù)器里輸入指令sudo vim /etc/mysql/ debian. cnf
?

?
?
將我們得到的用戶名和密碼填入下圖Visual Studio程序打開的acore位置
?

?
?
修改完后保存,然后打開worldserver .conf.dist文件一樣的將acore改為用戶名和密碼
?

?
創(chuàng)建數(shù)據(jù)庫:輸入sudo mysql(進(jìn)入mysql管理界面)
?
輸入命令:source /home/ubuntu/ azerothcore/ data/sql/create/create_ mysql.sql
?
完成輸入quit
?
那么到了這里后我們嘗試啟動一下auth-server和world-server程序 這兩個程序需要一直開啟運行的,我們可以輸入命令單獨創(chuàng)建窗口啟動
?
screen - s auth
screen - s world
在這兩個窗口單獨輸入命令運行:
cd /home /ubuntu/azeroth- server/bin/
~/azeroth-server/bin$ . /authserver
?
cd /home /ubuntu/azeroth- server/bin/
~/azeroth-server/bin$ . /worldserver
?


?
?
?
?
運行worldserver程序時出現(xiàn) Map file ' . /maps /0004331.map': does not exist! 報錯
?
?
打開worldserver .conf.dist用vs程序打開 搜索data將下圖箭頭所指位置填入我們的地圖路徑/home/ubuntu/azeroth-server/data/
?
(就是我們生成的dbc,、maps、?vmaps?、mmaps文件,你們自己在操作的時候這幾個文件如果沒有放到data文件目錄下,那就根據(jù)自己說填寫的路徑去改一下,我這邊演示所在的地圖路徑在/home/ubuntu/azeroth-server/data/)
?

?
?
?
?
再次運行~/azeroth-server/bin$ . /worldserver 就成功跑起來了
?

?
最后就是進(jìn)行服務(wù)器IP配置
?
輸入指令$ sudo mysql
輸入指令use acore_ auth;
?
輸入指令UPDATE realmlist SET address = '[your_ip]' WHERE id = 1;
'[your_ip]'改為你的服務(wù)器IP
我這邊的是 103.219.xxx.xxx ?那么我輸入的指令就是
UPDATE realmlist SET address = '[103.219.xxx.xxx]' WHERE id = 1;
在/home/ubuntu/World of Warcraft 3.3.5(12340)目錄下的realmlist.wtf文件雙擊進(jìn)去用vs打開將表格內(nèi)的127.0.0.0 改為你的服務(wù)器IP即可
?
最后輸入exie 到這里我們所有的就算完成了
?
點擊wow.exe文件開始和小伙伴一起進(jìn)入游戲體驗測試吧
補注:
無法啟動
?網(wǎng)絡(luò)問題:
如果出現(xiàn)網(wǎng)絡(luò)問題,無法啟動,可參考以下內(nèi)容修改
?
[root@localhost azerothcore-wotlk]# cat docker-compose.yml
version: '3.2'
?
services:
?
??ac-database:
????image: azerothcore/database
????restart: unless-stopped
????build:
??????context: .
??????dockerfile: ./docker/database/Dockerfile
????networks:
??????proxy:
????????ipv4_address: xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)
????ports:
??????- ${DB_EXTERNAL_PORT:-3306}:3306
????environment:
??????- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-password}
????volumes:
??????- type: volume
????????source: ac-database
????????target: /var/lib/mysql
?
??ac-worldserver:
????stdin_open: true
????tty: true
????image: azerothcore/worldserver
????restart: unless-stopped
????privileged: true
????build:
??????context: ./docker/worldserver
??????dockerfile: Dockerfile
????networks:
??????proxy:
????????ipv4_address: xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)
????ports:
??????- ${WORLD_EXTERNAL_PORT:-8085}:8085
??????- ${SOAP_EXTERNAL_PORT:-7878}:7878
????volumes:
??????- type: bind
????????source: ./docker/worldserver/bin
????????target: /azeroth-server/bin
??????- type: bind
????????source: ${WORLDSERVER_ETC:-./docker/worldserver/etc}
????????target: /azeroth-server/etc
??????- type: bind
????????source: ${WORLDSERVER_LOGS:-./docker/worldserver/logs}
????????target: /azeroth-server/logs
??????- type: bind
????????source: ${WORLDSERVER_DATA:-./docker/worldserver/data}
????????target: /azeroth-server/data
????depends_on:
??????- ac-database
?
??ac-authserver:
????image: azerothcore/authserver
????restart: unless-stopped
????build:
??????context: ./docker/authserver
??????dockerfile: Dockerfile
????networks:
??????proxy:
????????ipv4_address: xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)
????ports:
??????- ${AUTH_EXTERNAL_PORT:-3724}:3724
????volumes:
??????- type: bind
????????source: ./docker/authserver/bin
????????target: /azeroth-server/bin
??????- type: bind
????????source: ${AUTHSERVER_ETC:-./docker/authserver/etc}
????????target: /azeroth-server/etc
??????- type: bind
????????source: ${AUTHSERVER_LOGS:-./docker/authserver/logs}
????????target: /azeroth-server/logs
????depends_on:
??????- ac-database
?
volumes:
??ac-database:
?
networks:
??proxy:
????ipam:
??????config:
??????- subnet: xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)/24
2.時區(qū)問題
如果因為時區(qū)問題,無法啟動,參考如下修改
?
[root@localhost azerothcore-wotlk]# cat docker/authserver/Dockerfile
FROM ubuntu:20.04
?
# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones
?
# set timezone environment variable
ENV TZ=Asia/Shanghai
?
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
?
# install the required dependencies to run the authserver
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev net-tools tzdata;
?
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
?
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD netstat -lnpt | grep :3724 || exit 1
?
# run the authserver located in the directory "docker/authserver/bin" of the host machine
CMD ["/azeroth-server/bin/authserver"]
[root@localhost azerothcore-wotlk]# cat docker/database/Dockerfile
FROM alpine:3.9 as builder
?
# install bash
RUN apk add --no-cache bash
?
# copy the sources from the host machine
COPY apps /azerothcore/apps
COPY bin /azerothcore/bin
COPY conf /azerothcore/conf
COPY data /azerothcore/data
COPY deps /azerothcore/deps
COPY acore.json /azerothcore/acore.json
?
# run the AzerothCore database assembler
RUN ./azerothcore/bin/acore-db-asm 1
?
FROM mysql:5.7
?
# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones
?
# set timezone environment variable
ENV TZ=Asia/Shanghai
?
ENV LANG C.UTF-8
?
# copy files from the previous build stage - see: xxxxs://docs.docker.com/develop/develop-images/multistage-build/
COPY --from=builder /azerothcore/env/dist/sql /sql
?
# adding the "generate-databases.sh" to the directory "/docker-entrypoint-initdb.d"
# because all scripts included in that directory will automatically be executed when the docker container starts
COPY docker/database/generate-databases.sh /docker-entrypoint-initdb.d
?
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD ping -h localhost
[root@localhost azerothcore-wotlk]# cat docker/worldserver/Dockerfile
FROM ubuntu:20.04
?
# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones
?
# set timezone environment variable
ENV TZ=Aisa/Shanghai
?
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
?
# install the required dependencies to run the authserver
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev libreadline-dev net-tools tzdata;
?
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
?
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD netstat -lnpt | grep :8085 || exit 1
?
# run the worldserver located in the directory "docker/worldserver/bin" of the host machine
CMD ["/azeroth-server/bin/worldserver"]
數(shù)據(jù)庫表修改
進(jìn)入容器,連接數(shù)據(jù)庫
[root@localhost azerothcore-wotlk]# docker exec -it azerothcore-wotlk_ac-database_1 bash
bash-4.2# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 1416
Server version: 5.7.41 MySQL Community Server (GPL)
?
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
?
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
?
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
?
mysql>
打開 acore_auth數(shù)據(jù)庫, realmlist 數(shù)據(jù)表
mysql> use acore_auth;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
?
Database changed
mysql> show tables;
+----------------------+
| Tables_in_acore_auth |
+----------------------+
| account ?????????????|
| account_access ??????|
| account_banned ??????|
| account_muted ???????|
| autobroadcast ???????|
| ip2nation ???????????|
| ip2nationCountries ??|
| ip_banned ???????????|
| logs ????????????????|
| logs_ip_actions ?????|
| realmcharacters ?????|
| realmlist ???????????|
| uptime ??????????????|
| version_db_auth ?????|
+----------------------+
14 rows in set (0.00 sec)
?
mysql> select * from realmlist;
+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
| id | name ???????| address ??????| localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |
+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
| ?1 | AzerothCore | xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)?| 127.0.0.1 ???| 255.255.255.0 ??| 1001 | ???0 | ???0 | ???????1 | ???????????????????0 | ?????????0 | ????12340 |
+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+
1 row in set (0.00 sec)
?
address 修改為服務(wù)器ip或者域名,port 修改為 1001
update realmlist set address='xxx.xxx.xxx.xxx(即你服務(wù)器IP地址)',port='1001';
?
重啟服務(wù)器
游戲測試
創(chuàng)建GM賬戶
進(jìn)入服務(wù)器容器,并創(chuàng)建gm賬號
?
docker attach azerothcore-wotlk_ac-worldserver_1
?
account create admin 123456
account set gmlevel admin 3 -1
創(chuàng)建完成,quit退出
?
客戶端登錄游戲
在客戶端中,創(chuàng)建 login.bat 文件,并寫入如下內(nèi)容:
?
@echo y | rd /s "Cache"
echo SET realmlist "xxx.xxx.xxx.xxx(即你服務(wù)器IP地址):1002"> realmlist.wtf
echo SET realmList "xxx.xxx.xxx.xxx(即你服務(wù)器IP地址):1002"> Data/zhCN/realmlist.wtf
echo SET realmList "xxx.xxx.xxx.xxx(即你服務(wù)器IP地址):1002"> Data/zhTW/realmlist.wtf
?
ren Data\commoo.MPQ common.MPQ
ren Data\expansioo.MPQ expansion.MPQ
start wow.exe
goto end
:end
?
我是艾西,今天魔獸世界服務(wù)端AzerothCore核心Centos系統(tǒng)編譯教程就到這里啦,希望對有需要的小伙伴有幫助
擁有一臺服務(wù)器可以做很多很酷的事情?respect?!
?
?