Community Admins: Set Up a GMod Server with AppID 4020 and systemd
Practical guide for community admins: configure SteamCMD, AppID 4020, GSLT, systemd autostart, and UDP port 27015.
Halloween at Nexthosting: 10% off game servers with the code – until November 1
Practical guide for community admins: configure SteamCMD, AppID 4020, GSLT, systemd autostart, and UDP port 27015.
Install SteamCMD, download AppID 4020 with it, start SRCDS with a valid GSLT token, and open UDP port 27015 in your firewall. For a quick test round, that is easily enough on a VPS; for a permanent community server, you should also set up autostart with systemd. With some Linux experience, a Garry’s Mod server is up and running comparatively quickly. If you want to save yourself the administration work, choose managed hosting instead.
In short:
- For a permanent server, you should set up systemd automation to make sure it restarts after crashes.
- To be visible, the server needs a correctly installed GSLT, which is not entered in
server.cfgbut used in the start command.- Each server instance needs its own GSLT, because using one token multiple times causes conflicts in the server browser.
- For public servers, DDoS protection is essential, and the server location should be chosen close to the player community.
- Opening UDP 27015, 27020, and 27005 is essential to be visible in the browser and to avoid connection problems.
Before you can set up your Garry’s Mod server, you need to make a decision: your own VPS or a managed game server. A VPS gives you full control over the operating system, but requires basic Linux knowledge for firewall, updates, and backups. Managed hosting handles provisioning, DDoS protection, and backups automatically and above all saves time compared to a plain rental without management.
For hardware, rough guideline values apply, depending on player count and installed addons:
The hardware options depend on the number of players, from smaller servers with a few cores and a few gigabytes of RAM to larger setups with multiple cores, plenty of RAM, and enough SSD storage.
Choose the server location close to your player base, which noticeably lowers ping. DDoS protection is not a luxury on public servers but a basic requirement, since GMod servers are regularly targeted by attacks.
Pro tip: Plan for significantly more RAM on roleplay or DarkRP servers than on a plain sandbox instance. Many Lua scripts and database queries quickly drive up memory usage.
SteamCMD is Valve’s official command-line tool that you use to download and keep the Garry’s Mod Dedicated Server (AppID 4020) up to date. On Linux, it is best to set up a separate non-root user, for example named “steam”, before you unpack SteamCMD.
/home/steam/gmodserver, and change into it.steamcmd package or the official archive from the Valve Developer Wiki.steamcmd +login anonymous +force_install_dir /home/steam/gmodserver +app_update 4020 validate +quit.For later updates, a small script such as update_gmod.sh is worthwhile, which calls the same command automatically. Make it executable with chmod +x update_gmod.sh. The Facepunch Wiki for Linux setups recommends exactly this non-root approach, because running as root creates unnecessary risks in case of security vulnerabilities.
Pro tip: Do not confuse force_install_dir with the current working directory. The path must be set before +app_update, otherwise SteamCMD installs into a folder you will not be able to find later.
Without a Game Server Login Token, your server is downgraded in the browser or does not show up at all. You create the GSLT for free on Valve’s Steamworks page, linked to your Steam account and AppID 4020.
Put the token directly into the start line, not into server.cfg, because configuration files more often end up in public backups or repositories by accident. A typical start line on Linux looks like this:
./srcds_run -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 24 +sv_setsteamaccount DEIN_GSLT_TOKEN +host_workshop_collection 123456789srcds.exe accordingly, with the same parameters.The setup guide for dedicated Garry’s Mod servers names exactly this problem as one of the most common causes when a server is running but not visible.
You find the collection ID in the URL of your Steam Workshop collection. It goes directly into the +host_workshop_collection <ID> parameter of your start line, so the server automatically loads all included addons and distributes them to connected clients.
resource.AddWorkshop in your Lua scripts if individual addons should be forced independently of the collection.sv_downloadurl so clients do not download via the slow default transfer.An overloaded collection is one of the most common performance killers: too many addons cause long load times and Lua errors, especially when new players connect for the first time.
Pro tip: Test new addons on a separate test instance first, before adding them to the production collection. A single faulty script can crash the entire server.
For your Garry’s Mod server to start up again automatically after a reboot or crash, you need a systemd service file instead of a manual start via SSH.
/etc/systemd/system/gmod.service with the fields User=steam, WorkingDirectory=/home/steam/gmodserver, ExecStart=/home/steam/gmodserver/srcds_run …, and Restart=on-failure.LimitNOFILE=100000 to avoid problems with too few open file descriptors in continuous operation, as described in the detailed ITPiran tutorial.systemctl enable gmod.service and start it with systemctl start gmod.service.journalctl -u gmod.service -f.An alternative is a cron job with @reboot, which is simpler but offers no automatic restart logic for crashes during operation.
The default game and query port is UDP 27015. In addition, SourceTV often uses UDP 27020, and clients connect locally via UDP 27005. If a firewall rule is missing, the server does not show up in the browser, even if the process is running correctly.
On Ubuntu or Debian, you open the ports with ufw allow 27015/udp, then check the status with ufw status. With a Fritzbox or a router behind CGNAT (carrier-grade NAT), port forwarding is often not enough; you can tell because external port checks fail despite correct firewall rules. In that case, the only option is a host with a real public IP or a VPN tunnel.
Pro tip: Always test reachability from outside your own network, for example over a mobile network. A test from the same LAN often wrongly reports the port as open.
Garry’s Mod mainly uses one core intensively for physics calculations and Lua execution. A processor with a high clock speed per core therefore delivers noticeably better results than many but slower cores, as practical setup guides also confirm.
maxplayers realistic for the available hardware; more players mean disproportionately more load.If you push the limits of single-core performance, you will find similar considerations with Rust servers with high clock speed demands; the principle applies to many Source engine spin-offs.
Back up the folders garrysmod/maps, garrysmod/addons, and the configuration files in garrysmod/cfg regularly. A simple rsync cron job to a second storage location or object storage is completely sufficient for most communities.
systemctl stop gmod.service.steamcmd +login anonymous +force_install_dir <pfad> +app_update 4020 validate +quit.If problems occur after an update, a rollback to the last working backup of the configuration files often helps, while the game content itself is re-synchronized via validate.
The most common cause of an invisible server is a missing or incorrect GSLT in the start line. Also check whether sv_lan is set to 1 by mistake, which hides your server from the public list.
ss -uln or the older netstat -uln and compare them with ufw status.journalctl -u gmod.service -n 100 for error messages at startup.+app_update 4020 validate.According to the RedSwitches setup guide, a missing GSLT is by far the most common reason for a server that is technically running but invisible.
Most problems with a Garry’s Mod server are not caused by faulty hardware but by poor operational organization. Separate test and production servers consistently, plan fixed maintenance windows for updates, and deliberately limit the number of active addons instead of putting every interesting extension live right away.
Managed hosting is especially worthwhile if you lack basic Linux knowledge or do not want to manage DDoS protection and provisioning yourself. A good support channel often saves more time than any additional automation.
— Erik
Once you have worked through the previous steps, you know: SteamCMD, GSLT, systemd, and firewall rules are doable, but they cost time that you could also put into the actual server experience. This is exactly where Garry’s Mod hosting at Nexthosting comes in. Provisioning and DDoS protection run automatically, and you start backups at the click of a button or on a schedule in the panel, without you having to write a firewall rule or debug a systemd service yourself.
This is particularly useful for communities that want to run a reliable server in Germany without deep Linux knowledge, but still keep access to Workshop collections, RCON, and custom start parameters. If you would rather have full root control over the operating system, a VPS is the right foundation for your own implementation. Take a look at the product page and compare which option better fits the effort you want to invest.
For deeper technical questions, it is worth going straight to the primary sources. The Facepunch Wiki page on server installation remains the most reliable reference for SteamCMD commands and AppID details. If you are looking for an automated alternative to manual management, LinuxGSM is an established tool that combines update and autostart logic in a single script. For general SteamCMD questions beyond GMod, the Valve Developer Wiki can help.
Install SteamCMD, download AppID 4020 with it, create a GSLT, and start the server via srcds_run with the right parameters for map, game mode, and player count.
You can choose between your own VPS with full control and a managed offering like Nexthosting, depending on how much of the administration you want to handle yourself.
Use SteamCMD with the command +app_update 4020 validate to download the server files, then start srcds_run with a valid GSLT and the start parameters you want.
Besides the base files of AppID 4020, you need the TTT game mode, matching maps from the Workshop, and enough RAM for the additional role-logic scripts. On roleplay servers, RAM requirements can be significantly higher than on a plain sandbox instance.
At least UDP 27015 for the main game, plus UDP 27020 for SourceTV and UDP 27005 for local client connections.