使用LinuxGSM搭建CSGO服务器

安装Linuxgsm

脚本来源Linuxgsm官方网站:https://linuxgsm.com/servers/csgoserver/

提前申请服务器令牌

有一串令牌字符我们安装需要使用到

提前安装好依赖

并放行以下端口:27015,27005,27020  TCP及UDP协议

yum install epel-release nmap-ncat
yum install mailx postfix curl wget tar bzip2 gzip unzip python3 binutils bc jq tmux glibc.i686 libstdc++ libstdc++.i686

创建csgo专用账户,请勿使用root账户进行部署

adduser csgo - -创建csgo账户
passwd csgo - - 修改csgo用户密码

执行LinuxGSM部署脚本(此处可能会涉及github访问,建议使用代理下载)

cd /csgo --进入你准备安装到的目录
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csgoserver
./csgoserver install

如果不是你想要的目录的话,记得选N

=================================

Server Directory
=================================
/csgo
Continue? [Y/n] Y

 

脚本自动安装CSGO本体时会比较慢,很大这个时间可以干点别的

Installing SteamCMD
=================================
######################################################################## 100.0%
extracting steamcmd_linux.tar.gz...OK

Installing Counter-Strike: Global Offensive Server
Connecting anonymously to Steam Public...Connectivity test: result=Connected, in progress=0
OK
Waiting for client config...OK
Waiting for user info...OK
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x11) preallocating, progress: 94.05 (29226955610 / 31077047056)
 Update state (0x61) downloading, progress: 0.07 (21562683 / 31077047056)
 Update state (0x61) downloading, progress: 0.18 (55538064 / 31077047056)

 

安装完之后一路YES就行了

Was the install successful? [Y/n] Y

Downloading Counter-Strike: Global Offensive Configs
=================================
default configs from https://github.com/GameServerManagers/Game-Server-Configs
copying server.cfg config file.
"/csgo/lgsm/config-default/config-game/server.cfg" -> "/csgo/serverfiles/csgo/cfg/csgoserver.cfg"
changing hostname.
changing rcon/admin password.

Config File Locations
=================================
Game Server Config File: /csgo/serverfiles/csgo/cfg/csgoserver.cfg
LinuxGSM Config: /csgo/lgsm/config-lgsm/csgoserver
Documentation: https://docs.linuxgsm.com/configuration/game-server-config

Game Server Login Token
=================================
GSLT is required to run a public Counter-Strike: Global Offensive server
Get more info and a token here:
https://docs.linuxgsm.com/steamcmd/gslt

Enter token below (Can be blank).
GSLT TOKEN: XXXXX (这里填你在steam申请的令牌)
The GSLT can be changed by editing /csgo/lgsm/config-lgsm/csgoserver/csgoserver.cfg.


LinuxGSM Stats
=================================
Assist LinuxGSM development by sending anonymous stats to developers.
More info: https://docs.linuxgsm.com/configuration/linuxgsm-stats
The following info will be sent:
* game server
* distro
* game server resource usage
* server hardware info
Allow anonymous usage statistics? [Y/n] n

=================================
Install Complete!

To start server type:
./csgoserver start

[csgo@localhost csgo]$ 

 

安装MetaMod和SourceMod插件

[csgo@localhost csgo]$ ./csgoserver mods-install 执行这条命令

Counter-Strike: Global Offensive Installing mods
=================================
Available addons/mods
=================================
Metamod: Source - Plugins Framework - https://www.sourcemm.net
 * metamodsource
SourceMod - Admin Features (requires Metamod: Source) - http://www.sourcemod.net
 * sourcemod
SteamWorks - Exposing SteamWorks functions to SourcePawn - https://github.com/KyleSanderson/SteamWorks
 * steamworks
GOKZ - Implements the KZ game mode (requires SourceMod and MetaMod) - https://bitbucket.org/kztimerglobalteam/gokz/src/master/
 * gokz
Trouble in Terrorist Town - Implements the TTT game mode (requires SourceMod and MetaMod) - https://github.com/Bara/TroubleinTerroristTown
 * ttt
Get 5 - Plugin for competitive matches/scrims (requires SourceMod and MetaMod) - https://github.com/splewis/get5
 * get5
csgo practice mode - Practice Mode is a sourcemod plugin for helping players/teams run practices. - https://github.com/splewis/csgo-practice-mode
 * prac
PUG - plugin for setting up private pug/10man games - https://github.com/splewis/csgo-pug-setup
 * pug
dhook - DHooks 2.2.0 - Required for GOKZ - https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589
 * dhook
movementapi - Movement API 2.1.0 - Required for GOKZ - https://github.com/danzayau/MovementAPI
 * movementapi
cleaner - Console Cleaner - Optional for GOKZ - https://github.com/e54385991/console-cleaner
 * cleaner

Enter an addon/mod to install (or exit to abort): 选你需要的模组,我们这边要metamodsource和sourcemod

这里也有其他模组可以提供,看自己想开什么服,自行选择吧,英文有注释的了,具体自行机翻下即可

将你自己的steamID加入到管理员组

echo '"STEAM_0:1:95902511" "99:z"' >> /你的安装目录/csgoserver/serverfiles/csgo/addons/sourcemod/configs/admins_simple.ini

这个ID的格式应该是这样子的:STEAM_0:1:XXXXXX 可以在 https://steamid.io 中查询自己的ID。

修改服务器tickrate 模式 地图等

cd /你的安装目录/lgsm/config-lgsm/csgoserver/
cat _default.cfg > csgoserver.cfg
[csgo@localhost csgoserver]$ vim csgoserver.cfg - -最下面的gslt别忘记填了

##################################
######## Default Settings ########
##################################
# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
# Copy settings from here and use them in either:
# common.cfg - applies settings to every instance.
# [instance].cfg - applies settings to a specific instance.

#### Game Server Settings ####

## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
# https://docs.linuxgsm.com/game-servers/counter-strike-global-offensive
# [Game Modes]                  gametype        gamemode        mapgroup (you can mix these across all Game Modes except Danger Zone, but use only one)
# Arms Race                             1                       0                       mg_armsrace
# Classic Casual                0                       0                       mg_casualsigma, mg_casualdelta
# Classic Competitive   0                       1                       mg_active, mg_reserves, mg_hostage, mg_de_dust2
# Custom                                3                       0
# Deathmatch                    1                       2                       mg_deathmatch
# Demolition                    1                       1                       mg_demolition
# Wingman                               0                       2
# Danger Zone                   6                       0                       mg_dz_blacksite (map: dz_blacksite), mg_dz_sirocco (map: dz_sirocco)
gametype="0"
gamemode="0"
mapgroup="mg_active"
ip="0.0.0.0"
port="27015"
clientport="27005"
sourcetvport="27020"
steamport="26901"
defaultmap="de_mirage"
maxplayers="16"
tickrate="128"

## Game Server Login Token (GSLT): Required
# GSLT is required for running a public server.
# More info: https://docs.linuxgsm.com/steamcmd/gslt
gslt="XXXXXX"

 

 

然后启动服务器即可

./csgoserver start - -启动命令
./csgoserver update - -如果csgo客户端更新了,服务端记得也要更新
./csgoserver restart - -修改完配置文件用这个重启

配件文件目录
/安装目录/lgsm/config-lgsm/csgoserver/csgoserver.cfg - -修改模式 游戏的端口、地图、tick
/安装目录/serverfiles/csgo/cfg/csgoserver.cfg - -修改服务端配置文件 管理员密码、作弊开关等

 

发表回复

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