饥荒联机版搭建linux服务器

1. 配置环境

ubuntu 64位环境下:

sudo apt-get install libstdc++6:i386 libgcc1:i386 libcurl4-gnutls-dev:i386

2. 安装steamcmd命令行和游戏包

mkdir ~/steamcmd
cd ~/steamcmd
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
./steamcmd.sh
login anonymous
force_install_dir ../dstserver
app_update 343050 validate
quit

3. 配置游戏

cd ~/dstserver/bin
./dontstarve_dedicated_server_nullrenderer

等待一段时间当命令行不再输出时 ctrl+c

打开 https://accounts.klei.com/account/game/servers?game=DontStarveTogether 登入steam账号

输入 cluster name 并 add new server, 先后下载生成的配置文件MyDediServer 并解压到  $HOME/.klei/DoNotStarveTogether/下

4. 增加Mod

cd ~/dstserver/mods
vim dedicated_server_mods_setup.lua

写入mod id mod id 为steam上该mod ip中一段数字  

ServerModSetup("modid")
ServerModSetup("modid")

再在modsettings.lua上写入, id和上边id相同

ForceEnableMod("workshop-id")
ForceEnableMod("workshop-id")

5. 启动服务器

在~/下编辑脚本rundst.sh, 并写入,注意一些变量要和你设置的时候相同

steamcmd_dir="$HOME/steamcmd"
install_dir="$HOME/dstserver"
cluster_name="MyDediServer"
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"
cd "$steamcmd_dir"
cd "$install_dir/bin"
run_shared=(./dontstarve_dedicated_server_nullrenderer)
run_shared+=(-console)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)
run_shared+=(-shard)
"${run_shared[@]}" Caves  | sed 's/^/Caves: /' &
"${run_shared[@]}" Master | sed 's/^/Master: /'

启动脚本

screen
./rundst.sh

 

你可能感兴趣的:(饥荒联机版搭建linux服务器)