From Valve Developer Community
Revision as of 15:57, 26 July 2013 by Roelof (talk | contribs) (Example script for Linux: Major bug fix in the linux code after more thorough testing)
Jump to: navigation, search
Français Nederlands Polski Русский

The Steam Console Client or SteamCMD is a new tool to install and update dedicated servers using a command line interface. It only works with games that have switched over to the SteamPipe content system. Eventually all Steam games will switch from HLDSUpdateTool to this.

Downloading and Running SteamCMD

1. Download the SteamCMD Update Tool

If you are running a 64-bit Linux distro, you will probably have to install 32-bit libs. See here how to do this.

2. Extract the contents to a directory

Note.png Note: Do not extract the contents of the updater tool to the regular Steam Client folder or to the HLDSUpdateTool folder.
  • Linux: type tar -xvzf steamcmd_linux.tar.gz

3. Launch SteamCMD for the first time

Open a command prompt in that directory and start SteamCmd
  • Windows: type steamcmd
  • Linux: type ./

The program will automatically update and enter you in to a Steam> prompt. Type help for more information.

To download most game servers, you must login anonymously

login anonymous

If logging in anonymously doesn't work for that particular game, you will have to log in with a Steam Account

Note.png Note: You must log out of the regular Steam client in order to properly log in to SteamCMD Update Tool.
login <username>

Enter your password. Then check your e-mail for your Steam Guard access code and enter it (you'll only need to do this once per computer).

You should see a message stating that you have successfully logged in with your account.

Downloading an app

1. Start SteamCMD and set your app install directory. (note: use forward slashes for Linux and backslashes for Windows)

force_install_dir <path>
Example: cs_go directory in the current directory:
force_install_dir ./cs_go/

2. Install or update the app. <app_id> is the Steam Application ID. To also validate the app add validate to the command. To participate in HLDS beta testing add -beta beta to the command. To participate in SRCDS beta testing add -beta prerelease to the command.

app_update <app_id>
Example: install and validate CS:GO:
app_update 740 validate
Example: install and validate beta version of HLDS (CS 1.6):
app_update 90 -beta beta validate
Example: install and validate beta version of CS:S:
app_update 232330 -beta prerelease validate
Example: install and validate CS:CZ:
app_set_config 90 mod czero
app_update 90 validate
Bug.png Bug: HLDS mods currently require multiple installs before the mod's files are installed.

3. Once finished, type quit to properly log off of the Steam servers.

Supported Servers

This is the known list of servers that require steamcmd to install. Any listed extra command line options need to be before the app_update line.

Bug.png Bug: HLDS (appid 90) currently require multiple installs before the game's files are installed.

Note: The + and quotes in the extra command line options aren't needed when using automation as detailed in a later section.

Server ID Extra Command Line options
HLDS for Half-Life and Counter-Strike 90
Counter-Strike: Condition Zero **Beta** dedicated server 90 +app_set_config "90 mod czero"
Deathmatch Classic **Beta** dedicated server 90 +app_set_config "90 mod dmc"
Day of Defeat dedicated server 90 +app_set_config "90 mod dod"
Half-Life: Opposing Force **Beta** dedicated server 90 +app_set_config "90 mod gearbox"
Ricochet **Beta** dedicated server 90 +app_set_config "90 mod ricochet"
Team Fortress Classic **Beta** dedicated server 90 +app_set_config "90 mod tfc"
Counter-Strike: Global Offensive dedicated server 740
The Ship dedicated server 2403
Garry's Mod dedicated server 4020
Serious Sam 3 dedicated server 41080
Nuclear Dawn dedicated server 111710
Red Orchestra: Ostfront 41-45 dedicated server 223240
Red Orchestra 2: Heroes of Stalingrad and Rising Storm dedicated server 212542
Killing Floor Windows dedicated server 215350
Killing Floor Linux dedicated server 215360
Left 4 Dead 2 dedicated server 222860
Team Fortress 2 dedicated server 232250
Day of Defeat: Source dedicated server 232290
Counter-Strike: Source dedicated server 232330
Half-Life 2: Deathmatch dedicated server 232370
Source SDK Base 2013 MP dedicated server 244310
Tip.png Tip: To install multiple mods, separate their names with commas, e.g. +app_set_config 90 mod czero,dod.

Automating SteamCMD

There are two ways to automate SteamCMD. (replace steamcmd with ./ on Linux)

Note.png Note: When using beta on the command line, it must be quoted in a special way, such as +app_update "90 -beta beta"

1. Add commands to the command line. Examples:

steamcmd +login anonymous +force_install_dir ../csgo_ds +app_update 740 validate +quit

To install a specific game mod for HL1, such as Counter-Strike: Condition Zero:

steamcmd +login anonymous +force_install_dir ../czero +app_set_config 90 mod czero +app_update 90 validate +quit

For a game that requires logins, like Killing Floor

steamcmd +login <username> <password> +force_install_dir c:\KFServer\ +app_update 215350 validate +quit

2. Create a script.

a. Put your SteamCMD commands in a text file. Example:
// update_csgo_ds.txt
@ShutdownOnFailedCommand 1 //set to 0 if updating multiple servers at once
@NoPromptForPassword 1
login <username> <password>
//for servers which don't need a login
//login anonymous 
force_install_dir ../csgo_ds
app_update 740 validate
b. Run SteamCMD with the +runscript option. Example:
steamcmd +runscript csgo_ds.txt

Example Batch Code for Windows

:: SteamCMD Guardian 1.2 ::
::       ckynick254      ::
set programname=SteamCMD Guardian 1.1
set servername=
set username=
set password=
::      Your folder      ::
::    Replace after =    ::
set runcmd=E:\Games\

::   End of variables    ::

:: This will keep the window clean and easy to read
@ECHO off

:: Sets the title of the window
title %programname% - %servername%

:: Clears the window incase there is anything there
CD %runcmd%

:: Prints to the window what we are doing
ECHO %programname% has been started!
ECHO   ##############################################################
ECHO   #                    Dedicated Server                        #
ECHO   # 1 - Half-Life: Deathmatch and Counter-Strike               #
ECHO   # 2 - Counter-Strike: Global Offensive                       #
ECHO   # 3 - Nuclear Dawn Dedicated Server                          #
ECHO   # 4 - Red Orchestra Dedicated Server                         #
ECHO   # 5 - Red Orchestra 2: Heroes of Stalingrad Dedicated Server #
ECHO   # 6 - Killing Floor Dedicated Server                         #
ECHO   # 7 - Team Fortress 2 Dedicated Server Beta                  #
ECHO   # 8 - HELP!                                                  #
ECHO   # 9 - Exit                                                   #
ECHO   ##############################################################

:: Delete variable %A%
SET "A="
SET /P A=Set Your Choice And Press Enter: 
ECHO Loading .........
IF "%A%"=="1" set app=90 
IF "%A%"=="2" set app=740
IF "%A%"=="3" set app=111710
IF "%A%"=="4" set app=223240
IF "%A%"=="5" set app=212542
IF "%A%"=="6" set app=215350
IF "%A%"=="7" set app=229830
IF "%A%"=="8" ECHO.
IF "%A%"=="8" ECHO
IF "%A%"=="8" ECHO.
IF "%A%"=="8" PAUSE
IF "%A%"=="8" goto start
IF "%A%"=="9" EXIT

:: This is a return point in case the server crashes or is closed
ECHO (%date%)(%time%) %servername% is now ONLINE
ECHO Watching %servername% for crashes...
>> "%servername%.log" ECHO.
>> "%servername%.log" ECHO (%date%)(%time%) %servername% is now ONLINE
>> "%servername%.log" ECHO (%date%)(%time%) Watching %servername% for crashes...

::Start the actual update window
start /wait steamcmd +login %username% %password% +force_install_dir %runcmd%%app%Server\ +app_update %app% validate
ECHO (%time%) WARNING: srcds closed or crashed, restarting.
ECHO (%date%)(%time%) Crash or Close detected!
ECHO %servername% is now restarting...
>> "%servername%.log" ECHO.
>> "%servername%.log" ECHO (%date%)(%time%) Crash or Close detected!
>> "%servername%.log" ECHO (%date%)(%time%) %servername% is now restarting...

::Server crashed or closed, so we point it to the return point to start the server again
GOTO restart

Example script for Linux

The following script was tested on Debian Wheezy.



#What user you want to use (default: anonymous)

#If you are not using anonymous, specify a password here.

#The default location of the server, relative to this script (default: server).
#If no directory is specified for the server, it'll fall back on this one.
#Don't add a trailing /

#The location of the SteamCMD, relative to this script (default: bin). Don't add a trailing /

#Ids of the servers you want to install, leave empty to skip
#First item is the directory, second item is the AppID. Directory is relative to script directory








#Repeat this and the call to add_game at the bottom of this
#script to add more servers



#	Don't modify below here, unless you know what you're doing.

#Get the current directory (snippet from SourceCMD's
BASE_DIR="$(cd "${0%/*}" && echo $PWD)"

#Relocate downloads to absolute url

if [ -z "$BASE_DIR" -o -z "$INSTALL_DIR" -o -z "$STEAM_DIR" ]; then
	echo "Base directory, Install directory or SteamCMD directory is empty."
	echo "Please check if lines 14 and 17 have content behind the = sign."
	exit 1

if [ ! -e "$STEAM_DIR" ]; then
	if [ "$MADEDIR" != "0" ]; then
		echo "Failed to make directory for Steam. Do you have sufficient priviliges?"
		exit 1
	echo "Fetching SteamCMD from servers..."
	if [ ! -e "$STEAMCMD_TARBALL" ]; then
		echo "ERROR! Failed to get SteamCMD"
		exit 1
	echo "Completed. Extracting file..."
	#Hide the output
	(tar -xvzf $STEAMCMD_TARBALL)
	#Install SteamCMD now and try to login, if required
	if [ "$STEAM_USER" != "anonymous" ]; then
		$STEAM_DIR/ +quit


CmdArgs="+login $STEAM_USER $STEAM_PASS"

	if [ ! -z "$GAME" ]; then
		if [ -z "$DIR" ]; then
		if [ ! -d "$DIR" ]; then
			echo "Creating directory $DIR..."
			(mkdir $DIR)
			if [ ! -d "$DIR" ]; then
		if [ "$OK" == "0" ]; then
			CmdArgs="$CmdArgs +force_install_dir \"$DIR\" +app_update $GAME validate"
			echo "WARNING! Cannot add AppId $GAME into $DIR. Failed to create directory"

add_game "$DL_SV0" "$DL_DIR0"
add_game "$DL_SV1" "$DL_DIR1"
add_game "$DL_SV2" "$DL_DIR2"
add_game "$DL_SV3" "$DL_DIR3"
add_game "$DL_SV4" "$DL_DIR4"
add_game "$DL_SV5" "$DL_DIR5"
add_game "$DL_SV6" "$DL_DIR6"
add_game "$DL_SV7" "$DL_DIR7"

CmdArgs="$CmdArgs +quit"

if [ "$ShouldRun" == "0" ]; then
	echo "ERROR! No game IDs specified. Please specify at least one id"
	exit 1

cd "$BASE_DIR"

#Workaround for SteamCMD continuously re-installing apps
echo "cd \"$BASE_DIR\"" >
echo "$STEAM_DIR/ $CmdArgs" >>
chmod u+x ./

echo "OK! Completed updating files!"

exit 0


To make this script work, we need a location. Preferrably you created a user (e.g. steam) with it's own home directory (/home/steam) and are logged in as it via SSH, tty or using su.

  1. Make the file.
  2. Paste in the code
  3. Modify the code, add at least 1 game to the DL_SV*= rows.
  4. Close the file with Ctrl+O, followed by Enter and concluding with Ctrl+X.
  5. Give the file execute rights for the user
    chmod u+x ./
  6. Run the file

The file will auto-download SteamCMD, update it and install all chosen games (up to 4). Run the file again to update the games.

Known issues

ERROR! Failed to install app 'xxxxxx' (No subscription)

At the moment AppID's 232250, 232290, 232330, 232370 and 244310 must be updated with username anonymous

32-bit libraries on 64-bit Linux systems

Since steamcmd is a 32-bit program, a few 32-bit libraries are required, even if you already have their 64-bit versions installed.

The related error message looks like this:
steamcmd: error while loading shared libraries: cannot open shared object file: No such file or directory

The remedies are distribution-specific:

Debian and derivatives (Ubuntu, Mint)

apt-get install ia32-libs

If you get this error message: The following packages have unmet dependencies: ia32-libs : Depends: ia32-libs-multiarch but it is not installable
E: Unable to correct problems, you have held broken packages.

do the following:

dpkg --add-architecture i386
apt-get update
apt-get install ia32-libs

Red Hat and derivatives (RHEL, Fedora, CentOS)

yum install glibc.i686 libstdc++.i686

Arch Linux

Don't forget to first enable the multilib repository.

pacman -S lib32-gcc-libs

Login Failure: No Connection

On linux servers, you may experience a "Login Failure: No Connection". This is related to missing iptables rules. You will want something along these lines:

iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT

The port list is found here:

On Windows servers, you may experience "SteamUpdater: Error: Download failed: http error 0", this is usually fixed by checking "Automatically detect settings" in IE (Internet Explorer) through the lan settings in the Internet option menu.

1. Open Internet Explorer (IE)

2. Click on Tools > Internet Options

3. click on the "Connections Tab"

4. At the Bottom, you should see "Local Area Network (LAN) Settings".

5. Check the first box "Automatically detect settings"

6. Hit ok, and apply. Try running the SteamCMD again, if it still doesn't work. try lowering your "Internet Security level zone" to medium or lower. You can find that in the "Security" tab in "Internet Options".

SteamCmd startup errors

Ulimit linux startup error

Some users may get ulimit error (no permission/can not open file) while script is starting up. This error caused by low setting of -n-parameter of ulimit. SteamCmd uses standard command inside of shell-script to change ulimit automatically, but some servers may be protected from changing values to custom from different (set by administrator/root). It fixes only with changing ulimit parameter up to 2048: ulimit -n 2048. It may cause error (no permission), so you may need ask root-user to change parameter setting. To check your setting: type ulimit -a, system will reply with many rows, you need to find one:

open files                      (-n) 1024

"1024" is the value of setting in system.