SteamCMD Installation and Game Server Management

SteamCMD is Valve's command-line Steam client essential for installing and updating game servers on Linux. This comprehensive guide covers SteamCMD installation, authentication methods, installing and updating game server applications, creating automation scripts for batch operations, and managing multiple game servers efficiently. SteamCMD is the foundation for professional game server hosting.

Table of Contents

Overview

SteamCMD is a command-line tool for managing game servers. It allows you to:

  • Install game server applications
  • Update servers to latest versions
  • Download content and workshop items
  • Manage app validations
  • Schedule automated updates
  • Script complex operations
  • Handle batch operations

SteamCMD is free and required for professional game server hosting.

System Requirements

SteamCMD works on:

  • Ubuntu 20.04 LTS and later
  • CentOS 7 and later
  • Debian 10 and later
  • Other glibc-based Linux distributions

Requirements:

  • 1GB minimum disk space
  • 512MB RAM minimum
  • Root or sudo access
  • Stable internet connection
  • Outbound access to Steam servers

Installing SteamCMD

Install system dependencies first:

sudo apt-get update
sudo apt-get install -y curl wget file bzip2 gzip unzip ca-certificates

# For 32-bit library support (required by SteamCMD)
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y lib32gcc1 lib32stdc++6 libc6:i386 libstdc++6:i386

For CentOS/RHEL:

sudo yum install -y glibc libstdc++ wget bzip2 gzip unzip ca-certificates
sudo yum install -y glibc.i686 libstdc++.i686

Create dedicated steam user (best practice):

sudo useradd -m -s /bin/bash steam
sudo -u steam mkdir -p /home/steam/steamcmd
cd /home/steam/steamcmd

Download SteamCMD:

sudo -u steam curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | sudo -u steam tar zxvf -

Verify installation:

ls -la /home/steam/steamcmd/
file /home/steam/steamcmd/steamcmd.sh

Test SteamCMD:

sudo -u steam /home/steam/steamcmd/steamcmd.sh +quit

Expected output:

[  0%] Checking for available updates...
[  0%] Downloading update (0 bytes)...
[100%] Download complete.
[  0%] Extracting package
[  0%] Extracting package
[100%] Extraction complete

Create convenient alias for SteamCMD:

echo 'alias steamcmd="/home/steam/steamcmd/steamcmd.sh"' | sudo tee -a /home/steam/.bashrc

SteamCMD Authentication

SteamCMD supports multiple authentication methods:

Anonymous Login (Public Servers)

For public game servers without licensing requirements:

sudo -u steam /home/steam/steamcmd/steamcmd.sh +login anonymous +quit

Account Login (Licensed Servers)

For apps requiring account authentication:

sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +login your_steam_username your_steam_password \
    +quit

For two-factor authentication, create account login script:

sudo tee /home/steam/steamcmd_login.sh > /dev/null <<'EOF'
#!/bin/bash

read -p "Enter Steam username: " USERNAME
read -s -p "Enter Steam password: " PASSWORD
read -p "Enter two-factor code (if required): " STEAMGUARD

/home/steam/steamcmd/steamcmd.sh \
    +login "$USERNAME" "$PASSWORD" "$STEAMGUARD" \
    +quit
EOF

sudo chmod +x /home/steam/steamcmd_login.sh

Store credentials securely (not recommended for production):

# Create secure credentials file
sudo tee /home/steam/steamcmd_credentials > /dev/null <<'EOF'
USERNAME=your_username
PASSWORD=your_password
EOF

sudo chown steam:steam /home/steam/steamcmd_credentials
sudo chmod 600 /home/steam/steamcmd_credentials

Installing Game Servers

Basic syntax for installing servers:

sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /path/to/server \
    +login anonymous \
    +app_update APP_ID validate \
    +quit

Common game server app IDs:

# Counter-Strike 2: 730
# Dota 2: 570
# Team Fortress 2: 232250
# ARK Survival Evolved: 376030
# Rust: 258550
# Valheim: 896660
# Factorio: 427520 (headless)
# Terraria: 105600
# 7 Days to Die: 294420
# Project Zomboid: 380870
# Palworld: 2394010
# Minecraft Java: Use different method

Installation examples:

# Install Valheim server
sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /home/steam/valheim \
    +login anonymous \
    +app_update 896660 validate \
    +quit

# Install with comment output
sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /home/steam/rust \
    +login anonymous \
    +app_update 258550 validate \
    +echo "Installation complete" \
    +quit

Verify installation:

ls -la /home/steam/valheim/
du -sh /home/steam/valheim/
file /home/steam/valheim/valheim_server.x86_64

Updating Game Servers

Update to latest version:

sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /home/steam/valheim \
    +login anonymous \
    +app_update 896660 validate \
    +quit

Create update script:

sudo tee /home/steam/update_all_servers.sh > /dev/null <<'EOF'
#!/bin/bash

STEAMCMD="/home/steam/steamcmd/steamcmd.sh"

# Array of servers to update
SERVERS=(
    "/home/steam/valheim:896660"
    "/home/steam/rust:258550"
    "/home/steam/ark:376030"
)

for SERVER_PATH in "${SERVERS[@]}"; do
    IFS=':' read -r DIR APP_ID <<< "$SERVER_PATH"
    
    echo "Updating $DIR (App ID: $APP_ID)..."
    
    sudo -u steam "$STEAMCMD" \
        +force_install_dir "$DIR" \
        +login anonymous \
        +app_update "$APP_ID" validate \
        +quit
    
    if [ $? -eq 0 ]; then
        echo "✓ Update successful for $DIR"
    else
        echo "✗ Update failed for $DIR"
    fi
    
    echo ""
done

echo "All servers updated"
EOF

sudo chmod +x /home/steam/update_all_servers.sh

Automation Scripts

Batch Installation Script

sudo tee /home/steam/install_servers.sh > /dev/null <<'EOF'
#!/bin/bash

STEAMCMD="/home/steam/steamcmd/steamcmd.sh"
BASE_DIR="/home/steam"

# Define servers: name:appid:port
SERVERS=(
    "valheim:896660:2456"
    "rust:258550:28015"
    "ark:376030:27015"
    "factorio:427520:34197"
)

for SERVER_DEF in "${SERVERS[@]}"; do
    IFS=':' read -r NAME APP_ID PORT <<< "$SERVER_DEF"
    
    SERVER_DIR="$BASE_DIR/$NAME"
    
    echo "Installing $NAME (App ID: $APP_ID) to $SERVER_DIR"
    
    mkdir -p "$SERVER_DIR"
    
    sudo -u steam "$STEAMCMD" \
        +force_install_dir "$SERVER_DIR" \
        +login anonymous \
        +app_update "$APP_ID" validate \
        +quit
    
    if [ -d "$SERVER_DIR" ] && [ "$(ls -A $SERVER_DIR)" ]; then
        echo "✓ Successfully installed $NAME"
        echo "  Location: $SERVER_DIR"
        echo "  App ID: $APP_ID"
        echo "  Recommended port: $PORT"
    else
        echo "✗ Installation failed for $NAME"
    fi
    
    echo ""
done
EOF

sudo chmod +x /home/steam/install_servers.sh

Scheduled Update Cron Job

# Edit steam user crontab
sudo -u steam crontab -e

# Add this line to run daily updates at 3 AM
0 3 * * * /home/steam/update_all_servers.sh >> /home/steam/logs/steamcmd_updates.log 2>&1

Pre-update Backup Script

sudo tee /home/steam/backup_before_update.sh > /dev/null <<'EOF'
#!/bin/bash

SERVERS=(
    "/home/steam/valheim"
    "/home/steam/rust"
    "/home/steam/ark"
)

BACKUP_BASE="/home/steam/backups"
DATE=$(date +%Y%m%d_%H%M%S)

for SERVER_DIR in "${SERVERS[@]}"; do
    if [ -d "$SERVER_DIR" ]; then
        SERVER_NAME=$(basename "$SERVER_DIR")
        BACKUP_FILE="$BACKUP_BASE/${SERVER_NAME}_pre_update_${DATE}.tar.gz"
        
        mkdir -p "$BACKUP_BASE"
        
        echo "Backing up $SERVER_NAME..."
        tar -czf "$BACKUP_FILE" -C "$SERVER_DIR" . 2>/dev/null
        
        if [ $? -eq 0 ]; then
            SIZE=$(du -sh "$BACKUP_FILE" | awk '{print $1}')
            echo "✓ Backup created: $SIZE"
        else
            echo "✗ Backup failed for $SERVER_NAME"
        fi
    fi
done
EOF

sudo chmod +x /home/steam/backup_before_update.sh

Managing Multiple Servers

Create server inventory file:

sudo tee /home/steam/servers.conf > /dev/null <<'EOF'
# Server Configuration File
# Format: name:appid:installdir:port:maxplayers

valheim:896660:/home/steam/valheim:2456:10
rust:258550:/home/steam/rust:28015:100
ark:376030:/home/steam/ark:27015:70
factorio:427520:/home/steam/factorio:34197:255
terraria:105600:/home/steam/terraria:7777:255
7dtd:294420:/home/steam/7dtd:26900:8
EOF

Create server management script:

sudo tee /home/steam/manage_servers.sh > /dev/null <<'EOF'
#!/bin/bash

STEAMCMD="/home/steam/steamcmd/steamcmd.sh"
SERVERS_CONF="/home/steam/servers.conf"

function list_servers() {
    echo "=== Installed Servers ==="
    grep -v '^#' "$SERVERS_CONF" | while IFS=':' read -r NAME APP_ID DIR PORT MAX; do
        if [ -d "$DIR" ]; then
            SIZE=$(du -sh "$DIR" | awk '{print $1}')
            echo "  $NAME (ID: $APP_ID)"
            echo "    Location: $DIR"
            echo "    Port: $PORT"
            echo "    Max Players: $MAX"
            echo "    Size: $SIZE"
            echo ""
        fi
    done
}

function install_server() {
    local name="$1"
    grep "^$name:" "$SERVERS_CONF" | while IFS=':' read -r NAME APP_ID DIR PORT MAX; do
        echo "Installing $NAME..."
        mkdir -p "$DIR"
        sudo -u steam "$STEAMCMD" \
            +force_install_dir "$DIR" \
            +login anonymous \
            +app_update "$APP_ID" validate \
            +quit
    done
}

function update_server() {
    local name="$1"
    grep "^$name:" "$SERVERS_CONF" | while IFS=':' read -r NAME APP_ID DIR PORT MAX; do
        echo "Updating $NAME..."
        sudo -u steam "$STEAMCMD" \
            +force_install_dir "$DIR" \
            +login anonymous \
            +app_update "$APP_ID" validate \
            +quit
    done
}

case "$1" in
    list)
        list_servers
        ;;
    install)
        install_server "$2"
        ;;
    update)
        update_server "$2"
        ;;
    *)
        echo "Usage: $0 {list|install|update} [server_name]"
        echo "Example: $0 list"
        echo "Example: $0 install valheim"
        ;;
esac
EOF

sudo chmod +x /home/steam/manage_servers.sh

Usage:

# List all servers
/home/steam/manage_servers.sh list

# Install specific server
/home/steam/manage_servers.sh install valheim

# Update specific server
/home/steam/manage_servers.sh update rust

Advanced Operations

Workshop Content Download

Download Steam Workshop content:

sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /home/steam/rust \
    +login anonymous \
    +workshop_download_item 252490 1234567890 \
    +quit

Script for downloading multiple workshop items:

sudo tee /home/steam/download_workshop.sh > /dev/null <<'EOF'
#!/bin/bash

STEAMCMD="/home/steam/steamcmd/steamcmd.sh"
GAME_ID="252490"  # Rust game ID
INSTALL_DIR="/home/steam/rust"

# Array of workshop item IDs to download
ITEMS=(
    "1234567890"
    "0987654321"
    "1111111111"
)

for ITEM_ID in "${ITEMS[@]}"; do
    echo "Downloading workshop item $ITEM_ID..."
    
    sudo -u steam "$STEAMCMD" \
        +force_install_dir "$INSTALL_DIR" \
        +login anonymous \
        +workshop_download_item "$GAME_ID" "$ITEM_ID" \
        +quit
done
EOF

sudo chmod +x /home/steam/download_workshop.sh

Validation and Integrity Checks

Validate server installation:

sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +force_install_dir /home/steam/rust \
    +login anonymous \
    +app_update 258550 validate \
    +quit

Create validation report script:

sudo tee /home/steam/validate_servers.sh > /dev/null <<'EOF'
#!/bin/bash

STEAMCMD="/home/steam/steamcmd/steamcmd.sh"
SERVERS_CONF="/home/steam/servers.conf"

echo "=== Server Validation Report ==="
echo "Date: $(date)"
echo ""

grep -v '^#' "$SERVERS_CONF" | while IFS=':' read -r NAME APP_ID DIR PORT MAX; do
    if [ -d "$DIR" ]; then
        echo "Validating $NAME..."
        
        sudo -u steam "$STEAMCMD" \
            +force_install_dir "$DIR" \
            +login anonymous \
            +app_update "$APP_ID" validate \
            +quit > /tmp/validation.log 2>&1
        
        if grep -q "OK" /tmp/validation.log; then
            echo "✓ $NAME validation successful"
        else
            echo "✗ $NAME validation failed"
        fi
    fi
done
EOF

sudo chmod +x /home/steam/validate_servers.sh

Troubleshooting

Common Issues and Solutions

SteamCMD not found:

# Verify installation location
ls -la /home/steam/steamcmd/steamcmd.sh
which steamcmd  # Won't work without alias

# Use full path
/home/steam/steamcmd/steamcmd.sh +quit

Permission denied errors:

# Ensure steam user owns SteamCMD
sudo chown -R steam:steam /home/steam/steamcmd

# Check permissions
sudo -u steam /home/steam/steamcmd/steamcmd.sh +quit

Network connectivity issues:

# Test network connectivity
ping -c 4 steampipe.steamcontent.com
curl -I https://steamcontent.com/

# Check firewall
sudo iptables -L | grep -i steam

Invalid app ID:

# Verify app ID
# Visit https://steamdb.info/apps/ to confirm correct app ID
# Common mistake: Using wrong number for server vs client

# Example check
sudo -u steam /home/steam/steamcmd/steamcmd.sh \
    +login anonymous \
    +app_info_update 1 \
    +app_info_print 896660 \
    +quit

Disk space issues:

# Check available disk space
df -h /home/steam/

# Clean up old backups if needed
du -sh /home/steam/* | sort -rh | head -10

# Remove unnecessary files
find /home/steam/backups -type f -mtime +30 -delete

Conclusion

SteamCMD is the essential foundation for professional game server hosting. By mastering SteamCMD automation, you can efficiently manage multiple game servers, schedule updates, and maintain consistency across your infrastructure.

Key takeaways:

  • SteamCMD is essential for all Linux game server hosting
  • Use dedicated steam user for security and organization
  • Automate updates with scripts and cron jobs
  • Always backup before major updates
  • Monitor disk space and validate installations regularly
  • Use configuration files to manage multiple servers efficiently
  • Keep documentation of server app IDs and locations

Proper SteamCMD management ensures reliable, up-to-date game servers with minimal manual intervention.