Skip to main content

Installing a game

To install a game, you will need to know the AppID of the game you want to install. You can find the AppID by searching for the game on the Steam Store. Once you have the AppID, follow these steps: Login to the Steam User
su Steam
Navigate to the Steam home folder
cd /home/steam
Execute the pre-defined Homelab script
./install_steam_game.sh

Install Script

#!/bin/bash

# Define SteamCMD executable path (adjust if needed)
STEAMCMD_PATH="/usr/games/steamcmd"

# Ensure steamcmd is installed
if [ ! -f "$STEAMCMD_PATH" ]; then
    echo "Error: SteamCMD not found at $STEAMCMD_PATH"
    exit 1
fi

# Prompt for Game ID
read -p "Enter the Steam Game ID: " GAME_ID

# Validate input
if ! [[ "$GAME_ID" =~ ^[0-9]+$ ]]; then
    echo "Invalid Game ID. Please enter a numeric value."
    exit 1
fi

# Prompt for Install Directory
read -p "Enter the install directory (absolute path): " INSTALL_DIR

# Ensure the directory exists or create it
mkdir -p "$INSTALL_DIR"

# Run SteamCMD to install the game
"$STEAMCMD_PATH" +login anonymous +force_install_dir "$INSTALL_DIR" +app_update "$GAME_ID" validate +quit

# Check if the installation was successful
if [ $? -eq 0 ]; then
    echo "Game ID $GAME_ID installed successfully in $INSTALL_DIR"
else
    echo "Error: Installation failed."
    exit 1
fi