Skip to content

henkoch/cs2_server

Repository files navigation

csgo_server

Introduction

Purpose

Hold the scripts for deploying a private CS GO server in a VM.

Supported environments:

  • libvirt/kvm

Vocabulary

  • CLI - command line interface.
  • csgo - Counter Strike Global Offence.
  • GSLT - Game Server Login Token.
  • steamcmd - steam CLI client.

References

Overview

Usage

using rcon

Steps:

  • enable 'in-game developer console'
    • How to Use RCON on a Counter-Strike: GO Server
    • n the Game Settings, locate the Enable Developer Console setting and set this to Yes.
  • press ~
  • rcon_password <var.csgo_server_rcon_password>
  • rcon_status

Manually start the csgo server

  • login to the VM
  • sudo -i
  • su - steam
  • ~/csgo_git_repo/csgo_scripts/run_cs2_server.sh

Manually installing the csgo server

  • ssh in as ansible
  • sudo -
  • su - steam
  • cd ~/csgo_app
  • export LD_LIBRARY_PATH=/home/steam/steamcmd/linux32
  • time steamcmd +force_install_dir ~/csgo_app/ +login STEAM_LOGIN STEAM_PASSWORD +app_update 730 validate +quit ~ 145 minutes.

Example of deployment script

call it 'private_deploy_azure.sh'

the .gitignore has been set-up to ignore files starting with 'private_'.

#!/usr/bin/bash

terraform apply \
          -var csgo_client_access_password="AccessPassword"\
          -var csgo_server_rcon_password="RemoteConsolePassword"\
          -var csgo_one_for_local_zero_for_global="0"\
          -var csgo_server_name="MyServerName"\
          -var csgo_steam_server_token="The_GLST_TokenIHaveFromSteam"

To get the GLST see: Steam Game Server Account Management

Example of the azure private variables

  • azure_subscription_id - az account show --query id -o tsv

the following info is generated from az ad sp create-for-rbac --name terraform_op --role Contributor --scopes /subscriptions/$subscriptionID/resourceGroups/$resourceGroup

  • azure_csgo_tenant_id - tenant
  • client_id - appId
  • client_secret - password

Store this file as 'private_variables.tf' in the azure_cloud directory, with the other .tf files.

variable azure_subscription_id {
  type        = string
  description = ""
  default = "xxxx"
}

variable azure_csgo_tenant_id {
  type        = string
  description = "azure tenant id for the csgo group"
  default = "xxxx"
}
variable client_id {
  type        = string
  description = ""
  default = "xxx"
}
variable client_secret {
  type        = string
  description = ""
  default = "xxxx"
}


variable my_public_ip {
  type        = string
  description = "the public ip address of my local machine"
  default = "MY_PUBLIC_IP_FROM_MY_ISP"
}

# ssh-keygen -t rsa -b 2048  -q -f private_admin_id_rsa
# cat private_admin_id_rsa.pub
variable admin_public_ssh_key {
  type        = string
  description = "the public ssh key for the admin account"
  default = "ssh-rsa xxx"
}

Deploy to a local libvirt VM

  • git clone https://github.com/henkoch/csgo_server.git
  • cd csgo_server/terraform
  • make base
    • This will download an ubuntu cloud image and expand it to 10GB.
  • ./deploy_to_libvirt.sh
  • ssh -i tf-cloud-init ansible@VM_IP_ADDR

Deploy a local docker image

Please see the Dockerfile

Installation instructions

Install csgo server

configure the csgo server

  • export LD_LIBRARY_PATH=/usr/lib32:/data/steam/csgo/bin

  • /data/steam/csgo_app/srcds_linux --version

  • /data/steam/csgo_app/srcds_linux -game csgo -usercon -net_port_try 1 -tickrate 128 -nobots +game_type 0 +game_mode 1 +mapgroup mg_active +map de_mirage

csgo docker image

  • cm2network/steamcmd

  • docker build --tag csgo:0.1.3 .

  • mkdir ~/Downloads/steam_data

  • docker run -it --volume ${HOME}/Downloads/steam_data:/data/steam/Steam --volume ${HOME}/Downloads/csgo_app:/data/steam/csgo_app --volume ${HOME}/Dropbox/Sources/Servers/csgo_server/csgo_scripts:/data/steam/csgo_scripts csgo:0.1.3 bash

    • TODO put this as a copy in the Dockerfile, once this works
  • su - steam

  • /usr/games/steamcmd +force_install_dir /data/steam/csgo_app/ +login anonymous +app_update 740 validate +quit

    • currently it downloads about 33GB of data.

CSGO configuration

Files of interest

Maps

  • Map name prefix seems to indicate the type of game it becomes

    • cs_ - Hostage/Rescue (original counter-strike mode)
    • de_ - demolition? or is it deathmatch?
    • ar_ - arms race?
    • dz_ - dangerzone
  • TODO can I use this command to switch mode? map <mapname> survival

    • changelevel dz_blacksite survival
  • You can mix rescue and demolition, but not arms race.

Parameters of interest

  • mp_maxrounds
    • 5 ?
    • set the win limit to the same
  • mp_friendlyfire
  • mp_roundtime
  • mp_timelimit
  • mp_allowNPCs
  • mp_teams_unbalance_limit
  • mp_respawnwavetime
  • mp_roundtime_hostage
  • mp_freezetime
    • 6
      • seconds from start of game until you can move, gives older players some help.
    • 10 seconds feels too long.
  • ?? warmuptime, 60
    • to give slower load machines a change to get in, until the game actually starts.
  • mp_disable_respawn_times
  • mp_disable_respawn_times
  • mp_friendlyfire
  • mp_limitteams
  • mp_teamplay
  • mp_autoteambalance

About

Set-up a private CS:GO server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published