如何架设七日杀A18服务器和小朋友们愉快的开黑

最近因为武汉肺炎的疫情大家都在家隔离,实在是憋得难受,就把以前自己搭建游戏服务器拿出有玩了一遍。如果你正好需要,那就拿去吧。

这里我选择的是最新版的ubuntu server版(在做任何事之前,请确保系统已经是最新的。)具体你是用自己的服务器还是用VPS,安装系统购买VPS的操作我就不一一演示了。我想这个对你应该不是问题。下面就开始安装七日杀服务器。

更新系统

sudo apt-get update
sudo apt-get upgrade

安装依赖环境

sudo dpkg --add-architecture i386; sudo apt update; sudo apt install mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux lib32gcc1 libstdc++6 libstdc++6:i386 telnet expect
su  #切换到root用户
adduser sdtdserver  #添加新用户
su - sdtdserver   #切换到新用户
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh sdtdserver
./sdtdserver install   #下载并安装

如果遇到raw.githubusercontent.com访问失败,可以编辑/etc/hosts文件加入199.232.4.133 raw.githubusercontent.com记得要在root用户下编辑
安装成功后先编辑服务器配置文件

vi serverfiles/serverconfig.xml   #编辑服务器设置
<?xml version="1.0"?>
<ServerSettings>
<!-- GENERAL SERVER SETTINGS -->

<!-- Server representation -->
<property name="ServerName" value="hwc0212.taobao.com"/>	<!-- 服务器的名字 -->
<property name="ServerDescription" value="A hwc0212.taobao.com 7 Days to Die server"/>	<!-- 服务器的简介 -->
<property name="ServerWebsiteURL" value="hwc0212.taobao.com"/>	<!-- 服务器的网站链接 -->
<property name="ServerPassword" value=""/>	<!-- 加入服务器的密码 -->
<property name="ServerLoginConfirmationText" value="" />	<!-- 设置这个后会在玩家登录时显示出来 -->

<!-- Networking -->
<property name="ServerPort"	value="26900"/>	<!-- 服务器监听端口 -->
<property name="ServerVisibility" value="2"/>	<!-- 服务器访问模式: 2 = 公开, 1 = 只有好友可见, 0 = 不可见. 如果你没有好友设置为 "1" 后将只接受第一个登录服务器的IP. -->
<property name="ServerDisabledNetworkProtocols" value="SteamNetworking"/>	<!-- Networking protocols that should not be used. Separated by comma. Possible values: LiteNetLib, SteamNetworking. Dedicated servers should disable SteamNetworking if there is no NAT router in between your users and the server or when port-forwarding is set up correctly -->
<property name="ServerMaxWorldTransferSpeedKiBs" value="512"/>   <!-- Maximum (!) speed in kiB/s the world is transferred at to a client on first connect if it does not have the world yet. Maximum is about 1300 kiB/s, even if you set a higher value. -->

<!-- Slots -->
<property name="ServerMaxPlayerCount" value="16"/>  <!-- 最大玩家数 -->
<property name="ServerReservedSlots" value="0"/>  <!-- Out of the MaxPlayerCount this many slots can only be used by players with a specific permission level -->
<property name="ServerReservedSlotsPermission" value="100"/>  <!-- Required permission level to use reserved slots above -->
<property name="ServerAdminSlots" value="0"/>  <!-- This many admins can still join even if the server has reached MaxPlayerCount -->
<property name="ServerAdminSlotsPermission" value="0"/>  <!-- Required permission level to use the admin slots above -->

<!-- Admin interfaces -->
<property name="ControlPanelEnabled" value="true"/>  <!-- 开启或关闭web控制面板 -->
<property name="ControlPanelPort" value="8080"/>  <!-- web控制面板的端口 -->
<property name="ControlPanelPassword" value="CHANGME"/>  <!-- 控制面板的访问密码 -->

<property name="TelnetEnabled" value="false"/>  <!-- 开启或关闭telnet -->
<property name="TelnetPort" value="8081"/>  <!-- telnet端口 -->
<property name="TelnetPassword" value="CHANGME"/>  <!-- telnet密码 -->
<property name="TelnetFailedLoginLimit" value="10"/>  <!-- 密码错误次数 -->
<property name="TelnetFailedLoginsBlocktime" value="10"/>  <!-- 禁止登陆多少秒 -->

<property name="TerminalWindowEnabled" value="true"/>  <!-- Show a terminal window for log output / command input (Windows only) -->

<!-- Folder and file locations -->
<property name="AdminFileName" value="serveradmin.xml"/>  <!-- 管理员配置文件 -->
<!-- <property name="UserDataFolder" value="absolute path" /> -->  <!-- Use this to override where the server stores all generated data, including RWG generated worlds. Do not forget to uncomment the entry! -->
<!-- <property name="SaveGameFolder" value="absolute path" /> -->  <!-- Use this to only override the save game path. Do not forget to uncomment the entry! -->

<!-- Other technical settings -->
<property name="EACEnabled" value="true"/>  <!-- Enables/Disables EasyAntiCheat -->
<property name="HideCommandExecutionLog" value="0"/>  <!-- Hide logging of command execution. 0 = show everything, 1 = hide only from Telnet/ControlPanel, 2 = also hide from remote game clients, 3 = hide everything -->
<property name="MaxUncoveredMapChunksPerPlayer" value="131072"/>  <!-- Override how many chunks can be uncovered on the ingame map by each player. Resulting max map file size limit per player is (x * 512 Bytes), uncovered area is (x * 256 m²). Default 131072 means max 32 km² can be uncovered at any time -->
<property name="PersistentPlayerProfiles" value="false" />  <!-- If disabled a player can join with any selected profile. If true they will join with the last profile they joined with -->



<!-- GAMEPLAY -->
	
<!-- World -->
<property name="GameWorld" value="RWG"/>  <!-- "RWG" (see WorldGenSeed and WorldGenSize options below) or any already existing world name in the Worlds folder (currently shipping with e.g. "Navezgane", "PREGEN01", ...) -->
<property name="WorldGenSeed" value="asdf"/>  <!-- If RWG this is the seed for the generation of the new world. If a world with the resulting name already exists it will simply load it -->
<property name="WorldGenSize" value="8192"/>  <!-- If RWG this controls the width and height of the created world. It is also used in combination with WorldGenSeed to create the internal RWG seed thus also creating a unique map name even if using the same WorldGenSeed. Has to be between 2048 and 16384, though large map sizes will take long to generate / download / load -->
<property name="GameName" value="hwc0212.taobao.com"/>  <!-- Whatever you want the game name to be. This affects the save game name as well as the seed used when placing decoration (trees etc) in the world. It does not control the generic layout of the world if creating an RWG world -->
<property name="GameMode" value="GameModeSurvival"/>  <!-- GameModeSurvival -->

<!-- Difficulty -->
<property name="GameDifficulty" value="2"/>  <!-- 0 - 5, 0=easiest, 5=hardest -->
<property name="BlockDamagePlayer" value="100" />  <!-- How much damage do players to blocks (percentage in whole numbers) -->
<property name="BlockDamageAI" value="100" />  <!-- How much damage do AIs to blocks (percentage in whole numbers) -->
<property name="BlockDamageAIBM" value="100" />  <!-- How much damage do AIs during blood moons to blocks (percentage in whole numbers) -->
<property name="XPMultiplier" value="100" />  <!-- XP gain multiplier (percentage in whole numbers) -->
<property name="PlayerSafeZoneLevel" value="5" />  <!-- If a player is less or equal this level he will create a safe zone (no enemies) when spawned -->
<property name="PlayerSafeZoneHours" value="5" />  <!-- Hours in world time this safe zone exists -->

<!--  -->
<property name="BuildCreate" value="false" />  <!-- cheat mode on/off -->
<property name="DayNightLength" value="60" />  <!-- real time minutes per in game day: 60 minutes -->
<property name="DayLightLength" value="18" />  <!-- in game hours the sun shines per day: 18 hours day light per in game day -->
<property name="DropOnDeath" value="1" />  <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only, 4 = delete all -->
<property name="DropOnQuit" value="0" />  <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only -->
<property name="BedrollDeadZoneSize" value="15" />  <!-- Size (box "radius", so a box with 2 times the given value for each side's length) of bedroll deadzone, no zombies will spawn inside this area, and any cleared sleeper volumes that touch a bedroll deadzone will not spawn after they've been cleared. -->
<property name="BedrollExpiryTime" value="45" />  <!-- Number of days a bedroll stays active after owner was last online -->

<!-- Performance related -->
<property name="MaxSpawnedZombies" value="64" />  <!-- This setting covers the entire map. There can only be this many zombies on the entire map at one time. Changing this setting has a huge impact on performance. -->
<property name="MaxSpawnedAnimals"	value="50" />  <!-- If your server has a large number of players you can increase this limit to add more wildlife. Animals don't consume as much CPU as zombies. NOTE: That this doesn't cause more animals to spawn arbitrarily: The biome spawning system only spawns a certain number of animals in a given area, but if you have lots of players that are all spread out then you may be hitting the limit and can increase it. -->
<property name="ServerMaxAllowedViewDistance" value="12" />  <!-- Max viewdistance a client may request (6 - 12). High impact on memory usage and performance. -->

<!-- Zombie settings -->
<property name="EnemySpawnMode" value="true" />  <!-- Enable/Disable enemy spawning -->
<property name="EnemyDifficulty" value="0" />  <!-- 0 = Normal, 1 = Feral -->
<property name="ZombieMove" value="0" />  <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
<property name="ZombieMoveNight" value="3" />	  <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
<property name="ZombieFeralMove" value="3" />  <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
<property name="ZombieBMMove" value="3" />  <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
<property name="BloodMoonFrequency" value="7" />  <!-- What frequency (in days) should a blood moon take place. Set to "0" for no blood moons -->
<property name="BloodMoonRange" value="0" />  <!-- How many days can the actual blood moon day randomly deviate from the above setting. Setting this to 0 makes blood moons happen exactly each Nth day as specified in BloodMoonFrequency -->
<property name="BloodMoonWarning" value="8" />  <!-- The Hour number that the red day number begins on a blood moon day. Setting this to -1 makes the red never show.  -->
<property name="BloodMoonEnemyCount" value="8" />  <!-- This is the number of zombies that can be alive (spawned at the same time) at any time PER PLAYER during a blood moon horde, however, MaxSpawnedZombies overrides this number in multiplayer games. Also note that your game stage sets the max number of zombies PER PARTY. Low game stage values can result in lower number of zombies than the BloodMoonEnemyCount setting. Changing this setting has a huge impact on performance. -->

<!-- Loot -->
<property name="LootAbundance" value="100" />  <!-- percentage in whole numbers -->
<property name="LootRespawnDays" value="30" />  <!-- days in whole numbers -->
<property name="AirDropFrequency" value="72"/>  <!-- How often airdrop occur in game-hours, 0 == never -->
<property name="AirDropMarker" value="false"/>  <!-- Sets if a marker is added to map/compass for air drops. -->

<!-- Multiplayer -->
<property name="PartySharedKillRange" value="100"/>  <!-- The distance you must be within to receive party shared kill xp and quest party kill objective credit. -->
<property name="PlayerKillingMode" value="3" />  <!-- Player Killing Settings (0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone) -->

<!-- Land claim options -->
<property name="LandClaimCount" value="1"/>  <!-- Maximum allowed land claims per player. -->
<property name="LandClaimSize" value="41"/>  <!-- Size in blocks that is protected by a keystone -->
<property name="LandClaimDeadZone" value="30"/>  <!-- Keystones must be this many blocks apart (unless you are friends with the other player) -->
<property name="LandClaimExpiryTime" value="7"/>  <!-- The number of days a player can be offline before their claims expire and are no longer protected -->
<property name="LandClaimDecayMode" value="0"/>  <!-- Controls how offline players land claims decay. 0=Slow (Linear) , 1=Fast (Exponential), 2=None (Full protection until claim is expired). -->
<property name="LandClaimOnlineDurabilityModifier" value="4"/>  <!-- How much protected claim area block hardness is increased when a player is online. 0 means infinite (no damage will ever be taken). Default is 4x -->
<property name="LandClaimOfflineDurabilityModifier" value="4"/>  <!-- How much protected claim area block hardness is increased when a player is offline. 0 means infinite (no damage will ever be taken). Default is 4x -->
<property name="LandClaimOfflineDelay" value="0"/>  <!-- The number of minutes after a player logs out that the land claim area hardness transitions from online to offline. Default is 0 -->


<!-- There are several game settings that you cannot change when starting a new game.
You can use console commands to change at least some of them ingame.
setgamepref BedrollDeadZoneSize 30 -->
</ServerSettings>

保存serverconfig.xml,退出然后启动七日杀服务器

./sdtdserver start 

等待一段时间需要生成地图信息。这里看你服务器的配置。

登录游戏看一下是不是已经成功了,可以通过IP地址登录建议大家在阿里云弄一个VPS,速度快还有独立IP,毕竟我们家里的网络很少有外网独立IP的。

有人是不是不知道如何把自己设置为GM想上天入地ban人该怎么弄?这里大家只需要编辑serveradmin.xml就可以了,不知道在哪吗?

vi .local/share/7DaysToDie/Saves/serveradmin.xml   #添加GM
<?xml version="1.0" encoding="UTF-8"?>
<!--
	 This file holds the settings for who is banned, whitelisted,
   admins and server command permissions.
   Steam ID can be found using http://steamid.co/

   STEAM ID INSTRUCTIONS:
   ===============================================================
   You can find the SteamID64 of any user with one of the following pages:
   https://steamdb.info/calculator/, https://steamid.io/lookup, http://steamid.co/
   http://steamid.co/ instructions:
   Input the player's name in the search field. example: Kinyajuu
   If the name doesn't work, you can also use the url of their steam page.
   Also you may add/remove admins, mods, whitelist, blacklist using in game commands.
   You will want the STEAM64ID. example: 76561198021925107

	 PERMISSION LEVEL INSTRUCTIONS:
   ===============================================================
   permission level : 0-1000, a user may run any command equal to or above their permission level.
   Users not given a permission level in this file will have a default permission level of 1000!

	 COMMAND PERMISSIONS INSTRUCTIONS:
   ===============================================================
   cmd : This is the command name, any command not in this list will not be usable by anyone but the server.
   permission level : 0-1000, a user may run any command equal to or above their permission level.
   Commands not specified in this file will have a default permission level of 0!

  EVERYTHING BETWEEN <!- - and - -> IS COMMENTED OUT! THE ENTRIES BELOW ARE EXAMPLES THAT ARE NOT ACTIVE!!!
-->

<adminTools>
    <admins>
        <admin steamID="76561198021925107" permission_level="0" />  <!-- steamID="改成你的steamID"-->
    </admins>

    <permissions>
        <!-- <permission cmd="dm" permission_level="0" /> -->
        <!-- <permission cmd="kick" permission_level="1" /> -->
        <!-- <permission cmd="say" permission_level="1000" /> -->
        <permission cmd="chunkcache" permission_level="1000" />
        <permission cmd="debugshot" permission_level="1000" />
        <permission cmd="debugweather" permission_level="1000" />
        <permission cmd="getgamepref" permission_level="1000" />
        <permission cmd="getgamestat" permission_level="1000" />
        <permission cmd="getoptions" permission_level="1000" />
        <permission cmd="gettime" permission_level="1000" />
        <permission cmd="gfx" permission_level="1000" />
        <permission cmd="help" permission_level="1000" />
        <permission cmd="listplayerids" permission_level="1000" />
        <permission cmd="listthreads" permission_level="1000" />
        <permission cmd="memcl" permission_level="1000" />
        <permission cmd="settempunit" permission_level="1000" />
    </permissions>

    <!-- ONLY PUT ITEMS IN WHITELIST IF YOU WANT WHITELIST ONLY ENABLED!!! -->
    <!-- If there are any items in the whitelist, the whitelist only mode is enabled -->
    <!-- Nobody can join that ISN'T in the whitelist or admins once whitelist only mode is enabled -->

    <whitelist>
        <!-- <whitelisted steamID="" /> -->
    </whitelist>

    <blacklist>
        <!-- <blacklisted steamID="" unbandate="" /> -->
    </blacklist>
</adminTools>

修改成功后记得重启一下服务器

./sdtdserver restart

好了,现在就可以上天入地ban人了。另外我自己也搭建了一个七日杀服务,大家要是有兴趣一块玩的可以登录183.167.220.248。不过丑话说在前面这个服务器可能随时都会重置,所以大家也就在一起玩不要有太多要求。

类似文章

2条评论

  1. 你好,搭建完了,启动服务器后一直搜索不到。 进入服务器命令控制台看见
    [S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
    Setting breakpad minidump AppID = 251570
    这是什么情况呢。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注