Guides

Garry's Mod server on Linux: SteamCMD, GSLT, server.cfg, Workshop and port 27015

Set up a Garry's Mod server on Linux: SteamCMD app 4020, a GSLT token, server.cfg, Workshop collections, UDP 27015, TTT or DarkRP, and systemd.

Published ~9 min read
On this page

To run a Garry’s Mod server on Linux, install SteamCMD, download app 4020 with an anonymous login, create a Game Server Login Token for app 4000, open UDP port 27015 and start ./srcds_run -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 with +sv_setsteamaccount. Add +host_workshop_collection for Workshop addons. A small server needs 1 to 2 GB of RAM.

This guide does the setup on Debian 12 or 13 or Ubuntu 24.04: the install, the token, server.cfg, Workshop content, the three gamemodes most servers run, a systemd service that updates on restart, and an honest look at plan size. It follows Facepunch’s Garry’s Mod wiki as of October 2026.

ItemValue
SteamCMD app ID4020, anonymous login
Token (GSLT) app ID4000, one token per server
Game portUDP 27015, changed with -port
RCONTCP 27015, only if you use remote RCON
Config filegarrysmod/cfg/server.cfg
Workshop addons+host_workshop_collection ID
Default gamemodesandbox
Process32-bit on the default branch, so about 4 GB of memory at most

How much RAM does a Garry’s Mod server need?

We found no official server requirements from Facepunch, so the figures below are our starting points. The game itself barely matters; addons, maps and the gamemode decide it:

ServerRAM free for the servervCores
Sandbox or TTT with friends, few addons1 to 2 GB1 to 2
Public TTT or Prop Hunt, a Workshop collection2 GB2
DarkRP, 30 or more players, large collection3 to 4 GB2 to 4

Two limits matter more than raw size. On the default branch the server is a 32-bit program, so one process cannot use much more than 4 GB of memory, whatever the VPS has; Facepunch also publishes an x86-64 beta branch that lifts this, at the price of running a beta. And the Source engine runs the game simulation and the Lua of every addon on one main thread, so a fast core matters more than many: a busy DarkRP server is usually CPU-bound long before it runs out of RAM. Several servers on one VPS each need their own port, and ideally a core each.

How do I install a Garry’s Mod server with SteamCMD?

Valve advises against running SteamCMD as root, so the server gets its own account with /opt/gmod as its home. SteamCMD and the default server build are 32-bit and need the 32-bit C and C++ runtime libraries.

  1. 1Install dependencies and create the user
    Debian · Ubuntu
    sudo apt update
    sudo apt install -y curl ca-certificates lib32gcc-s1 lib32stdc++6 tmux
    sudo useradd --system --create-home --home-dir /opt/gmod --shell /usr/sbin/nologin gmod
  2. 2Install SteamCMD from Valve's tarball
    Debian · Ubuntu
    sudo -u gmod -H mkdir -p /opt/gmod/steamcmd
    sudo -u gmod -H sh -c 'curl -fsSL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -xz -C /opt/gmod/steamcmd'
  3. 3Download the dedicated server

    App 4020 is free and needs no Steam account. The first run also updates SteamCMD itself:

    Debian · Ubuntu
    sudo -u gmod -H /opt/gmod/steamcmd/steamcmd.sh \
      +force_install_dir /opt/gmod/server \
      +login anonymous +app_update 4020 validate +quit

    For the 64-bit build, add -beta x86-64 after 4020, as the wiki shows. That branch brings its own 64-bit start script (srcds_run_x64 in community guides; ls the server folder to check). Stay on the default branch unless you hit the memory ceiling.

  4. 4Start it once by hand
    first start
    sudo -u gmod -H sh -c 'cd /opt/gmod/server && ./srcds_run -game garrysmod -norestart +maxplayers 16 +map gm_construct'
    # wait for "VAC secure mode is activated." then type: quit

Do I need a Game Server Login Token?

Yes. The Garry’s Mod wiki calls sv_setsteamaccount mandatory: since the May 2020 update, servers without a token suffer a severe penalty in the server list ranking. Create one at steamcommunity.com/dev/managegameservers, signed in to your Steam account, and enter 4000 (the game, not the server’s 4020) as the app ID. Every server needs its own token, and changing that account’s password invalidates all of them. The token goes on the start line as +sv_setsteamaccount TOKEN; the systemd setup below reads it from a root-only file.

server.cfg: the settings to set first

garrysmod/cfg/server.cfg runs at every map change. Create it with these lines:

/opt/gmod/server/garrysmod/cfg/server.cfg
hostname "My Garry's Mod server"
sv_password ""                 // empty = public; set one for a private server
rcon_password ""               // empty disables RCON
sv_region 3                    // 3 = Europe in the server browser
sv_lan 0
sv_loadingurl ""               // optional loading screen URL
sv_allowcslua 0                // no client-side Lua
sbox_maxprops 150              // sandbox limits per player
sbox_maxragdolls 5

Leave rcon_password empty unless you need remote console access: on a VPS you have SSH and the server console in tmux, which is safer than an RCON password that travels unencrypted. Settings that belong on the start line rather than in server.cfg:

ParameterExampleWhat it does
-game-game garrysmodRequired on Linux
-port-port 27015Game port; a second server takes 27016
+maxplayers+maxplayers 24Slots; set before the map loads
+gamemode+gamemode terrortownFolder name of the gamemode
+map+map gm_constructFirst map, without .bsp
+host_workshop_collection+host_workshop_collection 123456789Downloads and mounts a Workshop collection
+sv_setsteamaccount+sv_setsteamaccount TOKENYour GSLT
-norestart-norestartStops srcds_run restarting itself; systemd does that

How do I add Workshop addons and maps?

Make a Steam Workshop collection with the addons and maps you want, set it to public, and copy the number from its URL. Started with +host_workshop_collection 123456789, the server downloads and mounts every item at start-up. Players’ games do not fetch that content on their own, so tell them to, with a Lua file the server runs at start:

/opt/gmod/server/garrysmod/lua/autorun/server/workshop.lua
-- one line per Workshop item clients should download
resource.AddWorkshop("123456789")
resource.AddWorkshop("987654321")

Older guides add -authkey with a Steam Web API key to the start line. The current wiki page on Workshop for dedicated servers asks only for the collection ID, so start without a key; if your collection fails to download, check its visibility first. Many community maps, TTT ones in particular, also expect Counter-Strike: Source textures. Install its dedicated server (app 232330) into a folder of its own with the step 3 line, changed to +force_install_dir /opt/gmod/css and +app_update 232330, and mount it in garrysmod/cfg/mount.cfg:

garrysmod/cfg/mount.cfg
"mountcfg"
{
  "cstrike" "/opt/gmod/css/cstrike"
}

Sandbox, TTT or DarkRP: which gamemode?

  • Sandbox (+gamemode sandbox) is the default: free building with props and tools. Light on the server until players spawn hundreds of physics props, which is what the sbox_max limits are for.
  • Trouble in Terrorist Town (+gamemode terrortown) ships with the game. It needs ttt_ maps, usually from the Workshop, and rounds keep load predictable.
  • DarkRP is a separate download (the gamemode plus its darkrpmodification addon for your changes) into garrysmod/gamemodes and garrysmod/addons, started with +gamemode darkrp. Persistent money and jobs, many addons, the heaviest of the three.

Which ports does a Garry’s Mod server need?

UDP 27015 carries the game and the server browser query. TCP 27015 is used only by RCON, so leave it closed unless you run RCON from another machine. Players connect from their own client port; you open nothing for that. Allow SSH before you enable the firewall:

ufw · Debian · Ubuntu
sudo apt install -y ufw                # preinstalled on Ubuntu
sudo ufw allow 22/tcp                  # your SSH port, first
sudo ufw allow 27015/udp comment 'GMod'
# only for remote RCON, ideally limited to your own IP:
# sudo ufw allow from 203.0.113.10 to any port 27015 proto tcp
sudo ufw enable
sudo ss -ulpn | grep 27015             # the server should be listed

The UFW guide covers default-deny rules and rate limits for SSH in more depth.

How do I keep it running: tmux or systemd?

For testing, tmux is enough: the server keeps running after you disconnect, and you can attach to type console commands such as status, changelevel or quit. The tmux cheat sheet has the keys:

by hand in tmux
sudo -u gmod tmux -L gmod new-session -d -s gmod -c /opt/gmod/server \
  ./srcds_run -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 +sv_setsteamaccount TOKEN
sudo -u gmod tmux -L gmod attach -t gmod    # Ctrl+b then d detaches

For a server that starts at boot and updates itself on every restart, use systemd. The token lives in a root-only environment file, and -norestart leaves crash recovery to systemd:

token file
sudo install -d -m 0750 /etc/gmod
echo 'GSLT=YOUR_TOKEN' | sudo tee /etc/gmod/gmod.env >/dev/null
sudo chmod 600 /etc/gmod/gmod.env
/etc/systemd/system/gmod.service
[Unit]
Description=Garry's Mod dedicated server
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=gmod
Group=gmod
WorkingDirectory=/opt/gmod/server
EnvironmentFile=/etc/gmod/gmod.env
# update before every start; the leading "-" lets a failed update fall through
ExecStartPre=-/opt/gmod/steamcmd/steamcmd.sh +force_install_dir /opt/gmod/server +login anonymous +app_update 4020 +quit
ExecStart=/opt/gmod/server/srcds_run -game garrysmod -norestart -port 27015 +maxplayers 16 +gamemode sandbox +map gm_construct +host_workshop_collection 123456789 +sv_setsteamaccount ${GSLT}
TimeoutStartSec=900
Restart=on-failure
RestartSec=15

[Install]
WantedBy=multi-user.target
enable and watch
sudo systemctl daemon-reload
sudo systemctl enable --now gmod
sudo journalctl -u gmod -f

systemd reads the environment file as root before it switches to the gmod user, so the token stays out of the unit file, which every user can read. It still appears on the server’s command line, so other accounts on the VPS can see it in ps output. The systemd service guide explains each line. A sandbox server has nothing to save on stop; DarkRP writes its data as it changes, by default into the SQLite file garrysmod/sv.db.

What should I back up?

Not the 4020 install, which SteamCMD can download again, but what you made: garrysmod/cfg, garrysmod/data (many addons keep their state there), garrysmod/sv.db, and any addons or gamemodes you installed by hand:

nightly archive, as root
# drop any name below that your server does not have, such as sv.db on plain sandbox
mkdir -p /opt/gmod/backups
tar -czf /opt/gmod/backups/gmod-$(date +%F).tar.gz -C /opt/gmod/server/garrysmod \
  cfg data sv.db addons gamemodes lua/autorun/server
ls -1t /opt/gmod/backups/gmod-*.tar.gz | tail -n +15 | xargs -r rm --

Put that in root’s crontab and copy the archives to another machine with rsync; a backup on the same disk does not survive a lost disk.

Why can’t players find or join my server?

SymptomConfirm withFix
Not in the server browserjournalctl -u gmod | grep -i tokenNo or invalid GSLT, or a token reused on two servers: create one per server for app 4000
Players time outsudo ss -ulpn | grep 27015Listed: open UDP 27015 in ufw. Missing: the server did not start, read the journal
error while loading shared librariesThe line names the missing .so fileInstall the 32-bit library it names, usually lib32gcc-s1 or lib32stdc++6
Purple and black checkerboard texturesMap or model from another gameMount Counter-Strike: Source content, or add the addon with resource.AddWorkshop
Lag with many playershtopOne core at 100 %: fewer slots, fewer heavy addons, or a faster core

Which VPS plan fits a Garry’s Mod server?

Pick by CPU first, because the Source engine leans on one thread. Our Hi-CPU KVM line runs on AMD EPYC with ECC memory and is built for that kind of load; Standard KVM (Intel, DDR4 ECC) carries more vCores and RAM per price step, useful for several servers on one machine:

ServerHi-CPU KVMStandard KVM
Sandbox or TTT with friendsHI-CPU 2: 2 vCores, 4 GBSTANDARD KVM 1: 2 vCores, 4 GB
Public TTT or Prop HuntHI-CPU 3: 3 vCores, 6 GBSTANDARD KVM 2: 4 vCores, 8 GB
DarkRP community, or two serversHI-CPU 4: 4 vCores, 8 GBSTANDARD KVM 3: 6 vCores, 12 GB

vCores are shared virtual cores, not reserved physical ones. Every plan sits behind always-on DDoS filtering, which public Source servers need sooner or later, and you can pay by card, PayPal or crypto. Stock differs between Amsterdam and Frankfurt, so check the product page for your location. Our gaming VPS page sizes other popular games on both lines.

Frequently asked

Which port does a Garry's Mod server use?

UDP 27015 for players and the server browser, changed with -port on the start line. TCP 27015 is only used for RCON, so keep it closed unless you run RCON from another machine. A second server on the same VPS can take 27016.

Does a Garry's Mod server need a Game Server Login Token?

Yes. Facepunch's wiki calls it mandatory: since the May 2020 update, servers without a token rank far lower in the server list. Create one token per server at steamcommunity.com/dev/managegameservers with app ID 4000 and add +sv_setsteamaccount followed by the token to the start line.

How do I add Workshop addons to a Garry's Mod server?

Put the addons and maps in a public Workshop collection and start the server with +host_workshop_collection followed by the collection ID; it downloads them at start-up. So that players download them too, add one resource.AddWorkshop line per item ID in a Lua file under garrysmod/lua/autorun/server.

How much RAM does a Garry's Mod server need?

We found no official figure from Facepunch. 1 to 2 GB is a practical start for sandbox or TTT, and a large DarkRP server with many addons can use 3 to 4 GB. On the default branch the server is 32-bit, so one process cannot use much more than 4 GB, and the speed of one CPU core usually runs out first.

Related articles

All guides