SteamCMD: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎Automating SteamCMD: removed code indentation since it's broken and only worsens readability)
Line 54: Line 54:


1. Add commands to the command line. Examples:
1. Add commands to the command line. Examples:
: <syntaxhighlight>steamcmd +login anonymous +force_install_dir ../csgo_ds +app_update 740 validate</syntaxhighlight>
steamcmd +login anonymous +force_install_dir ../csgo_ds +app_update 740 validate
: <syntaxhighlight>steamcmd +login user password +force_install_dir c:\KFServer\ +app_update 215350 validate</syntaxhighlight>
 
steamcmd +login user password +force_install_dir c:\KFServer\ +app_update 215350 validate


2. Create a script.
2. Create a script.
: a. Put your SteamCMD commands in a text file. Example:
: a. Put your SteamCMD commands in a text file. Example:
<syntaxhighlight>
<syntaxhighlight>
// update_csgo_ds.txt
// update_csgo_ds.txt
Line 70: Line 70:


: b. Run SteamCMD with the <code>+runscript</code> option. Example:
: b. Run SteamCMD with the <code>+runscript</code> option. Example:
:: <syntaxhighlight>steamcmd +runscript csgo_ds.txt</syntaxhighlight>
steamcmd +runscript csgo_ds.txt


=== Protect your AccountLogin with gpg under Linux ===
=== Protect your AccountLogin with gpg under Linux ===
Write your loginscript like the example and save the file as ''update_csgo_ds.txt''. You have to encrypt with gpg the textfile with a symmetric encryption:
Write your loginscript like the example and save the file as ''update_csgo_ds.txt''. You have to encrypt with gpg the textfile with a symmetric encryption:
<syntaxhighlight>
gpg -c --force-mdc update_csgo_ds.txt
gpg -c --force-mdc update_csgo_ds.txt
# enter your password
# enter your password
# the new encrypted file update_csgo_ds.txt.gpg will be created
# the new encrypted file update_csgo_ds.txt.gpg will be created
# delete the original file with
# delete the original file with
# rm update_csgo_ds.txt
# rm update_csgo_ds.txt
 
</syntaxhighlight>
You can check the decryption with:
You can check the decryption with:
<syntaxhighlight>
gpg -d update_csgo_ds.txt.gpg
gpg -d update_csgo_ds.txt.gpg
# enter you password
# enter you password
# the text will be written to stdout, when your password is ok
# the text will be written to stdout, when your password is ok
 
</syntaxhighlight>
When everything is ok, you can use a little shell script to pipe the stdout from gpg to steam.sh:
When everything is ok, you can use a little shell script to pipe the stdout from gpg to steam.sh:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">

Revision as of 14:06, 15 January 2013

Template:Otherlang2 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 Steam Pipe 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.pngNote:Do not extract the contents of the updater tool to the regular Steam Client folder or to the HLDSUpdateTool folder.
  • Linux: type tar xvfz steamcmd.tar.gz

3. Launch SteamCMD for the first time

Open a command prompt in that directory and start SteamCmd
  • Windows: type steamcmd
  • Linux: type ./steam.sh
If this doesn't work, try STEAMEXE=steamcmd ./steam.sh
If this doesn't work either, try open the file in a text editor and edit line 60 to: ${DEBUGGER} "${STEAMROOT}"/${PLATFORM}/${STEAMEXE}cmd "$@"

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

For Counter-Strike: Global Offensive or Nuclear Dawn, you can login anonymously

login anonymous

For other games, you will have to log in with a Steam Account

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

If you receive a Steam Guard error, check your e-mail for your access code and login using the following command (you'll only need to do this once per computer):

login <username> <password> <steam guard code>

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>
Icon-Bug.pngBug:On some Linux distributions the path cannot contain any capital letters - see #Known issues  [todo tested in ?]
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 IDs. To also validate the app add validate to the command.

app_update <app_id>
Example:
  • To install and validate CS:GO:
app_update 740 validate

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

Automating SteamCMD

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

1. Add commands to the command line. Examples:

steamcmd +login anonymous +force_install_dir ../csgo_ds +app_update 740 validate
steamcmd +login user password +force_install_dir c:\KFServer\ +app_update 215350 validate

2. Create a script.

a. Put your SteamCMD commands in a text file. Example:
// update_csgo_ds.txt
//
login user password
force_install_dir ../csgo_ds
app_update 740 validate
exit
b. Run SteamCMD with the +runscript option. Example:
steamcmd +runscript csgo_ds.txt

Protect your AccountLogin with gpg under Linux

Write your loginscript like the example and save the file as update_csgo_ds.txt. You have to encrypt with gpg the textfile with a symmetric encryption:

gpg -c --force-mdc update_csgo_ds.txt
# enter your password
# the new encrypted file update_csgo_ds.txt.gpg will be created
# delete the original file with
# rm update_csgo_ds.txt

You can check the decryption with:

gpg -d update_csgo_ds.txt.gpg
# enter you password
# the text will be written to stdout, when your password is ok

When everything is ok, you can use a little shell script to pipe the stdout from gpg to steam.sh:

#!/bin/sh
read -p "Enter your password: " -s pass
gpg --passphrase $pass -d login.gpg 2>/dev/null | STEAMEXE=steamcmd ./steam.sh
pass=""

Known issues

I was able to download or update the server package with SteamCMD, but the server fails to start

Common causes:

  • Linux: Some games on some distributions have issues with uppercase letters in directory/filenames.

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: libstdc++.so.6: 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 apt-get install ia32-libs displays:

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.

Use:

sudo dpkg --add-architecture i386

and

sudo apt-get update

before running 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

Download Failed

On windows computers, the initial download may fail if proxy settings are not set to automatically detect settings.

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: https://support.steampowered.com/kb_article.php?ref=8571-GLVN-8711&l=english