静看光阴荏苒
不管不顾不问不说也不念

Debian10搭建CS1.6服务器

我大概两年前水过一篇CS1.6服务器搭建的文章,不过随着时间的推移,那篇文章里面的很多东西都失效了。

最近打算弄一个僵尸服玩玩,这里先把最基础的东西配置好,做个记录。僵尸相关的配置后面再写文章详细说吧。

系统是Debian10 X64,这里我选择用包管理器安装steamcmd,然后用steamcmd去搭建cs1.6的server。

首先安装一些常用的工具,这里尽量多安装几个解压工具,后面你安装各种cs插件的时候需要解压各种格式的安装包:

apt -y update
apt -y install sudo unzip unar p7zip-full

新建一个名为steam的用户:

useradd -m -s /bin/bash steam

修改密码:

passwd steam

把用户加到sudo:

adduser steam sudo

然后我们切到steam用户下:

su - steam

编辑Debian的源配置文件:

sudo apt edit-sources

你需要在软件源后面加上non-free标志,这样才能安装到一些被debian认为是非免费的软件,steamcmd这个软件属于非免费的范畴。

配置示例:

deb http://deb.debian.org/debian/ buster main non-free
deb-src http://deb.debian.org/debian/ buster main non-free

deb http://security.debian.org/debian-security buster/updates main non-free
deb-src http://security.debian.org/debian-security buster/updates main non-free

deb http://deb.debian.org/debian/ buster-updates main non-free
deb-src http://deb.debian.org/debian/ buster-updates main non-free

64位系统还需要添加多架构支持:

sudo dpkg --add-architecture i386

做完上面这些之后就可以安装steamcmd了:

sudo apt update
sudo apt -y install libsdl2-2.0-0:i386
sudo apt -y install steamcmd

做一个软链接方便日常使用:

ln -s /usr/games/steamcmd steamcmd

执行下面的命令启动steamcmd:

steamcmd

在steamcmd的命令行内执行下面的命令登录匿名用户(用于下载游戏服务端文件)

login anonymous

在steamcmd的命令行内执行下面的命令把游戏服务端文件安装到cs16_server:

force_install_dir ./cs16_server/

在steamcmd的命令行内执行下面的命令开始下载并安装服务端:

app_set_config 90 mod cstrike
app_update 90 validate

编辑如下配置文件:

nano /home/steam/.steam/steamcmd/cs16_server/cstrike/server.cfg

在里面添加如下配置来设置你的OP密码(服务器管理员密码:)

rcon_password "imlala"

新建systemd服务文件:

sudo nano /lib/systemd/system/csserver.service

写入如下配置:

[Unit]
Description=cs 1.6 server

[Service]
Type=simple
User=steam
Group=steam
WorkingDirectory=/home/steam/.steam/steamcmd/cs16_server
ExecStart=/usr/bin/bash hlds_run -game cstrike +port 27015 +map de_dust2 +maxplayers 32
Restart=always

[Install]
WantedBy=multi-user.target

启动服务器以及设置开机自启:

sudo systemctl start csserver
sudo systemctl enable csserver

由于steamcmd的bug,有时候你的服务端文件可能下载不完整导致启动不了,一般情况下是缺少一个steamclient.so,解决办法如下:

mkdir -p /home/steam/.steam/sdk32
ln -s /home/steam/.steam/steamcmd/linux32/steamclient.so /home/steam/.steam/sdk32
ln -s /home/steam/.steam/steamcmd/linux32/steamclient.so /home/steam/.steam/steamcmd/cs16_server

做好上面这些配置后重启:

sudo systemctl restart csserver

接下来我们需要破解服务端,从steamcmd安装的服务端都是原版(正版)。只有在steam上买过cs的用户才能连接。

以前破解服务端我都是喜欢用dproto插件,但是很不幸这个插件的作者已经很久没更新了而且现在已经失效。

取而代之的是我们可以选择用Rehlds+Reunion。Reunion是一个插件,作用和dproto一样,只不过它还额外需要Rehlds的支持。

提到这些东西了那就不得不提一下metamod,因为不管是什么插件要想正常运行的话都离不开metamod的支持,你可以把metamod当作是一款HL的插件管理器,也可以把它比作是HL和插件之间的桥梁。

由于metamod官方很久都没有发布过新版本了,很多功能或是bug都没有修,所以现在有很多非官方的版本。哪怕在两年前我那篇文章也是用的metamod-p,而最近我又发现一款metamod-r,这里强烈推荐。

这些工具我都会给出官方的下载地址,当然有些工具的官方网站不好注册,我这里为了方便也打包了一份。

https://github.com/theAsmodai/metamod-r # metamod优化版
https://github.com/dreamstalker/rehlds # rehlds的项目页面
http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/rehlds/rehlds/ # rehlds编译好的二进制文件
http://www.dedicated-server.ru/vbb/showthread.php?t=26486 # reuninon插件的发布页面
https://cs.rin.ru/forum/viewtopic.php?f=10&t=69235 # reuninon英语发布页面

reunion的发布网账号不好注册,我的备份:

reunion_0.1.92

那么首先我们来安装metamod-r。

创建如下目录:

mkdir -p /home/steam/.steam/steamcmd/cs16_server/cstrike/addons/metamod/dlls

下载metamod-r/解压/进入到目录内:

wget https://github.com/theAsmodai/metamod-r/releases/download/1.3.128/metamod_1.3.0.128.zip
unzip metamod_1.3.0.128.zip -d metamod-1.3.0.128
cd metamod-1.3.0.128/addons/metamod

把metamod_i386.so复制到我们刚创建的dll目录下:

cp metamod_i386.so /home/steam/.steam/steamcmd/cs16_server/cstrike/addons/metamod/dlls

然后编辑liblist.gam文件:

nano /home/steam/.steam/steamcmd/cs16_server/cstrike/liblist.gam

修改如下位置:

gamedll_linux "addons/metamod/dlls/metamod_i386.so"

metamod-r就安装完成了。接下来我们需要安装Rehlds。

下载Rehlds/解压/进入到目录内:

wget http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/rehlds/rehlds/3.7.0.693-dev/rehlds-3.7.0.693-dev.zip
unzip rehlds-3.7.0.693-dev.zip -d rehlds-3.7.0.693-dev
cd rehlds-3.7.0.693-dev/bin/linux32

直接替换掉原始服务端的engine_i486.so即可完成安装:

cp -f engine_i486.so /home/steam/.steam/steamcmd/cs16_server/engine_i486.so

最后我们来安装reunion。还是和之前一样下载安装包/解压/进入到目录内:

wget https://lala.im/wp-content/uploads/2020/09/reunion_0.1.92.zip
unzip reunion_0.1.92.zip -d reunion_0.1.92
cd reunion_0.1.92/

复制reunion.cfg到cs16_server目录:

cp reunion.cfg /home/steam/.steam/steamcmd/cs16_server

创建reunion目录,然后把reunion_mm_i386.so复制过去:

mkdir -p /home/steam/.steam/steamcmd/cs16_server/cstrike/addons/reunion
cp bin/Linux/reunion_mm_i386.so /home/steam/.steam/steamcmd/cs16_server/cstrike/addons/reunion

编辑metamod的插件配置文件:

nano /home/steam/.steam/steamcmd/cs16_server/cstrike/addons/metamod/plugins.ini

在里面写入如下配置:

linux addons/reunion/reunion_mm_i386.so

重启一下游戏服务:

sudo systemctl restart csserver

至此一个基本的CS1.6服务端就架好了,我们可以连接测试看看:

赞(7)
未经允许不得转载:荒岛 » Debian10搭建CS1.6服务器
分享到: 更多 (0)

评论 11

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    我来辣 :shock: :shock:

    Fcat4年前 (2020-09-10) Microsoft Edge 85.0.564.44 Microsoft Edge 85.0.564.44 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    test

    test4年前 (2020-09-10) Google Chrome 84.0.4147.105 Google Chrome 84.0.4147.105 GNU/Linux x64 GNU/Linux x64回复
  3. #3

    那么啥时候我们来一局 :oops:

    橘子4年前 (2020-09-10) Google Chrome 81.0.4044.110 Google Chrome 81.0.4044.110 Windows 10 Windows 10回复
    • 阔以,等我搭建好,还有一点东西没调好。

      LALA4年前 (2020-09-13) Google Chrome 80.0.3987.163 Google Chrome 80.0.3987.163 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    是魔兽版的吧

    sooele4年前 (2020-09-10) Microsoft Edge 85.0.564.44 Microsoft Edge 85.0.564.44 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 不是,是最经典的ZP版本。

      LALA4年前 (2020-09-13) Google Chrome 80.0.3987.163 Google Chrome 80.0.3987.163 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    你好,rehlds-3.7.0.693下载链接失效了,能否把文件发邮件给我呢?提前感谢。

    Stephen2年前 (2021-12-30) Google Chrome 96.0.4664.110 Google Chrome 96.0.4664.110 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    请问,如何更改游戏服务器里金钱800变为16000?人数从32更改为20呢?提前感谢。

    Stephen2年前 (2021-12-31) Google Chrome 96.0.4664.110 Google Chrome 96.0.4664.110 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 金钱800改16000,编辑服务器配置文件:server.cfg,加入这个参数:mp_startmoney 16000
      人数从32改20,可以修改systemd服务的配置文件:/lib/systemd/system/csserver.service。
      里面有一个参数是maxplayers 32,改为20然后重启systemd服务:systemctl daemon-reload && systemctl restart csserver

      LALA2年前 (2022-01-02) Google Chrome 96.0.4664.93 Google Chrome 96.0.4664.93 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿