Ricky Hao

Linux 下 搭建CSGO服务器

首先,我们得需要一个服务器。这里我用的是阿里云的服务器,双核4G,Centos 7.0 x64

然后,在根目录创建一个文件夹

mkdir steamcmd

创建一个专门给SteamCMD用的用户

useradd -m steam
su - steam

接下来,进入cd steamcmd,下载SteamCMD安装包和依赖包

因为我是64位服务器,所以我下载的依赖包是

yum install glibc.i686 libstdc++.i686

如果是32位服务器,那么就

yum install glibc libstdc++

然后,下载安装包

wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz

解压

tar -zvxf steamcmd_linux.tar.gz

运行

./steamcmd.sh

进入steam界面之后,先登录

login anonymous

你也可以把anonymous换成自己账号登录

下载csgo服务器

app_update 740 validate

以后若是要更新服务器,只要

app_update 740

就够了。

下载完毕之后,我们cd ~回到用户根目录
创建链接到csgo目录的软连接

ln -s ~/steam/steamapps/common/"Counter-Strike Global Offensive Beta - Dedicated Server" ~/csgo_server

这样,我们就可以从用户根目录下的csgo_server访问服务端根目录了。

接下来,进入~/csgo_server/csgo/bin/cfg,在里面创建一个server.cfg文件,内容如下

hostname "yourhostname"
rcon_password "yourOPpassword"
sv_password "yourpassword"

mp_freezetime 5     //The amount of time players are frozen to buy items
mp_join_grace_time 15     //The amount of time players can join teams after a round has started
mp_match_end_restart 0     // Defines whether a map should be restarted after a game has ended 
sv_cheats 0     //This should always be set, so you know it's not on
sv_lan 0     //This should always be set, so you know it's not on

//**The bot commands below are mostly default with the exception of 
bot_difficulty 3
bot_chatter "off"
bot_join_after_player 1
bot_quota 10
bot_quota_mode "fill"

//**The following commands manage kicks and bans
writeid
writeip
exec banned_user.cfg
exec banned_ip.cfg

保存,回到~/csgo_server目录。
开启服务器

Classic Casual(经典休闲模式):

./srcds_run -game csgo -console -usercon +ip 0.0.0.0 +game_type 0 +game_mode 0 +mapgroup mg_bomb +map de_dust

Competitive(经典竞技模式):

./srcds_run -game csgo -console -usercon +ip 0.0.0.0 +game_type 0 +game_mode 1 +mapgroup mg_bomb +map de_dust

Arms Race(军备竞赛模式):

./srcds_run -game csgo -console -usercon +ip 0.0.0.0 +game_type 1 +game_mode 0 +mapgroup mg_armsrace +map ar_shoots

Demolition(爆破模式):

./srcds_run -game csgo -console -usercon +ip 0.0.0.0 +game_type 1 +game_mode 1 +mapgroup mg_demolition +map de_lake

也可以建立bash脚本来快速启动,比如armsrace.sh

#!/bin/bash
cd csgo_server
./srcds_run -game csgo -console -usercon +ip 0.0.0.0 +game_type 1 +game_mode 0 +mapgroup mg_armsrace +map ar_shoots

接下来,可以给服务器安装插件,比如著名的SourceMod和MMSource
下载SourceMod
下载MMSource

然后上传到服务器,解压,并把其中的所有东西移动到~/csgo_server/csgo/里面即可。
重启服务器就能够打开插件。进入游戏输入!admin启用。
如果提示权限不足,那么打开游戏内控制台(~),输入status来查看自己的SteamID
然后编辑

vi ~/csgo_server/csgo/addons/sourcemod/configs/admins_simple.ini

在最下面添加一行

"yourSteamID"            "z"

这里z代表最高权限,可以根据需要来改变。完成之后重启服务器就行了。

最后附上两个插件

皮肤商店插件(Weapon Paints)
下载地址
游戏内输入!ws换皮肤

没有时间限制的皮肤插件(请先安装原版)
下载地址

刀子商店插件(Knife Shop)
下载地址
游戏内输入!knife换刀

安装方法
解压后把.smx后缀的放到plugins文件夹
.sp放到scripting文件夹
.txt放到translations文件夹
.cfg放到configs文件夹
重启服务器

点赞

发表回复

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

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据