Docker 一键搭建 “帕鲁幻兽(PalWorld)” 游戏服务器
网上搜了下搭建教程,各种命令执行,显得十分麻烦,了解SteamCMD官方有镜像,并且csgo等著名游戏的服务器也是基于此镜像构建,因此自己制作了帕鲁服务器的docekr镜像,方便小伙伴们自己搭建服务器。
一、安装 Docker
安装前需要机器安装好 docker ,若未安装请参考Docker 快速入门。
二、准备数据目录
其中 /root/pal_data
这个目录可自行更换
1 2 3
| export PAL_PATH=/root/pal_data mkdir ${PAL_PATH} sudo chmod 777 ${PAL_PATH}
|
三、部署服务器
1. 启动
1 2
| export PAL_PATH=/root/pal_data docker run -d --name pal --restart=always -p 8211:8211/udp -v ${PAL_PATH}:/home/steam/Steam seepine/pal-server
|
2. 检验
执行 docker logs pal
,看到如下内容表示启动成功,否则耐心等待即可,因为初次运行需要下载服务端文件需要几分钟时间。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Update state (0x61) downloading, progress: 99.95 (2247004813 / 2248053389) Update state (0x81) verifying update, progress: 27.64 (621460677 / 2248053389) Success! App '2394010' fully installed. sh: 1: xdg-user-dir: not found Shutdown handler: initalize. - Existing per-process limit (soft=1048576, hard=1048576) is enough for us (need only 1048576) Increasing per-process limit of core file size to infinity. - Existing per-process limit (soft=18446744073709551615, hard=18446744073709551615) is enough for us (need only 18446744073709551615) [S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK. CAppInfoCacheReadFromDiskThread took 3 milliseconds to initialize Setting breakpad minidump AppID = 2394010 [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
|
3. 开放端口
若使用云服务器,则还需要安全组和防火墙都开放 8211 这个端口,类型UDP,到此已经可以连接上自建服务器了。
4. 更新
游戏服务端有时也会更新,停掉容器再启动即可,因为数据已持久化保存,因此不用担心游戏数据丢失。
四、修改配置
1. 拷贝配置文件
1 2
| export PAL_PATH=/root/pal_data sudo cp ${PAL_PATH}/steamapps/common/PalServer/DefaultPalWorldSettings.ini ${PAL_PATH}/steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
|
2. 修改内容
修改后重启生效即可,参数可查看 官方配置参数文档
1 2
| export PAL_PATH=/root/pal_data nano ${PAL_PATH}/steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
|