CSGO服务器搭建

CSGO服务器搭建

  1. 创建并进入steamcmd文件夹

    1
    2
    mkdir steamcmd
    cd steamcmd
  2. 下载并安装steamcmd

    1
    2
    3
    4
    sudo yum install -y glibc.i686 libstdc++.i686 #RedHat系安装依赖库
    sudo apt install lib32stdc++6 #Debian系安装依赖库
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
    tar zxvf steamcmd_linux.tar.gz
  3. 安装CSGO服务器

    1
    ./steamcmd.sh +force_install_dir ~/csgo-ds +login anonymous +app_update 740 +quit
  4. 下载并安装插件

    Sourcemod
    https://www.sourcemod.net/
    Metamod
    https://www.sourcemm.net/
    皮肤插件依赖
    https://ptah.zizt.ru/
    皮肤
    https://github.com/kgns/weapons/releases/latest
    手套
    https://github.com/kgns/gloves/releases/latest
    贴纸
    https://forums.alliedmods.net/showthread.php?t=327078
    白名单插件
    https://forums.alliedmods.net/showthread.php?p=1830686
    十人竞技服务器插件
    https://github.com/splewis/csgo-pug-setup/releases/latest
    multi1v1(1v1服务器插件)
    https://github.com/splewis/csgo-multi-1v1
    记录连接
    https://forums.alliedmods.net/showthread.php?t=201967

  5. 修改服务器配置文件

    csgo-ds/csgo/cfg/server.cfg

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    //sv_talk_enemy_dead 1
    //sv_talk_enemy_living 1
    //sv_alltalk 1
    sv_region 255
    hostname "Wed0nCSGO"
    mp_autokick 0
    sv_allow_votes 1
    bot_difficulty 0
    sv_vote_issue_kick_allowed 0
    mp_limitteams 0
    mp_autoteambalance 0

    csgo-ds/csgo/addons/sourcemod/configs/admins_simple.ini

    1
    "STEAM_X:X:XXXXXXXX" "99:z" //第一项填入steamID,第二项填入权限z为最高权限 关于其它权限,该文件内有详细的文档参考

    csgo-ds/csgo/addons/sourcemod/configs/core.cfg

    1
    "FollowCSGOServerGuidelines"	"yes" //必须将yes改为no才能使用皮肤插件

    csgo-ds/csgo/cfg/sourcemod/weapons.cfg

    1
    sm_weapons_chat_prefix "[oyunhost.net]" //修改为ws

    csgo-ds/csgo/cfg/sourcemod/gloves.cfg

    1
    sm_gloves_chat_prefix "[oyunhost.net]" //修改为glove

    白名单的路径为csgo-ds/csgo/addons/sourcemod/configs/whitelist/whitelist.txt
    完成配置后在聊天框输入
    !ws 换皮肤
    !knife 换刀
    !glove 换手套

  6. 编写服务器脚本

    1
    2
    3
    4
    #启动脚本
    #密钥在https://steamcommunity.com/dev/managegameservers处申请
    #申请时 App ID:730,备忘录:随意
    ~/csgo-ds/srcds_run -game csgo -console -usercon +game_type 1 +game_mode 2 +sv_game_mode_flags 32 +map de_dust2 -maxplayers_override 10 +sv_setsteamaccount XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    1
    2
    3
    #备份脚本
    cd ~/csgo-ds/csgo
    tar -Jcvf ~/backup_csgo_$(date '+%Y%m%d%H%M%S').tar.xz addons/sourcemod/configs/ addons/sourcemod/data/ cfg/ --exclude=addons/sourcemod/configs/geoip/GeoLite2-City.mmdb
    1
    2
    3
    #常用服务器控制台命令
    sm_reloadadmins #重新加载管理员配置文件
    sm_whitelist_reload #重新加载白名单配置文件

参考链接

SteamCMD文档
CSGO服务器文档
CSGO游戏模式文档