Skip to content

Instantly share code, notes, and snippets.

@nickgrealy
Last active April 29, 2023 03:39
Show Gist options
  • Save nickgrealy/95f25092462965763170d00ed2c9dca1 to your computer and use it in GitHub Desktop.
Save nickgrealy/95f25092462965763170d00ed2c9dca1 to your computer and use it in GitHub Desktop.
Steam > Counter-Strike: Source - Windows Dedicated Server setup - 2016

Last Updated: 1st April, 2016

Steam > Counter-Strike: Source

Windows Dedicated Server setup

Installation / Updating / Running a Server

  1. Download and unzip https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip (link is legit, it's referenced here on Valve's instructions) to the Steam home directory (e.g. C:\Program Files (x86)\Steam\steamapps\common\steamcmd)
  2. Execute the install_update_run_server.bat batch script (below). It will download and install the server, then run the server in a new window on port 27015.
  3. You can now connect to your server, it will be listed under the LAN tab in-game.
  4. Closing the new window, will stop the server.

If you want to install a different server, use an AppId (other than 232330) from the Dedicated Servers List.

If you want to setup up bots (AI players), add the below server.cfg file to the C:\Program Files (x86)\Steam\steamapps\common\css_server\cstrike\cfg\ directory. Update it, and restart your server for changes to take effect - there are plenty more config options documented on forums and youtube videos. Other config files can be modified in this directory, simply remove the _default suffix for files to take effect.

Port Forwarding

I haven't covered port forwarding (i.e. allowing internet users to connect through your firewall). It's pretty straight forward and there are many online resources to find out how to perform this. For reference, I use the following ports - UDP 1200, TCP/UDP 25000 - 25039.

Rcon

From inside the game, once connected to the server, you can open the console ` and type the following to connect and run commands on the server.

rcon_password password123

Now you can issue commands to the server. For example:

rcon bot_quota 20
rcon bot_kill

See Also

# As the sudo user...
# cleanup used space (optional)
sudo yum -y remove mysql-server mysql java aws-apitools-common aws-amitools-ec2 aws-cfn-bootstrapl
sudo yum update -y
sudo yum install glibc.i686 libstdc++.i686 ncurses-libs.i686 -y
sudo rm -Rf /var/cache/yum/x86_64/latest
# setup steam user
sudo useradd -m steam
#sudo -iu steam
# As the Steam user...
# variables
#export SERVER_PASSWORD=replace_me
export install_dir=/home/steam/css_server
export steamcmd_home=/home/steam/steamcmd
export server_cfg=https://gist.githubusercontent.com/nickgrealy/bcd7c4e649dcf8e73308386299689c90/raw/aca611ff69a6d9233d477a3ef092e0b3be032734/server.cfg
export steamcmd_tar=https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
export steam_sdk32=/home/steam/.steam/sdk32
export cfg_file="$install_dir/cstrike/cfg/server.cfg"
# aliases
alias inst='cd $install_dir'
alias cfg='cd $install_dir/cstrike/cfg'
alias steam='cd $steamcmd_home'
mkdir "$steamcmd_home" && cd "$steamcmd_home"
curl -sqL "$steamcmd_tar" | tar zxvf -
# CS:S
"$steamcmd_home/steamcmd.sh" +login anonymous +force_install_dir "$install_dir" +app_update 232330 validate +quit
curl $server_cfg -o "$cfg_file"
sed -i s/password123/$SERVER_PASSWORD/g "$cfg_file"
cat "$cfg_file"
mkdir -p "$steam_sdk32"
ln -s "$install_dir/bin/steamclient.so" "$steam_sdk32/steamclient.so"
# CS:S
"$install_dir/srcds_run" -console -game cstrike +map de_dust -maxplayers 16
wget ...
wget ...
chmod 777 *.sh
cp *.sh /tmp
sudo /tmp/2a_install_linux.sh
sudo chown steam:steam /home/steam
sudo su - steam -c 'export SERVER_PASSWORD=test123; /tmp/2b_install_linux.sh' &
hostname "--== My Awesome Server ==--
mp_timelimit 10
mp_winlimit 5
mp_maxrounds 10
mp_roundtime 9
//mp_autoteambalance 1
//General CS:Source BOT Config v5
echo "Loading CS:Source Bot Configuration Settings..."
//Control how bots talk. Allowed values: 'off', 'radio', 'minimal', or 'normal'.
bot_chatter radio
//Set to 0 to let bots complete map objectives. 0/1
bot_defer_to_human 0
//0 is Easy, 1 is Normal, 2 is Hard, & 3 is Expert.
bot_difficulty 1
//Bots wait for a human to join before joining. 0/1
bot_join_after_player 0
//Add bot(s) to a specific team. any/CT/T or Adds a bot to whichever team has fewer players.
//bot_join_team:
bot_add
//bot_add_ct
//bot_add_t
//Defines a Prefix for all bot's names.
//bot_prefix "AI_"
//Reports on the bots' memory usage
//bot_memory_usage
//Restricts the bots to particular weapons
//bot_knives_only
//bot_pistols_only
//bot_snipers_only
bot_all_weapons
//Weapon Control. 0/1
bot_allow_grenades 1
bot_allow_machine_guns 1
bot_allow_pistols 1
bot_allow_rifles 1
bot_allow_shotguns 1
bot_allow_snipers 1
bot_allow_sub_machine_guns 1
//Bots with high co-op may automatically follow a nearby human player. 0/1
bot_auto_follow 0
//Bots will not buy if their money falls below this amount. Default = 2000
bot_eco_limit "800"
//Bots may occasionally go 'rogue'.
//Rogue bots do not obey radio commands, nor pursue scenario goals. 0/1
bot_allow_rogues 1
//Determines the type of quota. Allowed values: 'normal' and 'fill'.
//If 'fill', the server will adjust bots to keep N players in the game, where N is bot_quota.
bot_quota_mode "fill"
//Bots will automatically leave to make room for human players. 0/1
bot_auto_vacate 1
//Set to min # of bots allowed on server
bot_quota 10
// sv_password "the_server_password"
// rcon_address
rcon_password "password123"
# As the sudo user...
# automatically shutdown server at 2am N.B. THIS DOES NOT TERMINATE THE INSTANCE!!!
#sudo shutdown -P 2:00 &
# cleanup used space (optional)
sudo yum -y remove mysql-server mysql java aws-apitools-common aws-amitools-ec2 aws-cfn-bootstrapl
sudo yum update -y
sudo yum install glibc.i686 libstdc++.i686 ncurses-libs.i686 -y
sudo rm -Rf /var/cache/yum/x86_64/latest
# setup steam user
sudo useradd -m steam
#sudo -iu steam
# As the Steam user...
# variables
export SERVER_PASSWORD=replace_me
export install_dir=/home/steam/css_server
export steamcmd_home=/home/steam/steamcmd
export server_cfg=https://gist.githubusercontent.com/nickgrealy/bcd7c4e649dcf8e73308386299689c90/raw/aca611ff69a6d9233d477a3ef092e0b3be032734/server.cfg
export steamcmd_tar=https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
export steam_sdk32=/home/steam/.steam/sdk32
export cfg_file="$install_dir/cstrike/cfg/server.cfg"
# aliases
alias inst='cd $install_dir'
alias cfg='cd $install_dir/cstrike/cfg'
alias steam='cd $steamcmd_home'
mkdir "$steamcmd_home" && cd "$steamcmd_home"
curl -sqL "$steamcmd_tar" | tar zxvf -
# CS:S
"$steamcmd_home/steamcmd.sh" +login anonymous +force_install_dir "$install_dir" +app_update 232330 validate +quit
# CS:GO
#"$steamcmd_home/steamcmd.sh" +login anonymous +force_install_dir "$install_dir" +app_update 740 validate +quit
curl $server_cfg -o "$cfg_file"
sed -i s/password123/$SERVER_PASSWORD/g "$cfg_file"
cat "$cfg_file"
mkdir -p "$steam_sdk32"
ln -s "$install_dir/bin/steamclient.so" "$steam_sdk32/steamclient.so"
# CS:S
"$install_dir/srcds_run" -console -game cstrike +map de_dust -maxplayers 16
# CS:GO
# Classic Casual:
# srcds -game csgo -console -usercon +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2
# Classic Competitive:
# srcds -game csgo -console -usercon +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2
# Arms Race:
# srcds -game csgo -console -usercon +game_type 1 +game_mode 0 +mapgroup mg_armsrace +map ar_shoots
# Demolition:
# srcds -game csgo -console -usercon +game_type 1 +game_mode 1 +mapgroup mg_demolition +map de_lake
# Deathmatch:
# srcds -game csgo -console -usercon +game_type 1 +game_mode 2 +mapgroup mg_allclassic +map de_dust
REM Setup...
set install_dir=C:\Program Files (x86)\Steam\steamapps\common\css_server
set steamcmd_home=C:\Program Files (x86)\Steam\steamapps\common\steamcmd
mkdir "%install_dir%"
REM Install Counter-Strike: Source server...
"%steamcmd_home%\steamcmd.exe" +login anonymous +force_install_dir "%install_dir%" +app_update 232330 validate +quit
REM Start Counter-Strike: Source server...
"%install_dir%\srcds.exe" -console -game cstrike +map de_dust -maxplayers 16 -autoupdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment