安装前准备
服务器选择
15+MOD的饥荒服务启动后会占用1.2GB左右的内存,64位服务的话差不多1.8GB,双核CPU常驻15%左右的使用率,4~6人一起玩没啥压力。所以一台1核2G的服务器基本够用,比较推荐2核4G,可以加载更多MOD,玩到后期也不会太卡
- 需要准备的工具 :Xftp Xshell
- 服务器系统: 目前面板支持 Centos 7 Ubuntu 两大系统
- 系统推荐使用Ubuntu18.04或者Ubuntu最新版本或者Centos7.6
- 推荐使用dst-admin-go饥荒云服面板搭建便于管理
获取服务器令牌和Klei ID
先去https://accounts.klei.com/login注册账号(使用你购买饥荒游戏的steam账号登录)
获取服务器令牌
访问https://accounts.klei.com/account/game/servers?game=DontStarveTogether获取服务器token
添加新服务器,在这个输入框中输入,你想要的服务器名称,名称最好的全英文字符(如我这里的MoNou),然后点击下方的添加新服务器
![图片[1]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/1.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
稍等一会后服务器就新建完成,这里将这串令牌复制下来到新建txt,一会有用
![图片[2]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/2.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
获取Klei ID
访问https://accounts.klei.com/account/info获取Klei ID
![图片[3]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/3.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
dst-admin-go饥荒云服面板搭建(推荐使用)
饥荒联机开服面板 (go 版本),支持开启多个房间,一个面板管理多个房间,提供可视化创建世界和模组,并提供玩家日志采集和统计。
- 官方文档:https://flowus.cn/share/ed2f7999-b1d4-4d60-9c4d-509ffa578c5a
- 开源地址:https://github.com/hujinbo23/dst-admin-go/
- 目前安装方式分为两种 手动安装和自动脚本安装
面板功能预览
在进行安装之前,先来看看这个面板怎么好用,好用在那里
![图片[4]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/4.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
![图片[5]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/5.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
![图片[6]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/6.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
![图片[7]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/7.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
一、工具和服务器的准备工作
云服务器安全组要放行饥荒用的端口(udp协议分别开放10888 10998 10999端口)和面板用的端口(tcp协议开放8082端口)如果你服务器有装宝塔面板记得也放行这些端口
1、安装xshell
xshell官网:https://www.xshell.com/zh/free-for-home-school/
2、连接服务器
点击菜单栏文件 — 新建
![图片[8]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/8.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
点击用户身份验证
![图片[9]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/9.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
视频教程
3、下载项目到服务器
安装wget
Centos
yum update -y
sudo yum install wget -y
Ubuntu
apt update -y
apt upgrade -y
apt-get install wget -y
cd /opt
wget https://github.com/hujinbo23/dst-admin-go/releases/download/1.1.9/dst-admin-go.1.1.9.tgz #此版本为当时搭建版本切记自己修改最新版本
![图片[10]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/10.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
4、解压项目
tar -zvxf dst-admin-go.1.1.9.tgz
![图片[11]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/11.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
5、进入项目目录里
ls
cd dst-admin-go.1.1.9/
![图片[12]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/12.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
6、启动面板
chmod +x start.sh
sudo bash start.sh
输入 1 启动
如果启动不成功,请执行 nohup ./dst-admin-go >log.log &
![图片[13]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/13.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
7、配置面板
然后到浏览器 http://你的服务器IP地址:8082,初始化账号信息
![图片[14]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/14.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
填写信息后点击下一步,进入页面,点击**/系统设置/安装环境**
![图片[15]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/15.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
等待一段时间,等待安装完成【successed】就表示我们安装好了
![图片[16]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/15.1.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
然后修改 系统设置
设置 备份路径 和 mod下载路径(steamcmd 和 饥荒安装路径 会显示我们刚才安装的环境的路径)
- steamcmd安装路径/root/steamcmd
- 饥荒服务器安装路径/root/dst-dedicated-server
- 游戏备份路径/root/.klei/DoNotStarveTogether
- mod下载路径/root/.klei/DoNotStarveTogether
- 目录根据用户的不同,会有稍许不同,默认应该就是root或者ubuntu
![图片[17]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/16.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
载入世界存档
先去Steam启动饥荒联机版
点击左下角数据
![图片[18]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/17.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
将里面的Cluster_2文件夹(你的有可能是Cluster_1每个人的存档不一样请自行判断存档)压缩成zip文件
点击**/游戏备份/上传存档**在点击恢复备份
![图片[19]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/18.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
设置房间
打开房间设置往下找到令牌吧保存的令牌填入一直下一步到保存
![图片[20]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/token.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
设置完成后启动服务(当我们看见,sim paused的时候就说明服务器启动成功了 )
![图片[21]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/19.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
如果无法启动就是环境没有装好需要手动安装环境
sudo bash install_centos.sh # Centos系统执行这个脚本
sudo bash install_ubuntu.sh # Ubuntu系统执行这个脚本
![图片[22]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/20.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
打开游戏登录游戏服务器
打开steam启动游戏进去之后按键盘的`键启动控制台到面板复制登录命令粘贴进去回车即可
![图片[23]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/21.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
自动脚本安装
新建脚本文件
cd /opt
sudo touch install.sh
vim install.sh
把下面的内容按鼠标滚轮粘贴进去
#!/bin/bash
#Install Latest Stable Dst-admin-go Release
CURRENT_DIR=$(
cd "$(dirname "$0")"
pwd
)
function log() {
message="[Dst-admin-go Log]: $1 "
echo -e "${message}" 2>&1 | tee -a ${CURRENT_DIR}/install.log
}
echo
cat << EOF
=============Dst-admin-go、steamcmd、dst一键部署工具!===================
EOF
log "======================= 开始安装 ======================="
#Check system
function check_sys(){
local checkType="$1"
local value="$2"
local release=''
local systemPackage=''
if [[ -f /etc/redhat-release ]]; then
release="centos"
systemPackage="yum"
elif grep -Eqi "debian" /etc/issue; then
release="debian"
systemPackage="apt"
elif grep -Eqi "ubuntu" /etc/issue; then
release="ubuntu"
systemPackage="apt"
elif grep -Eqi "centos|red hat|redhat" /etc/issue; then
release="centos"
systemPackage="yum"
elif grep -Eqi "debian" /proc/version; then
release="debian"
systemPackage="apt"
elif grep -Eqi "ubuntu" /proc/version; then
release="ubuntu"
systemPackage="apt"
elif grep -Eqi "centos|red hat|redhat" /proc/version; then
release="centos"
systemPackage="yum"
fi
if [[ "${checkType}" == "sysRelease" ]]; then
if [ "${value}" == "${release}" ]; then
return 0
else
return 1
fi
elif [[ "${checkType}" == "packageManager" ]]; then
if [ "${value}" == "${systemPackage}" ]; then
return 0
else
return 1
fi
fi
# sudo yum install -y jq glibc.i686 libstdc++.i686 screen libcurl.i686 glibc libstdc++ screen libcurl epel
log "您的系统是${release},您的包管理器是${systemPackage}"
if [ ${release} == "centos" ]; then
SERVICE="/usr/lib/systemd/system"
log "您的配置文件目录为:$SERVICE"
sudo yum update
# sudo yum -y install jq
sudo yum -y install epel-release
# sudo yum -y install lib32gcc1
# sudo yum -y install libcurl4-gnutls-dev:i386
# sudo yum -y install screen
# sudo yum -y install glibc
sudo yum install -y -q epel jq lib32gcc1 glibc libstdc++.i686 screen libcurl libcurl4-gnutls-dev glibc.i686 libcurl.i686 libcurl.x86_64
log "创建libcurl动态链接文件(一个万恶的文件)"
sudo ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4
sudo ln -s /usr/lib64/libcurl.so.4 /usr/lib64/libcurl-gnutls.so.4
elif [ ${release} == "ubuntu" ]; then
SERVICE="/lib/systemd/system"
log "您的配置文件目录为:$SERVICE"
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y -q install jq
sudo apt-get -y -q install lib32gcc1
sudo apt-get -y -q install libcurl4-gnutls-dev:i386
sudo apt-get -y -q install screen
sudo apt-get -y -q install glibc
else
log "暂不支持的系统架构,请参阅官方文档,选择受支持的系统。"
exit 1
fi
}
function Prepare_System(){
osCheck=`uname -a`
if [[ $osCheck =~ 'x86_64' ]];then
architecture="amd64"
sudo yum install -y jq glibc.i686 libstdc++.i686 screen libcurl.i686 glibc libstdc++ screen libcurl epel
elif [[ $osCheck =~ 'arm64' ]] || [[ $osCheck =~ 'aarch64' ]];then
architecture="arm64"
else
log "暂不支持的系统架构,请参阅官方文档,选择受支持的系统。"
exit 1
fi
}
function Set_Dir(){
if read -t 120 -p "设置 dst-admin-go 安装目录(默认为/opt):" PANEL_BASE_DIR;then
if [[ "$PANEL_BASE_DIR" != "" ]];then
if [[ "$PANEL_BASE_DIR" != /* ]];then
log "请输入目录的完整路径"
Set_Dir
fi
if [[ ! -d $PANEL_BASE_DIR ]];then
mkdir -p $PANEL_BASE_DIR
log "您选择的安装路径为 $PANEL_BASE_DIR"
fi
else
PANEL_BASE_DIR=/opt
log "您选择的安装路径为 $PANEL_BASE_DIR"
fi
else
PANEL_BASE_DIR=/opt
log "(设置超时,使用默认安装路径 /opt)"
fi
cd $PANEL_BASE_DIR
}
function Install_Dst(){
# 使用curl下载版本信息
curl -o version.latest https://api.github.com/repos/hujinbo23/dst-admin-go/releases/latest
# 正则表达式匹配版本号
VERSION=$(cat version.latest | jq -r .tag_name)
log "开始下载 dst-admin-go ${VERSION} 版本在线安装包"
NAME=$(cat version.latest | jq -r .assets[].name | head -n 1)
HOST_IP=$(ip a | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk '{print $2}' | awk -F / '{print$1}')
HOST_IP1=$(curl https://api.ipify.org)
package_file_name="dst-admin-go-${VERSION}-linux-${architecture}.tgz"
log "安装包下载名称: ${package_file_name} $NAME"
# package_download_url="https://kgithub.com/hujinbo23/dst-admin-go/releases/download/${VERSION}/${NAME}"
package_download_url="https://ghproxy.com/https://github.com/hujinbo23/dst-admin-go/releases/download/${VERSION}/${NAME}"
log "安装包下载地址: ${package_download_url}"
# -f 参数判断 $file 是否存在
if [ ! -f "$NAME" ]; then
log "安装包不存在。"
log "... 在线安装 dst-admin-go..."
if [[ "x${VERSION}" == "x" ]];then
log "获取最新版本失败,请稍候重试"
exit 1
fi
log "正在下载中,请稍后。"
curl -Lk -O ${package_download_url}
if [ ! -f ${NAME} ];then
log "下载安装包失败,请稍候重试。"
exit 1
fi
fi
tar -zxf ${NAME}
if [ $? != 0 ];then
log "下载安装包失败,请稍候重试。"
rm -f ${NAME}
exit 1
fi
}
function Install_Service(){
# -f 参数判断 $file 是否存在
if [ ! -f "/etc/systemd/system/dst-admin-go.service" ]; then
log "dst-admin-go服务不存在。"
# log "================配置dst服务文件================"
# cat > /etc/systemd/system/dst-admin-go.service <<EOF
# [Unit]
# Description=dst-admin-go server daemon
# After=network.target
#
# [Service]
# Type=simple
# User=root
# WorkingDirectory=$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})
# ExecStart=$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/dst-admin-go.sh start
# ExecReload=$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/dst-admin-go.sh restart
# ExecStop=$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/dst-admin-go.sh stop
# KillMode=process
#
# [Install]
# WantedBy=multi-user.target
# EOF
# log "=====================启动 dst=================="
#systemctl enable dst-admin-go; systemctl daemon-reload; systemctl start dst-admin-go 2>&1 | tee -a ${CURRENT_DIR}/install.log
fi
}
function Install_Steamcmd(){
#创建setamcmd目录
if [ ! -d "$PANEL_BASE_DIR/steamcmd" ]; then
log "steamcmd文件夹不存在。"
mkdir $PANEL_BASE_DIR/steamcmd
else
log "steamcmd文件夹已存在。"
log "删除steamcmd文件夹中。"
rm -rf $PANEL_BASE_DIR/steamcmd
log "steamcmd文件夹已删除。"
log "重新创建steamcmd文件夹。"
mkdir $PANEL_BASE_DIR/steamcmd
cd $PANEL_BASE_DIR/steamcmd
log "steamcmd目录创建完成"
fi
# -f 参数判断 $file 是否存在
if [ ! -f "steamcmd_linux.tar.gz" ]; then
log "steamcmd安装包不存在。"
log "=================在线安装 steamcmd=============="
log "正在下载中,请稍后。"
curl -Lk -O https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
log "解压steamcmd服务端........"
tar -xzf steamcmd_linux.tar.gz
log "下载饥荒服务端......."
./steamcmd.sh +login anonymous +force_install_dir ${PANEL_BASE_DIR}/dst-dedicated-server +app_update 343050 validate +quit
log "复制so库文件到饥荒服务端目录"
cp ${PANEL_BASE_DIR}/steamcmd/linux32/libstdc++.so.6 ${PANEL_BASE_DIR}/dst-dedicated-server/bin/lib32/
log "创建饥荒存档文件目录"
mkdir -p ~/.klei/DoNotStarveTogether/MyDediServer
mkdir -p ~/.klei/DoNotStarveTogether/backup
mkdir -p ~/.klei/DoNotStarveTogether/mod_download
fi
}
function Install_Dsttar(){
#获取饥荒存档目录绝对路径
cd ~/.klei/DoNotStarveTogether/
work_dir=$(pwd)
log "===============在线部署标准存档文件============="
log "您的饥荒存档文件绝对路径为 $work_dir"
if [ ! -f "$work_dir/MyDediServer/ttttt.tar.gz" ]; then
log "标准存档文件不存在。"
log "正在下载中,请稍后"
# curl -Lk https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz -o $work_dir/MyDediServer/ttttt.tar.gz
log "解压标准存档文件"
# tar -xzf $work_dir/MyDediServer/ttttt.tar.gz -C $work_dir/MyDediServer
fi
}
function Set_Port(){
DEFAULT_PORT=`expr $RANDOM % 55535 + 10000`
while true; do
read -p "设置 dst-admin-go 端口(默认为$DEFAULT_PORT):" PANEL_PORT
if [[ "$PANEL_PORT" == "" ]];then
PANEL_PORT=$DEFAULT_PORT
fi
if ! [[ "$PANEL_PORT" =~ ^[1-9][0-9]{0,4}$ && "$PANEL_PORT" -le 65535 ]]; then
log "错误:输入的端口号必须在 1 到 65535 之间"
continue
fi
log "您设置的端口为:$PANEL_PORT"
# log "端口配置文件:$PANEL_BASE_DIR/dst-admin-go.${VERSION}/config.yml"
log "端口配置文件:$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/config.yml"
sed -i -e "s/8082/$PANEL_PORT/" $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/config.yml
break
done
}
function Set_Username(){
DEFAULT_USERNAME=`cat /dev/urandom | head -n 16 | md5sum | head -c 10`
while true; do
read -p "设置 dst-admin-go 用户名称(默认为$DEFAULT_USERNAME):" PANEL_USERNAME
if [[ "$PANEL_USERNAME" == "" ]];then
PANEL_USERNAME=$DEFAULT_USERNAME
fi
if [[ ! "$PANEL_USERNAME" =~ ^[a-zA-Z0-9_]{3,30}$ ]]; then
log "错误:用户名称仅支持字母、数字、下划线,长度 3-30 位"
continue
fi
log "您设置的用户名称为:$PANEL_USERNAME"
# log "用户名配置文件:$PANEL_BASE_DIR/dst-admin-go.${VERSION}/password.txt"
log "用户名配置文件:$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/password.txt"
cat > $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/first <<EOF
EOF
log "===================初始化饥荒云服配置文件======================="
cat > $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/dst_config <<EOF
steamcmd=$PANEL_BASE_DIR/steamcmd
force_install_dir=${PANEL_BASE_DIR}/dst-dedicated-server
donot_starve_server_directory=
persistent_storage_root=
cluster=MyDediServer
backup=$work_dir/backup
mod_download_path=$work_dir/mod_download
bin=32
beta=0
EOF
break
done
}
function Set_Password(){
DEFAULT_PASSWORD=`cat /dev/urandom | head -n 16 | md5sum | head -c 10`
while true; do
log "设置 dst-admin-go 用户密码(默认为$DEFAULT_PASSWORD):"
read -s PANEL_PASSWORD
if [[ "$PANEL_PASSWORD" == "" ]];then
PANEL_PASSWORD=$DEFAULT_PASSWORD
fi
if [[ ! "$PANEL_PASSWORD" =~ ^[a-zA-Z0-9_!@#$%*,.?]{8,30}$ ]]; then
log "错误:用户密码仅支持字母、数字、特殊字符(!@#$%*_,.?),长度 8-30 位"
continue
fi
# log "用户密码配置文件:$PANEL_BASE_DIR/dst-admin-go.${VERSION}/password.txt"
log "用户密码配置文件:$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/password.txt"
cat > $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/password.txt <<EOF
username = $PANEL_USERNAME
password = $PANEL_PASSWORD
displayName = $PANEL_USERNAME
photoURL= xxx
email = xxx
EOF
break
done
}
function Set_Firewall(){
if which firewall-cmd >/dev/null 2>&1; then
if systemctl status firewalld | grep -q "Active: active" >/dev/null 2>&1;then
log "防火墙开放 $PANEL_PORT 端口"
firewall-cmd --zone=public --add-port=$PANEL_PORT/tcp --permanent
firewall-cmd --reload
else
log "防火墙未开启,忽略端口开放"
fi
fi
if which ufw >/dev/null 2>&1; then
if systemctl status ufw | grep -q "Active: active" >/dev/null 2>&1;then
log "防火墙开放 $PANEL_PORT 端口"
ufw allow $PANEL_PORT/tcp
ufw reload
else
log "防火墙未开启,忽略端口开放"
fi
fi
}
function Dst_Started_Shell(){
log "服务启动脚本文件:$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/run.sh"
cat > $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/run.sh <<EOF
#!/bin/bash
usage="Usage: run.sh (start|stop|restart)"
start() {
# PID=$(ps -ef | grep "dst-admin-go" | grep -v grep | awk '{printf $2}')
if [ -z "\$PID" ]; then
echo "PID is empty,The service is starting up."
else
kill -9 \$PID
fi
# nohup $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/dst-admin-go >/dev/null 2>&1 &
nohup ./dst-admin-go >/dev/null 2>&1 &
echo "The service has started successfully"
PIDS=\$(ps -ef|grep dst-admin-go|grep -v grep|awk '{printf \$2}')
echo "Process PID is \$PIDS"
}
stop() {
#注意这里dst-admin-go改为你自己需要停止的进程名称
PID=\$(ps -ef | grep "dst-admin-go" | grep -v grep | awk '{printf \$2}')
if [ -z "\$PID" ]; then
echo "PID is empty"
else
kill -9 \$PID
fi
#ps -ef|grep dst-admin-go|grep -v grep|awk '{printf $2}'|xargs kill -9
echo "Process PID is \$PID"
echo "The service has been stopped successfully"
}
restart() {
stop
echo "The service has started successfully"
start
echo "PID is empty,The service is starting up."
}
case \$1 in
(start)
start
;;
(stop)
stop
;;
(restart)
restart
;;
(*)
echo "Error command"
echo "\$usage"
;;
esac
EOF
#给启动脚本添加执行权限
chmod +x $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/run.sh
cd $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})
#启动相应服务
#$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/run.sh start
./run.sh start
#查看服务是否启动
ps -ef | grep "dst-admin-go" | grep -v grep
}
function Show_Result(){
log "=====================启动 dst=================="
# systemctl enable dst-admin-go; systemctl daemon-reload; systemctl start dst-admin-go 2>&1 | tee -a ${CURRENT_DIR}/install.log
#cd $PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})
log ""
log "=================感谢您的耐心等待,安装已经完成=================="
log ""
log "请用浏览器访问面板:"
log "面板地址: http://$HOST_IP:$PANEL_PORT "
log "面板公网地址: http://$HOST_IP1:$PANEL_PORT "
log "用户名称: $PANEL_USERNAME"
log "用户密码: $PANEL_PASSWORD"
log ""
log "steamcmd部署路径:${PANEL_BASE_DIR}/steamcmd"
log "dst部署路径:$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})"
log "存档目录:$work_dir/MyDediServer"
log ""
log "请用$PANEL_BASE_DIR/$(basename ${NAME} .${NAME##*.})/run.sh脚本管理项目"
log "脚本使用示例:Usage: run.sh (start|stop|restart)"
log "本脚本不包含任何存档文件,请自行创建相关游戏存档"
log ""
log "项目官网: https://github.com/hujinbo23/dst-admin-go"
log "项目文档: https://blog.csdn.net/Dig_hoof/article/details/131296762"
log "代码仓库: https://github.com/hujinbo23/dst-admin-go"
log ""
log "如果使用的是云服务器,请至安全组开放 $PANEL_PORT 端口"
log ""
log "================================================================"
}
function main(){
check_sys
Set_Dir
Install_Dst
Install_Steamcmd
Install_Dsttar
Set_Port
Set_Username
Set_Password
Set_Firewall
Dst_Started_Shell
Show_Result
}
main
保存并启动脚本
按esc键
输入:wq # 别忘了输入冒号
sudo chmod +x install.sh
sudo bash install.sh
8、其他说明
默认是8082端口,如果需要更改端口
修改 config.yml port
vim config.yml
面板更新教程
停止面板服务
cd /opt/dst-admin-go.1.1.9/
sudo bash start.sh # 输入2关闭
下载新文件并解压到服务器
cd ..
wget https://github.com/hujinbo23/dst-admin-go/releases/download/1.1.9/dst-admin-go.1.2.0.tgz
tar -zvxf dst-admin-go.1.2.0.tgz
替换文件
cd dst-admin-go.1.2.0/
mv dist/ dst-admin-go /opt/dst-admin-go.1.1.9/
启动面板
cd ../dst-admin-go.1.1.9/
sudo bash start.sh # 输入1启动
升级完成
纯命令行搭建
- 启动了服务器,但是在Steam搜索不到
- 添加了新MOD,但在游戏中不生效
如果你遇到了上面的问题,可以尝试看下这篇文章,也许能解决你的问题。
部署教程
在启动脚本有用到教程中创建的文件夹和文件名称,不建议更改
用有sudo权限的用户登录到服务器
1. 安装依赖
先安装steam和饥荒服务器需要用到的依赖
sudo add-apt-repository multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libstdc++6 libgcc1 libcurl4-gnutls-dev:i386 lib32z1
2. 安装 SteamCMD
创建steamcmd文件夹
mkdir ~/steamcmd
cd ~/steamcmd
下载 steamcmd程序
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
解压steamcmd_linux.tar.gz文件
tar -xvzf steamcmd_linux.tar.gz
启动steamcmd
sudo bash steamcmd.sh
3. 安装饥荒联机版
如果上面没出啥问题的话,将会进入steam服务,接下来控制steam下载饥荒联机版
前面的steam> 不需要输入,只是说明你在steam服务中
steam> force_install_dir ../dontstarvetogether_dedicated_server
steam> login anonymous
steam> app_update 343050 validate
steam> quit
app_update 343050 validate就是去steam中下载饥荒联机服务器的命令,需要等待一会,当执行完成后输入quit退出steam服务
4. 创建服务器存档
在服务器上直接创建新地图的话后续配置会比较麻烦,一般都是在Windows上先创建地图,然后找到地图文件上传到服务器中。
在Windows上打开《饥荒联机版》,在选单界面点击【创建游戏】对联机需要创建的世界进行配置,服务器模式选择【公共】,配置好密码,并勾选要使用的MOD
配置完成后,点击“生成世界”,等待世界创建完成,在进入选择人物界面后,就可以退出了
在服务器中创建存档的存放文件夹
mkdir -p ~/.klei/DoNotStarveTogether/Cluster_1
在C://User/xxx/文档/klei/DoNotStarveTogether文件夹下,找到你刚才创建的存档,上传到/.klei/DoNotStarveTogether/Cluster_1这个文件夹里面,cluster_token.txt没有没关系,后面会创建。
![图片[24]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/22.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
在服务器的Cluster_1文件夹下创建文件cluster_token.txt, 将服务器token保存到文件中
vim cluster_token.txt
# 复制上面申请到的pds-g那串字符到文件中之后保存
5. 为自己添加管理员权限
创建管理员权限文件,复制klei ID到文件中
vim adminlist.txt
# 复制上面获取的ID到文件中之后保存
6. 为服务器订阅MOD
这里只是告诉服务器要订阅或者说要下载哪些MOD,是否在地图中启用MOD在其它文件中(后面会讲)
cd /dontstarvetogether_dedicated_server/mods
vim dedicated_server_mods_setup.lua
![图片[25]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/23.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
在文件最下面添加需要订阅的MOD,其中的数字是MOD的ID,可以在.klei/DoNotStarveTogether/Cluster_1/Master/modoverride.lua中查看
![图片[26]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/24.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
P.S .klei/DoNotStarveTogether/Cluster_1/Master/modoverride.lua就是这个地图的MOD配置,如果订阅了新MOD,一定要到这里添加配置,不然MOD不会生效。
Caves中也有一个modoverride.lua文件,记得一起修改。
7. 编写启动脚本
回到根目录,创建boot.sh文件
cd ~
vim boot.sh
把下面的命令粘贴到boot.sh中
#!/bin/bash
steamcmd_dir="$HOME/steamcmd"
install_dir="$HOME/dontstarvetogether_dedicated_server"
cluster_name="Cluster_1"
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"
function fail() {
echo Error: "$@" >&2
exit 1
}
function check_for_file() {
if [ ! -e "$1" ]; then
fail "Missing file: $1"
fi
}
cd "$steamcmd_dir" || fail "Missing $steamcmd_dir directory!"
check_for_file "steamcmd.sh"
check_for_file "$dontstarve_dir/$cluster_name/cluster.ini"
check_for_file "$dontstarve_dir/$cluster_name/cluster_token.txt"
check_for_file "$dontstarve_dir/$cluster_name/Master/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Caves/server.ini"
check_for_file "$install_dir/bin"
cd "$install_dir/bin" || fail
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: /'
脚本中默认启动的是32位服务器,如果想启动64位服务(会用更大的内存,相对也会更流畅一些),只需要更改这两行
![图片[27]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/25.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
改成下面这样之后保存
cd "$install_dir/bin64" || fail
run_shared=(./dontstarve_dedicated_server_nullrenderer_x64)
赋予boot.sh执行权限
sudo chmod u+x boot.sh
到这里,饥荒服务器的部署就全部完成了,接下来还要开放防火墙端口,不然别人是访问不进来的。
开放端口
具体需要开放的端口可以查看存档文件夹下的这几个文件
# 饥荒端口,UDP协议
~/.klei/DoNotStarveTogether/Cluster_1/cluster.ini 中的 master_port。
~/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini 中的 server_port。
~/.klei/DoNotStarveTogether/Cluster_1/Caves/server.ini 中的 server_port
# steam端口,TCP+UDP协议
~/.klei/DoNotStarveTogether/Cluster_1/Caves/server.ini 中的 master_server_port、authentication_port
注意开放的协议,饥荒端口都是UDP协议,steam的保险起见两种协议都开。
![图片[28]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/26.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
共开放的端口如下,每个人可能不一样,具体要按照上面给出的那几个文件来配置。
![图片[29]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/27.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
启动饥荒服务器
到根目录,也就是boot.sh所在的目录,运行下面的代码
nohup ./boot.sh>root.log 2>&1 &
执行后饥荒服务器会在后台运行,可以通过下面这个命令查看输出的日志
tail -f root.log
能看到下面这样的输出就是启动成功了
![图片[30]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/28.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
关闭服务器
因为是后台运行,关闭服务器需要先找到服务器的PID,然后用kill命令杀死
ps -ef | grep don
kill 1306308
要kill的PID是上面图片中圈出来的,服务器在退出会执行一些方法,建议不要用kill -9强制杀死
![图片[31]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/29.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
其它
1. 修改服务器名称和密码
服务器的名称的名称和密码在.klei/DoNotStarveTogether/Cluster_1/cluster.ini 文件中,修改后重启即可
![图片[32]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/30.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
2. 更新服务器到最新版本
每次饥荒联机版更新后都需要同步更新服务器,不同版本之间不能在一起玩,而且搜索不到房间
这里推荐一个查询饥荒服务器的网址,如果你在这个网址上能搜到自己的服务器,但是其他人搜不到,那应该就是版本不同导致的。
# 登录steamcmd
cd /steamcmd
./steamcmd
# 执行命令(更新命令和安装命令一样)
steam> force_install_dir ../dontstarvetogether_dedicated_server
steam> login anonymous
steam> app_update 343050 validate
steam> quit
可以将上面的更新命令编写成脚本方便以后执行,步骤如下:
在steamcmd.sh文件的同级目录创建脚本文件update.sh,复制下面的命令到脚本中后保存
#!/bin/bash
./steamcmd.sh +force_install_dir ../dontstarvetogether_dedicated_server +login anonymous +app_update 343050 validate +quit
赋予脚本执行权限
sudo chmmod u+x update.sh
以后更新饥荒服务器直接运行 ./update.sh
3. 服务器卡顿可能原因排查
导致玩家在服务器上卡顿的原因有很多,比如
- 玩家到服务器连接不稳定
- 服务器CPU负载过高 或 内存不足
- 存在优化较差的MOD 或 相互不兼容
1、连接是否稳定可以使用ping命令
ping xxx.xxx.xxx.xxx -t
用服务器IP替换http://xxx.xxx.xxx.xxx,会得到如下输出,观察时间那一列是否经常会跳出一些比较大的数字,一般来说<60ms都是正常的。
![图片[33]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/31.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
2. 服务器性能排查,在ubuntu系统中可以使用top或者htop命令查看服务器资源使用情况
![图片[34]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/32.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
可以看到当前CPU负载是8.1%,内存还剩366.5+671.9=1038.4MB,如果CPU负载长期高于80%,内存少于100MB,那么卡顿很可能就是因为服务器资源不足,建议少加载些MOD,不要养太多生物,打扫一下地面掉落物。
3. MOD问题
可以上传一个纯净存档(不开任何MOD)试试,如果不卡顿再一个个关掉MOD尝试。
饥荒专用服务器(小白一键版)
看前注意:这个方法只适用于在自己的电脑上搭建服务器和朋友一起玩。
虽然饥荒联机一直不稳定,但官方有他的专门用来开服的工具
![图片[35]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/33.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
软件下载
先把这个软件放到上面下载的工具目录
![图片[36]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/34.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
打开后就是这样的
![图片[37]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/35.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
目录的话在steam-对应软件-右键属性-本地文件-浏览本地文件打开的第一个界面就是了。
把这个目录复制到这里。
保存,然后世界设置
![图片[38]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/36.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
mod设置
![图片[39]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/37.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
开启服务器
![图片[40]-饥荒服务器搭建教程-铭心博客](https://oss.imxbk.com//blog/WordPress/img/wz/%E9%A5%A5%E8%8D%92%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B/38.webp?x-oss-process=image/auto-orient,1/format,webp/watermark,text_d3d3Lnd3cnUuY24,type_ZmFuZ3poZW5naGVpdGk,size_10,g_se,x_10,y_10)
几个开服遇到的问题
1.开服后的存档不能在做任何修改(mod,世界设置 房间名都不行)
2.第一次开服后要设置,后来玩的话只要启动服务器就行(记得选在线)
3.按正常步骤开服却搜不到房间,首先去检查一下在steam下载的工具是否为最新,再不行就重启电脑
4.可能是mod有问题
5.玩上一个档后开新档的话记得把软件重开
暂无评论内容