环境为 Ubuntu 22.04。

安装依赖:

1
2
3
4
5
6
7
8
9
10
11
sudo apt install -y \
git \
build-essential \
pkg-config \
wget tar \
liblua5.4-dev \
libsqlite3-dev \
libevent-dev \
mono-xbuild \
unzip \
p7zip

新建一个文件夹作为主目录,拉取 git 仓库:

1
2
3
4
5
mkdir ygo-server
cd ygo-server
git clone [email protected]:ParseeX/srvpro.git # 建议 clone 自己 fork 的版本
git clone [email protected]:mycard/ygopro.git --branch=server --recursive
git clone [email protected]:mycard/windbot.git # 不需要 bot 可跳过

配置 ygopro-server:

1
2
3
4
5
6
7
8
9
10
11
12
13
cd ygopro
wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-linux.tar.gz | tar zfx -
chmod +x ./premake5
wget -O - https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar zxf -
mv lua-5.4.8 lua
cp -r premake/* .
cp -r resource/* .
./premake5 gmake
cd build
make -j$(nproc) config=release
cd ..
ln -sf bin/release/ygopro ./ygopro
strip ygopro

配置 windbot(不需要可跳过):

1
2
3
4
5
cd windbot
xbuild /property:Configuration=Release /property:TargetFrameworkVersion="v4.5"
ln -s bin/Release/WindBot.exe .
ln -s ../ygopro/cards.cdb .
cd ..

安装 Node.js:

1
2
3
4
5
sudo apt remove -y nodejs npm
sudo apt autoremove -y
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g pm2

配置 srvpro:

1
2
3
4
5
6
7
8
9
10
11
cd srvpro
npm ci
ln -s ../ygopro .
ln -s ../windbot .
mkdir config
cp data/default_config.json config/config.json
pm2 start "npm start" --name ygopro-server
pm2 save
pm2 startup # 按照提示操作,如下
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u xyk --hp /home/xyk
cd ..

下载超先行卡:

1
2
3
4
5
6
cd ygopro
mkdir -p expansions
cd expansions
wget 'https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk'
unzip ygopro-super-pre.ypk
rm ygopro-super-pre.ypk