Install SteamCMD for a Steam Game Server

Updated by Linode

Contribute on GitHub

View Project | View File | Edit File

SteamCMD is a command-line version of the Steam client which works with games that use SteamPipe. If you intend to host a Steam title on your own game server, installing SteamCMD is a prerequisite.

This guide is intended to get you quickly up and running with SteamCMD on your Linode. See Valve’s SteamCMD wiki page for more information and advanced setups.

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Before You Install

  1. Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

  2. Update Your Operating System:

    CentOS

    1
    sudo yum update
    

    Debian / Ubuntu

    1
    sudo apt-get update && sudo apt-get upgrade
    

Secure Your Game Server

Game servers and clients are an especially ripe target for attack. Use our Securing Your Server guide to:

  1. Add a Steam user account. Make the username steam to coincide with the rest of Linode’s Steam guides, as well as Valve’s official documentation. Be sure to give the steam user sudo privileges.

  2. Harden SSH access.

  3. Remove unused network-facing services.

  4. If you are using iptables, complete the Configure a firewall steps using the rulesets below. If instead you are using firewalld, skip ahead to step 5.

    IPv4

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    *filter
    
    # Allow all loopback (lo0) traffic and reject traffic
    # to localhost that does not originate from lo0.
    -A INPUT -i lo -j ACCEPT
    -A INPUT ! -i lo -s 127.0.0.0/8 -j REJECT
    
    # Allow ping.
    -A INPUT -p icmp -m state --state NEW --icmp-type 8 -j ACCEPT
    
    # Allow SSH connections.
    -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
    
    # Allow the Steam client.
    -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
    -A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT
    
    # Allow inbound traffic from established connections.
    # This includes ICMP error returns.
    -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    
    # Log what was incoming but denied (optional but useful).
    -A INPUT -m limit --limit 3/min -j LOG --log-prefix "iptables_INPUT_denied: " --log-level 7
    -A FORWARD -m limit --limit 3/min -j LOG --log-prefix "iptables_FORWARD_denied: " --log-level 7
    
    # Reject all other inbound.
    -A INPUT -j REJECT
    -A FORWARD -j REJECT
    
    COMMIT
    

    Some Steam games require a few additional rules which can be found in our Steam game guides. Steam can also use multiple port ranges for various purposes, but they should only be allowed if your game(s) make use of those services. See this Steam Support page for more information.

    IPv6

    Steam currently supports multiplayer play over IPv4 only, so a Steam server only needs basic IPv6 firewall rules, shown below.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    *filter
    
    # Allow all loopback (lo0) traffic and reject traffic
    # to localhost that does not originate from lo0.
    -A INPUT -i lo -j ACCEPT
    -A INPUT ! -i lo -s ::1/128 -j REJECT
    
    # Allow ICMP.
    -A INPUT -p icmpv6 -j ACCEPT
    
    # Allow inbound traffic from established connections.
    -A INPUT -m state --state ESTABLISHED -j ACCEPT
    
    # Reject all other inbound.
    -A INPUT -j REJECT
    -A FORWARD -j REJECT
    
    COMMIT
    
  5. If you are using firewalld (CentOS 7, Fedora) instead of iptables, use these rules. If you are using iptables, do skip this step.

    1
    2
    3
    4
    sudo firewall-cmd --zone="public" --add-service=ssh --permanent
    sudo firewall-cmd --zone="public" --add-forward-port=port=27000-27030:proto=udp:toport=1025-65355 --permanent
    sudo firewall-cmd --zone="public" --add-forward-port=port=4380:proto=udp:toport=1025-65355 --permanent
    sudo firewall-cmd --reload
    

    Switch on firewalld and verify your ruleset:

    1
    2
    3
    sudo systemctl start firewalld
    sudo systemctl enable firewalld
    sudo firewall-cmd --zone="public" --list-all
    

Install SteamCMD

  1. Newly created Linodes use 64-bit Linux operating systems. Since Steam is compiled for i386, install the appropriate libraries. We’ll also install screen to use when running Steam games.

    CentOS 7

    1
    sudo yum install glibc.i686 libstdc++.i686 screen
    

    Debian / Ubuntu

    1
    sudo apt-get install lib32gcc1 screen
    

    Running dpkg --add-architecture i386 is not necessary at this point. Our Steam game guides add multiarch support only when a game requires it.

  2. Create the directory for SteamCMD and change to it:

    1
    mkdir ~/Steam && cd ~/Steam
    
  3. Download the SteamCMD tarball:

    1
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
    
  4. Extract the installation and runtime files:

    1
    tar -xvzf steamcmd_linux.tar.gz
    

Add an Error Fix

When running a Steam game, the following error is common to encounter:

1
/home/steam/.steam/sdk32/libsteam.so: cannot open shared object file: No such file or directory

The game server will still operate despite this error, and it should be something fixed in a later release of SteamCMD. The temporary fix is to create the directory and symlink to libsteam.so.

1
2
mkdir -p ~/.steam/sdk32/
ln -s ~/Steam/linux32/steamclient.so ~/.steam/sdk32/steamclient.so

Run SteamCMD

  1. Run the installer:

    1
    ./steamcmd.sh
    

    That will return an output similar to below and leave you at the Steam> prompt:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
    [  0%] Checking for available updates...
    [----] Downloading update (0 of 7,013 KB)...
    [  0%] Downloading update (1,300 of 7,013 KB)...
    [ 18%] Downloading update (3,412 of 7,013 KB)...
    [ 48%] Downloading update (5,131 of 7,013 KB)...
    [ 73%] Downloading update (6,397 of 7,013 KB)...
    [ 91%] Downloading update (7,013 of 7,013 KB)...
    [100%] Download complete.
    [----] Installing update...
    [----] Extracting package...
            . . .
    [----] Cleaning up...
    [----] Update complete, launching Steam...
    Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
    [  0%] Checking for available updates...
    [----] Verifying installation...
    Steam Console Client (c) Valve Corporation
    -- type 'quit' to exit --
    Loading Steam API...OK.
    
    Steam>
    
  2. Most Steam game servers allow anonymous logins. You can verify this for your title with Valve’s list of dedicated Linux servers.

    To log in anonymously:

    1
    login anonymous
    

    To log in with your Steam username:

    1
    login example_user
    

    Be aware that the Steam CLI does not obfuscate passwords. If signing in with your Steam account, be aware of your local screen’s security.

    You can exit the Steam> prompt at any time by typing quit.

Next Steps

You’re ready to install your first Steam game server. From here, certain games may need a few more i386 libraries or firewall rules, and most will need their configuration settings edited. The game server should allow easy administrative access with as little interruption to players as possible. Its software should frequently be updated, and players’ progress should be saved when the server is properly shut down.

Our game server guides cover these requirements and contain various Steam tutorials which will pick you up exactly where this page leaves off.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This guide is published under a CC BY-ND 4.0 license.