下面將在Debian 11手動搭建Don't Starve Together (饑荒聯機版) Linux服務器。
配置Debian環境
我們稍後將透過SteamCMD下載Don't Starve Together Linux Server,由於SteamCMD在Debian packages屬於non-free軟件,所以需要在APT SourcesList添加non-free選項。
修改 /etc/apt/sources.list
在deb和deb-src段落的結尾加上 non-free
另外SteamCMD只有i386版本,需要啟用APT的i386 architecture軟件
dpkg --add-architecture i386
完成配置後需要刷新APT的軟件包資訊
apt update
安裝SteamCMD和其他需要的軟件包
apt install steamcmd libsdl2-2.0-0 libsdl2-2.0-0:i386 curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 libcurl3-gnutls:i386 screen
下載Don't Starve Together Server
由於安全風險不建議使用root運行Don't Starve Together,新增一個普通用戶例如dontstarve-together
adduser dontstarve-together
登錄用戶dontstarve-together,使用SteamCMD下載Don't Starve Together Linux Server
steamcmd +login anonymous +force_install_dir /home/dontstarve-together/dontstarve-together-server +app_update 343050 validate +exit
Don't Starve Together Linux Server已下載到/home/dontstarve-together/dontstarve-together-server
配置Don't Starve Together Linux Server
啟動服務器以生成服務器配置文件夾
進入遊戲本體位置 /home/dontstarve-together/dontstarve-together-server/bin
,啟動服務器:
./dontstarve_dedicated_server_nullrenderer
服務器需要綁定你的遊戲帳號才能啟動,我們需要登入Klei Account取得Token
使用已購買遊戲的Steam帳號登入Klei:
https://accounts.klei.com/account/game/servers?game=DontStarveTogether
Cluster Name是用分辨Token用的別名
點撃Add New Server
以生成服務器Token:
找到剛才生成的Token,點撃Configure Server
:
點撃DOWNLOAD SETTINGS
後會得到一個"MyDediServer.zip"
解壓後把MyDediServer文件夾上傅到/home/dontstarve-together/.klei/DoNotStarveTogether
建議透過服務器用戶dontstarve-together用SFTP上傳以避免檔案權限問題
編輯配置文件,建議設置如下:
[GAMEPLAY] game_mode = survival max_players = 6 pvp = false pause_when_empty = true [NETWORK] cluster_description = This server is super duper! cluster_name = NickLabs cluster_intention = cooperative cluster_password = Password123 autosaver_enabled = true server_save_slot = 5 vote_kick_enabled = true [MISC] console_enabled = true [SHARD] shard_enabled = true bind_ip = 127.0.0.1 master_ip = 127.0.0.1 master_port = 10889 cluster_key = Password123
創建啟動腳本:
由於遊戲主世界(Master)和洞穴世界(Cave)是分開成兩個服務器端,以下需要創建兩個啟動腳本,
./dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -shard Master
./dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -shard Caves
#!/bin/sh # launch of server Overworld #Path Directory name_folder="/home/dontstarve-together/dontstarve-together-server/bin" #Command line start_overworld="sh start.sh" #Start or Restart the server screen -dr dst_server1 -X -S quit cd ${name_folder} screen -dmS dst_server1 ${start_overworld}
#!/bin/sh # launch of server Cave #Path Directory name_folder="/home/dontstarve-together/dontstarve-together-server/bin" #Command line start_cave="sh start2.sh" #Start or Restart the server screen -dr dst_server2 -X -S quit cd ${name_folder} screen -dmS dst_server2 ${start_cave}
啟動Don't Starve Together Linux Server
進入 /home/dontstarve-together/dontstarve-together-server/bin
輸入sh restart.sh
和 restart2.sh
如果顯示"No screen session found." ,就再次輸入sh restart.sh
和 restart2.sh
輸入 screen -r dst_server1
和 screen -r dst_server2
可分別進入 Master 和 Cave 的 console:
Master:
文章留言