赞
踩
腾讯云CentOS 8
安装依赖
# 用于支持64位系统运行32位的文件
yum install glibc.i686
下载并运行
mkdir /opt/steamcmd
cd /opt/steamcmd
# 下载 steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
# 解压 steamcmd
tar -xvzf steamcmd_linux.tar.gz
# 运行 steamcmd
./steamcmd.sh
# 退出 steamcmd
quit
下载开服程序
# 进入 steamcmd 的命令行
./steamcmd.sh
# 设置安装目录为 /opt/dontstarve
force_install_dir /opt/dontstarve
# 匿名登录
login anonymous
# 下载开服软件
app_update 343050 validate
# 退出 steamcmd
quit
安装依赖
# 安装 curl
yum install libcurl.i686
cd /usr/lib
ln -s libcurl.so.4 libcurl-gnutls.so.4
# 安装 stdc++
yum update -y libstdc++.x86_64
yum install libstdc++.i686
启动
cd /opt/dontstarve
./bin/dontstarve_dedicated_server_nullrenderer
启动应该是失败了,因为缺少配置,但是没关系,继续看下一条。
创建目录
首先为房间创建一个目录,这个房间内的所有配置都在这个目录下。
mkdir /opt/dontstarve/config
mkdir /opt/dontstarve/config/Clusters
mkdir /opt/dontstarve/config/Clusters/Cluster_1
cd /opt/dontstarve/config/Clusters/Cluster_1
token配置
先从官网获取token,流程如下:进入游戏,点击账号,点击上方导航栏游戏,点击饥荒联机版的游戏服务器,输入集群名,点击添加新服务器,然后就能看到新生成的token了。回到服务器,执行以下命令。
cd /opt/dontstarve/config/Clusters/Cluster_1
vim cluster_token.txt
将token粘贴到这个文件中,保存并关闭文件。
服务器配置
cd /opt/dontstarve/config/Clusters/Cluster_1
vim cluster.ini
添加以下内容,汉字部分需要根据含义修改,配置的解释见附录
[GAMEPLAY] game_mode = survival max_players = 6 pvp = false pause_when_empty = true [NETWORK] cluster_description = 服务器描述 cluster_name = 服务器名称,根据这个名称在游戏中搜索和加入 cluster_intention = cooperative cluster_password = 服务器密码 [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 = supersecretkey
管理员配置(可选)
先从官网获取用户ID,流程如下:进入游戏,点击账户信息,左上角能看到KLEI用户ID。回到服务器,执行以下命令。
cd /opt/dontstarve/config/Clusters/Cluster_1
vim adminlist.txt
将用户ID粘贴到文件中,每行可以放一个ID,房间创建者默认就是管理员,不需要再添加了。
主地图配置
创建主地图目录
cd /opt/dontstarve/config/Clusters/Cluster_1
mkdir Master
cd Master
创建主地图服务器配置
vim server.ini
添加以下内容
[NETWORK]
server_port = 10898
[SHARD]
is_master = true
[STEAM]
master_server_port = 27018
authentication_port = 8768
[ACCOUNT]
encode_user_path = true
创建主地图世界配置
vim worldgenoverride.lua
输入以下内容
return {
override_enabled = true,
preset = "SURVIVAL_TOGETHER",
misc = {
world_size = "huge"
}
}
洞穴配置(可选)
创建洞穴目录
cd /opt/dontstarve/config/Clusters/Cluster_1
mkdir Caves
cd Caves
创建洞穴服务器配置
vim server.ini
添加以下内容
[NETWORK]
server_port = 10899
[SHARD]
is_master = false
name = Caves
id = 1811570792
[STEAM]
master_server_port = 27019
authentication_port = 8769
[ACCOUNT]
encode_user_path = true
创建洞穴世界配置
vim worldgenoverride.lua
输入以下内容
return {
override_enabled = true,
preset = "DST_CAVE",
misc = {
world_size = "huge"
}
}
安装 screen
yum install epel-release
yum install screen
启动主地图
编写启动脚本
cd /opt/dontstarve/config/Clusters/Cluster_1
vim start_master.sh
添加以下内容
#!/bin/sh home=/opt/dontstarve storage=$home/config clusters=Clusters cluster=Cluster_1 shard=Master command='./dontstarve_dedicated_server_nullrenderer' command="$command -console" command="$command -persistent_storage_root $storage" command="$command -conf_dir $clusters" command="$command -cluster $cluster" command="$command -shard $shard" cd $home/bin /usr/bin/screen -S "dstmaster" /bin/sh -c "$command"
执行脚本,启动服务器
sh start_master.sh
启动完成后,就可以在客户端搜索到了。按ctrl + A,然后按D,退出此窗口,服务会继续在后台运行。输入screen -r dstmaster
可以回到此窗口。
启动洞穴(可选)
编写启动脚本
cd /opt/dontstarve/config/Clusters/Cluster_1
vim start_caves.sh
添加以下内容
#!/bin/sh home=/opt/dontstarve storage=$home/config clusters=Clusters cluster=Cluster_1 shard=Caves command='./dontstarve_dedicated_server_nullrenderer' command="$command -console" command="$command -persistent_storage_root $storage" command="$command -conf_dir $clusters" command="$command -cluster $cluster" command="$command -shard $shard" cd $home/bin /usr/bin/screen -S "dstcaves" /bin/sh -c "$command"
执行脚本,启动服务器
sh start_caves.sh
按ctrl + A,然后按D,退出此窗口,服务会继续在后台运行。输入screen -r dstcaves
可以回到此窗口。
如果服务器版本较低,可能会导致启动失败或无法加入房间,这时候需要更新服务器到最新版本。需要已经按照第一步安装过steamcmd。
cd /opt/dontstarve
vim update_dst.sh
添加以下内容
#!/bin/sh
/opt/steamcmd/steamcmd.sh +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +login anonymous +force_install_dir /opt/dontstarve +app_update 343050 validate +quit
/opt/dontstarve/bin/dontstarve_dedicated_server_nullrenderer -only_update_server_mods
添加可执行权限
chmod +x update_dst.sh
执行脚本
./update_dst.sh
暂时用不到,以后如果用到再写。
settings.ini
[GAMEPLAY] game_mode = endless | survival | wilderness max_players = 6 [1 - 64] pvp = true | false ;When the dedicated server is empty, pause the simulation. This is especially useful for private dedicated servers, when a GSA wants to resume where they left off with a group of friends. Defaults to false. pause_when_empty = true | false [NETWORK] cluster_description = A very nice server description cluster_name = A unique server name cluster_intention = cooperative | social | competitive | madness cluster_password = password [MISC] ;Snapshots allow GSAs the ability to fully roll back a server to an older state. This feature is pretty new and has been observed to cause problems on some servers. max_snapshots = 6 console_enabled = true | false [SHARD] shard_enabled = true | false bind_ip = 127.0.0.1 master_ip = 127.0.0.1 master_port = 10889 cluster_key = supersecretkey
worldgenoverride.lua
return { override_enabled = true, unprepared = { -- "never", "rare", "default", "often", "always" berrybush = "default", cactus = "default", carrot = "default", mushroom = "default", }, misc = { task_set = "default", -- Biomes: "classic", "cave_default" start_location = "default", -- Start: "plus", "darkness", "caves" autumn = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" boons = "default", -- "never", "rare", "default", "often", "always" branching = "default", -- "never", "least", "default", "most" day = "default", -- "default", "longday", "longdusk", "longnight", "noday", "nodusk", "nonight", "onlyday", "onlydusk", "onlynight" frograin = "default", -- "never", "rare", "default", "often", "always" lightning = "default", -- "never", "rare", "default", "often", "always" loop = "default", -- "never", "default", "always" season_start = "default", -- "default", "winter", "spring", "summer", "random" spring = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" summer = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" touchstone = "default", -- "never", "rare", "default", "often", "always" weather = "default", -- "never", "rare", "default", "often", "always" wildfires = "default", -- "never", "rare", "default", "often", "always" winter = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" world_size = "default", -- "default", "medium", "large", "huge" }, animals = { -- "never", "rare", "default", "often", "always" alternatehunt = "default", angrybees = "default", beefalo = "default", beefaloheat = "default", bees = "default", birds = "default", butterfly = "default", buzzard = "default", catcoon = "default", frogs = "default", hunt = "default", lightninggoat = "default", moles = "default", penguins = "default", perd = "default", pigs = "default", rabbits = "default", tallbirds = "default", }, monsters = { -- "never", "rare", "default", "often", "always" bearger = "default", chess = "default", deciduousmonster = "default", deerclops = "default", dragonfly = "default", goosemoose = "default", houndmound = "default", hounds = "default", krampus = "default", liefs = "default", lureplants = "default", merm = "default", spiders = "default", tentacles = "default", walrus = "default", }, resources = { -- "never", "rare", "default", "often", "always" flint = "default", flowers = "default", grass = "default", marshbush = "default", meteorshowers = "default", meteorspawner = "default", reeds = "default", rock = "default", rock_ice = "default", sapling = "default", trees = "default", tumbleweed = "default", }, }
Command Line Options
Command line options override settings.ini options.
Force the server to use a specific port
-port [1024 .. 65535]
Force the server to run at a specific tick rate
-tick [15 .. 60]
Force the maximum number of players allowed in the server.
-players [1 .. 64]
Enable a command line console input mechanism. Allows GSAs to execute privileged lua directly in the server window.
-console
Force the server into lan mode. The server will not require token authentication, and will not appear in the server listings. Only users on the same network will be able to join.
-lan
Force the server to load save and settings data from an alternative directory. Note that this is the directoryname, not the path. For example, a directory name of DoNotStarveServerDirectory would translate into a path of ~/.klei/DoNotStarveServerDirectory.
-conf_dir DoNotStarveServerDirectory
Setting the root directory of persistent storage. E.g. on Windows this defaults to the current user documents folder / klei. This is used in conjunction with conf_dir to generate the path where files are stored.
-persistent_storage_root <AltPersistentStorageRoot>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。