Garry's Mod Server Guide

📋 Quick Info

Server Specifications

🔌 Ports & Firewall Configuration

Garry's Mod servers require specific ports for proper operation:

Port Protocol Purpose Required
27015 (configurable) UDP Game port Yes
27015 (same as game port) UDP Query/RCON port Yes
27005 UDP Client port No
26900 UDP Steam master server updater No
27020 UDP SourceTV port (if enabled) No

Firewall Examples

UFW (Ubuntu/Debian):

sudo ufw allow 27015/udp comment 'GMod Game/Query Port' sudo ufw allow 27020/udp comment 'GMod SourceTV' sudo ufw allow 26900/udp comment 'Steam Master Server'

FirewallD (CentOS/RHEL):

sudo firewall-cmd --permanent --add-port=27015/udp sudo firewall-cmd --permanent --add-port=27020/udp sudo firewall-cmd --permanent --add-port=26900/udp sudo firewall-cmd --reload

iptables:

iptables -A INPUT -p udp --dport 27015 -j ACCEPT iptables -A INPUT -p udp --dport 27020 -j ACCEPT iptables -A INPUT -p udp --dport 26900 -j ACCEPT

⚙️ Installation & Setup

System Requirements

Installation via SteamCMD (Linux)

  1. Install SteamCMD:
    sudo apt update sudo apt install lib32gcc1 steamcmd # Debian/Ubuntu # OR for manual install: mkdir ~/steamcmd && cd ~/steamcmd wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz tar -xvzf steamcmd_linux.tar.gz
  2. Download Garry's Mod Server:
    ./steamcmd.sh login anonymous force_install_dir ./gmod-server app_update 4020 validate quit
  3. Install Counter-Strike: Source Content (Required):
    ./steamcmd.sh login anonymous force_install_dir ./css-content app_update 232330 validate quit # Create symbolic link to CSS content ln -s /path/to/css-content/cstrike /path/to/gmod-server/garrysmod/addons/cstrike

Installation via SteamCMD (Windows)

  1. Download SteamCMD from Valve's website
  2. Extract to C:\steamcmd\
  3. Run steamcmd.exe and execute:
    login anonymous force_install_dir C:\gmod-server app_update 4020 validate quit
  4. Install CSS content similarly and mount it in server configuration

📝 Configuration

server.cfg Example

Create or edit garrysmod/cfg/server.cfg:

// Server Identity hostname "My Awesome Garry's Mod Server" sv_password "" // Leave blank for public server sv_steamgroup "" // Steam Group ID (optional) // Server Rates sv_minrate 10000 sv_maxrate 30000 sv_minupdaterate 20 sv_maxupdaterate 66 sv_mincmdrate 20 sv_maxcmdrate 66 // Server Region sv_region 1 // 1 = East Coast USA // Server Visibility sv_lan 0 // 0 for internet, 1 for LAN only sv_logbans 1 sv_logecho 1 sv_logfile 1 sv_log_onefile 0 // RCON (Remote Console) rcon_password "your_secure_password" sv_rcon_banpenalty 0 sv_rcon_maxfailures 5 // Contact & Tags sv_contact "admin@example.com" sv_tags "sandbox,fun,friendly" // Gameplay Settings sbox_maxprops 300 // Max props per player sbox_maxragdolls 10 // Max ragdolls per player sbox_maxvehicles 6 // Max vehicles per player sbox_maxeffects 200 // Max effects per player sbox_maxballoons 50 // Max balloons per player sbox_maxlamps 20 // Max lamps per player sbox_maxthrusters 50 // Max thrusters per player sbox_maxwheels 50 // Max wheels per player sbox_maxhoverballs 50 // Max hoverballs per player sbox_maxnpcs 20 // Max NPCs per player sbox_maxsents 100 // Max SENTs per player sbox_godmode 0 // God mode (0 = off) sbox_noclip 1 // Allow noclip (1 = yes) sbox_plpldamage 0 // Player vs player damage (0 = off) // Voice Chat sv_alltalk 1 // 1 = everyone can hear, 0 = team only sv_voiceenable 1 // Download Settings sv_allowdownload 1 sv_allowupload 1 sv_downloadurl "" // FastDL URL (highly recommended) // Workshop Collection host_workshop_collection "0" // Your Steam Workshop Collection ID // Performance sv_loadingurl "" // Loading screen URL (optional) net_maxfilesize 64 // Max downloadable file size (MB) // Server Protection sv_pure 0 // File consistency (usually 0 for GMod) lua_openscript_cl 0 // Client Lua scripts (security) // Exec ban files exec banned_user.cfg exec banned_ip.cfg

mount.cfg Example

Create garrysmod/cfg/mount.cfg to mount content from other Source games:

// Mount CS:S content (required for most servers) "mountcfg" { "cstrike" "C:\css-content\cstrike" "tf" "C:\tf2-content\tf" "dod" "C:\dod-content\dod" }

Game Mode Configuration

Set game mode in startup parameters:

// Sandbox (default) +gamemode sandbox // DarkRP +gamemode darkrp // Trouble in Terrorist Town (TTT) +gamemode terrortown // Prop Hunt +gamemode prop_hunt

🚀 Startup Parameters

Parameter Description Example
-game Game directory name -game garrysmod
-console Enable console output -console
-port Server port -port 27015
-maxplayers Maximum players -maxplayers 32
+map Starting map +map gm_flatgrass
+gamemode Game mode to load +gamemode sandbox
+exec Execute config file +exec server.cfg
-tickrate Server tickrate -tickrate 66
-ip Bind to specific IP -ip 192.168.1.100
+host_workshop_collection Workshop collection ID +host_workshop_collection 123456789
+sv_setsteamaccount Steam Game Server Login Token +sv_setsteamaccount YOURTOKENHERE

Example Startup Command (Linux)

./srcds_run -game garrysmod -console -port 27015 -maxplayers 32 \ +map gm_flatgrass +gamemode sandbox +exec server.cfg \ +host_workshop_collection YOUR_COLLECTION_ID \ +sv_setsteamaccount YOUR_GSLT_TOKEN -tickrate 66

Example Startup Command (Windows)

srcds.exe -game garrysmod -console -port 27015 -maxplayers 32 ^ +map gm_flatgrass +gamemode sandbox +exec server.cfg ^ +host_workshop_collection YOUR_COLLECTION_ID ^ +sv_setsteamaccount YOUR_GSLT_TOKEN -tickrate 66

Getting Steam Game Server Login Token (GSLT)

  1. Visit Steam Game Server Account Management
  2. Log in with your Steam account
  3. Create new token with App ID 4000
  4. Use token in +sv_setsteamaccount parameter

🔧 Troubleshooting

Missing Textures/Errors (Purple/Black Checkerboard)

Issue: Players see missing textures or error models.

Solutions:

Lua Errors on Startup

Issue: Server shows Lua errors in console.

Solutions:

Workshop Content Not Downloading

Issue: Workshop addons not appearing on server.

Solutions:

High Player Ping/Lag

Issue: Players experiencing latency.

Solutions:

Server Crashes

Issue: Server randomly crashes or restarts.

Solutions:

RCON Connection Issues

Issue: Cannot connect via RCON.

Solutions:

🎮 Popular Game Modes

Sandbox

The default GMod experience. Build anything with physics props and tools.

DarkRP

Roleplay game mode where players take on jobs in a virtual city.

Trouble in Terrorist Town (TTT)

Social deduction game. Traitors vs Innocents.

Prop Hunt

Hide-and-seek with props. Hunters vs Props.

Murder

One murderer, one detective, bystanders. Survive or solve.

Deathrun

Runners navigate deadly obstacle courses while Deaths activate traps.

🔌 Addons & Customization

Installing Addons Manually

  1. Download addon files (.gma or folder structure)
  2. Place in garrysmod/addons/ directory
  3. Restart server

Popular Server Addons

Lua Scripting

GMod servers use Lua for custom functionality:

-- Example: garrysmod/lua/autorun/server/welcome.lua hook.Add("PlayerInitialSpawn", "WelcomeMessage", function(ply) ply:ChatPrint("Welcome to the server, " .. ply:Nick() .. "!") end)

🛠️ Steam Workshop Integration

Creating Workshop Collection

  1. Open Garry's Mod and go to Main Menu
  2. Click "Workshop" → "Collections"
  3. Create new collection and add desired addons
  4. Publish collection and note the Collection ID
  5. Use ID in host_workshop_collection parameter

Adding Individual Workshop Items (Lua)

In garrysmod/lua/autorun/server/workshop.lua:

-- Add individual Workshop items resource.AddWorkshop("123456789") -- Replace with Workshop ID resource.AddWorkshop("987654321") resource.AddWorkshop("555555555")

FastDL Configuration

Recommended for faster downloads of custom content:

  1. Set up web server or use hosting service
  2. Compress and upload custom content (maps, materials, models, sounds)
  3. Set sv_downloadurl "http://your-fastdl-url/" in server.cfg
  4. File structure on FastDL must mirror server structure

👤 Admin Commands

Basic Console Commands

status # Show players and server info kick [name/userid] # Kick player banid [minutes] [userid]# Ban player addip [minutes] [ip] # Ban IP address changelevel [map] # Change map immediately map [map] # Load specific map ulx ban [player] [time] # ULX ban command ulx kick [player] # ULX kick command ulx slay [player] # Kill player

Sandbox Commands

sbox_maxprops [number] # Set prop limit sbox_godmode [0/1] # Toggle god mode sbox_noclip [0/1] # Toggle noclip cleanup # Remove all props

📚 Resources

Important Notes