1. Download it
On Linux, the server needs the 32-bit libraries first:
dpkg --add-architecture i386
apt update
apt install -y lib32gcc-s1 lib32stdc++6
# Windows
C:\steamcmd\steamcmd.exe +force_install_dir C:\gmod +login anonymous +app_update 4020 validate +quit
# Linux (as the steam user)
~/steamcmd/steamcmd.sh +force_install_dir ~/gmod +login anonymous +app_update 4020 validate +quit
2. The Steam token (GSLT)
At steamcommunity.com/dev/managegameservers create a token with App ID 4000. That is the game's ID, not the server's (4020): with 4020 it does not work.
3. Start it
# Windows
C:\gmod\srcds.exe -console -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 +sv_setsteamaccount YOUR_TOKEN
# Linux
~/gmod/srcds_run -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 +sv_setsteamaccount YOUR_TOKEN
Change sandbox to the gamemode you want: terrortown (TTT, included) or one you downloaded, such as DarkRP.
4. Workshop collections
Create a collection on the Steam Workshop with your maps and addons, and add to the start line:
+host_workshop_collection COLLECTION_ID
The server downloads and mounts everything in the collection when it starts.
5. Name, password and RCON
In garrysmod/cfg/server.cfg:
hostname "My Garry's Mod server"
sv_password ""
rcon_password "A_LONG_PASSWORD"
6. Ports
Garry's Mod uses 27015 on UDP for the game and on TCP for RCON:
# Windows (PowerShell as administrator)
New-NetFirewallRule -DisplayName "GMod UDP 27015" -Direction Inbound -Protocol UDP -LocalPort 27015 -Action Allow -Profile Any
New-NetFirewallRule -DisplayName "GMod TCP 27015" -Direction Inbound -Protocol TCP -LocalPort 27015 -Action Allow -Profile Any
# Linux
ufw allow 27015/udp
ufw allow 27015/tcp
To join: game console (~ key) and connect YOUR_IP:27015.