游戏党狂喜!9.9元香港服务器搭建幻兽帕鲁联机服全攻略
对于游戏爱好者来说,能够与朋友一起联机游玩《幻兽帕鲁》(Palworld)无疑是一大乐事。然而官方服务器可能不稳定,或者你想拥有一个私人的游戏空间。好消息是,通过租用便宜的香港服务器(低至9.9元/月),你可以轻松搭建自己的《幻兽帕鲁》联机服务器!本文将详细指导你完成整个搭建过程,包含必要的代码和技术细节。
准备工作
1. 服务器选择
我们推荐选择香港区域的云服务器,主要优势有:
低延迟:对于国内玩家连接速度快价格便宜:促销活动期间最低9.9元/月无需备案:直接可以开放端口使用推荐的服务器配置:
CPU:至少2核内存:4GB以上(8GB更佳)带宽:3Mbps以上系统:Ubuntu 20.04/22.04 LTS2. 购买并连接服务器
购买后,使用SSH工具连接服务器:
ssh root@your_server_ip
安装必要软件
1. 更新系统并安装基础工具
apt update && apt upgrade -yapt install -y wget curl unzip tar screen
2. 安装SteamCMD
《幻兽帕鲁》服务器需要通过SteamCMD安装:
# 创建steam用户useradd -m steamusermod -a -G sudo steampasswd steam# 切换到steam用户su - steam# 安装SteamCMDmkdir ~/Steam && cd ~/Steamcurl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
3. 安装《幻兽帕鲁》服务器
./steamcmd.sh +login anonymous +app_update 2394010 validate +quit
配置服务器
1. 创建启动脚本
在steam用户下创建启动脚本start_palworld.sh
:
#!/bin/bashSERVER_PATH="/home/steam/Steam/steamapps/common/PalServer"CONFIG_PATH="/home/steam/Pal/Saved/Config/LinuxServer"# 创建必要目录mkdir -p "$CONFIG_PATH"# 复制默认配置文件(如果不存在)if [ ! -f "$CONFIG_PATH/GameUserSettings.ini" ]; then cp "$SERVER_PATH/DefaultGameUserSettings.ini" "$CONFIG_PATH/GameUserSettings.ini"fiif [ ! -f "$CONFIG_PATH/Engine.ini" ]; then cp "$SERVER_PATH/DefaultEngine.ini" "$CONFIG_PATH/Engine.ini"fi# 启动服务器cd "$SERVER_PATH"./PalServer.sh -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS
赋予执行权限:
chmod +x start_palworld.sh
2. 修改服务器配置
编辑游戏配置文件:
nano /home/steam/Pal/Saved/Config/LinuxServer/GameUserSettings.ini
找到并修改以下参数(根据你的需求调整):
[/Script/Pal.PalGameWorldSettings]OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="My Palworld Server",ServerDescription="Private Palworld Server",AdminPassword="your_admin_password",ServerPassword="your_server_password",PublicPort=8211,PublicIP="your_server_ip",RCONEnabled=False,RCONPort=25575,Region=None,bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt")
3. 开放防火墙端口
确保服务器的防火墙开放以下端口:
8211 UDP (游戏主端口)27015 UDP (Steam查询端口)sudo ufw allow 8211/udpsudo ufw allow 27015/udpsudo ufw enable
启动和管理服务器
1. 使用Screen保持会话
screen -S palworld./start_palworld.sh
按Ctrl+A
然后D
退出Screen会话,服务器会继续运行。
2. 重新进入会话
screen -r palworld
3. 停止服务器
在Screen会话中,按Ctrl+C
即可停止服务器。
自动化管理(可选)
1. 创建系统服务
为了更专业地管理服务器,可以创建systemd服务:
sudo nano /etc/systemd/system/palworld.service
添加以下内容:
[Unit]Description=Palworld Dedicated ServerAfter=network.target[Service]User=steamGroup=steamWorkingDirectory=/home/steam/Steam/steamapps/common/PalServerExecStart=/home/steam/start_palworld.shRestart=alwaysRestartSec=60KillSignal=SIGINTEnvironment="LD_LIBRARY_PATH=/home/steam/Steam/steamapps/common/PalServer/linux64"[Install]WantedBy=multi-user.target
启用并启动服务:
sudo systemctl enable palworldsudo systemctl start palworld
2. 查看服务器状态
sudo systemctl status palworld
3. 日志查看
journalctl -u palworld -f
性能优化
1. 定期重启
建议每天自动重启服务器一次,可以创建cron任务:
sudo crontab -e
添加以下行:
0 4 * * * /bin/systemctl restart palworld
2. 内存优化
如果服务器内存不足(小于8GB),可以添加swap空间:
sudo fallocate -l 4G /swapfilesudo chmod 600 /swapfilesudo mkswap /swapfilesudo swapon /swapfileecho '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
常见问题解决
1. 服务器启动失败
检查是否有足够空间:
df -h
至少需要10GB可用空间。
2. 玩家无法连接
检查端口是否开放:
sudo netstat -tulnp | grep Pal
检查防火墙规则:
sudo ufw status
3. 更新服务器
定期更新服务器:
su - steamcd ~/Steam./steamcmd.sh +login anonymous +app_update 2394010 validate +quit
进阶配置
1. 启用RCON(远程控制)
修改GameUserSettings.ini
:
RCONEnabled=TrueRCONPort=25575
然后重启服务器。
2. 备份存档
存档位置在/home/steam/Pal/Saved
,可以设置自动备份:
sudo crontab -e
添加:
0 3 * * * tar -zcvf /backup/palworld_$(date +\%Y\%m\%d).tar.gz /home/steam/Pal/Saved
总结
通过以上步骤,你已经成功在9.9元的香港服务器上搭建了《幻兽帕鲁》的专用联机服务器。这种自建服务器的方式不仅成本低廉,而且你可以完全控制游戏规则和设置,与好友享受更稳定的联机体验。
记住定期备份存档,并根据玩家数量适当调整服务器配置。现在,邀请你的朋友,开始你们的帕鲁冒险吧!