Garry’s Mod (GMod) servers run everything from sandbox building to DarkRP, Trouble in Terrorist Town (TTT), Prop Hunt and Murder. GMod uses Valve’s Source Dedicated Server (SRCDS), which runs natively on Linux and is light on resources. Workshop content and addons are what make each server unique.
Requirements
- 2 vCPU and 2–4 GB RAM for most servers. Big DarkRP servers with many addons need more CPU, because GMod’s Lua runs mostly on one thread.
- Disk for the server, plus Workshop content (several GB).
- Port 27015 (UDP for game, TCP for RCON).
- A location near your players. See game server VPS.
Install with SteamCMD
sudo dpkg --add-architecture i386
sudo apt update && sudo apt install -y steamcmd lib32gcc-s1 lib32stdc++6
sudo adduser --disabled-password --gecos "" gmod
sudo -iu gmod
/usr/games/steamcmd +force_install_dir ~/gmod +login anonymous +app_update 4020 validate +quit
The GMod dedicated server’s app ID is 4020. For the x86-64 branch (better performance with large addons), add -beta x86-64.
Game Server Login Token
To appear in the server browser, create a GSLT at steamcommunity.com/dev/managegameservers for app ID 4000 (Garry’s Mod), and pass it with +sv_setsteamaccount.
Launch the server
cd ~/gmod
./srcds_run -game garrysmod -console -port 27015 \
+maxplayers 24 +gamemode sandbox +map gm_construct \
+sv_setsteamaccount YOUR_GSLT \
+host_workshop_collection 1234567890
+gamemode: sandbox, terrortown (TTT), darkrp (after installing it), prophunters, and others.+host_workshop_collection: the server downloads every item in that Workshop collection, and clients get the content when they join.srcds_runrestarts the server automatically if it crashes. Add-autoupdatewith-steam_dirand-steamcmd_scriptfor automatic updates.
server.cfg
~/gmod/garrysmod/cfg/server.cfg:
hostname "My GMod Server | Sandbox"
sv_password ""
rcon_password "long-random-rcon-password"
sv_loadingurl "" // custom loading screen URL
sv_allowupload 0
sv_allowdownload 0
sv_downloadurl "" // FastDL URL for non-Workshop content
sbox_maxprops 150
Addons and gamemodes
- Workshop (recommended): add addons to a Steam Workshop collection, and use
+host_workshop_collection. Clients download them automatically. - Legacy addons: folders in
garrysmod/addons/(for example, admin mods like ULX/ULib, or SAM). - Gamemodes: folders in
garrysmod/gamemodes/(DarkRP is installed from its GitHub repository, plus a DarkRP modification addon for your settings). - FastDL: for custom content not on the Workshop, host compressed files on a web server, and set
sv_downloadurl. See Nginx static site hosting.
Run it as a service
Use systemd (with an ExecStartPre SteamCMD update) or tmux/screen for console access. See systemd unit files and screen.
Firewall
sudo ufw allow 27015/udp
sudo ufw allow 27015/tcp # RCON; consider restricting to your IP
See UFW.
Admins
With ULX installed, add yourself from the server console:
ulx adduser "YourName" superadmin
Or use users.txt / the admin mod’s config. Keep the RCON password private.
Backups
Back up garrysmod/cfg, garrysmod/data (addon data, such as DarkRP’s and ULX’s), garrysmod/addons, and any database the gamemode uses (DarkRP can use MySQL via MySQLOO). See mysqldump and backup strategy.
Performance tips
- Lua-heavy addons are the usual cause of lag. Profile with tools like FProfiler, and remove poorly written addons.
- Limit props per player (
sbox_maxprops) on sandbox servers. - Use the x86-64 branch for large servers.
Troubleshooting
- Server not in the browser: check the GSLT (app 4000), and that UDP 27015 is open. Listing can take a few minutes.
- Players stuck downloading: large Workshop collections take a long time on first join. Trim the collection, or use FastDL for non-Workshop files.
- Lua errors in the console: usually an outdated addon. Update or remove it, and check
garrysmod/datafor addon logs.
Quick reference
| Item | Value |
|---|---|
| SteamCMD app ID | 4020 |
| GSLT | app ID 4000 |
| Port | 27015 UDP (+TCP RCON) |
| Config | garrysmod/cfg/server.cfg |
| Workshop | +host_workshop_collection <id> |
Related: CS2 dedicated server and LinuxGSM.