01
Before you start
You need a VPS running Ubuntu 24.04, a user with sudo rights and a GSLT token, created free of charge on Steam's game server management page with app ID 4000 (Garry's Mod's). The Source engine mostly runs on one core: a processor that is fast per core matters more than the number of cores.
The guide create a Garry's Mod server explains the token, gamemodes and addons; this one focuses on installation under Linux. If you would rather not administer anything, Garry's Mod hosting does all this for you.
02
Installing SteamCMD
SteamCMD downloads and updates Steam games' dedicated servers. On Ubuntu, it is in the multiverse repository and needs the 32-bit architecture:
sudo add-apt-repository -y multiverse
sudo dpkg --add-architecture i386
sudo apt update && sudo apt install -y steamcmd
sudo useradd -r -m -d /opt/gmod -s /bin/bash gmod
As with any game server, run it under a dedicated user, never as root.
03
Downloading the dedicated server
The Garry's Mod dedicated server has ID 4020 on Steam. It downloads without an account, anonymously:
sudo -iu gmod
/usr/games/steamcmd +force_install_dir /opt/gmod/serveur +login anonymous +app_update 4020 validate +quit
Run the same command at every Garry's Mod update: a server one version behind refuses up-to-date players.
04
First start
cd /opt/gmod/serveur
./srcds_run -game garrysmod -console -port 27015 +maxplayers 16 \
+gamemode sandbox +map gm_construct +sv_setsteamaccount YOUR_TOKEN
Replace sandbox with the gamemode you want (DarkRP, TTT…) and the map with yours. For addons, add +host_workshop_collection followed by your Workshop collection ID: the server downloads it at startup.
Lasting settings (server name, RCON password, fast download) go in garrysmod/cfg/server.cfg. If the server stops immediately reporting a missing library, install the 32-bit libraries named in the message.
05
A service that restarts by itself
Create /etc/systemd/system/gmod.service:
[Unit]
Description=Serveur Garry's Mod
After=network-online.target
[Service]
User=gmod
WorkingDirectory=/opt/gmod/serveur
ExecStart=/opt/gmod/serveur/srcds_run -game garrysmod -console -port 27015 +maxplayers 16 +gamemode sandbox +map gm_construct +sv_setsteamaccount YOUR_TOKEN
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now gmod
journalctl -u gmod -f
06
Ports, security and backups
- Game port:
sudo ufw allow 27015/udp. The same number in TCP is used for remote administration (RCON): keep it closed if you do not need it.
- RCON password: long and unique, in
server.cfg, never shared in a Discord channel.
- Addons: a Lua addon runs with the server's rights. Install those from known sources, and read what a free addon found at random does.
- Backups: the
garrysmod/data folder, the database if your gamemode uses one, and your configuration files, copied off the VPS.
- Attacks: a public server is a frequent target; the guide protecting a game server from DDoS attacks explains what to check with the host.
07
On a CloudFive VPS
Our Ryzen VPS runs on Ryzen 9 9950X, very fast per core, with NVMe storage and anti-DDoS protection included; the game-specific filter is available as an option for a public server. For the community's website, loading screen and fast download, see the guide web hosting for a GMod server.
08
Frequently asked questions
What is the Steam ID of the Garry's Mod dedicated server?
4020 for the dedicated server, downloaded with SteamCMD. The GSLT token is created with the game's ID, 4000.
Which port should be opened for a Garry's Mod server?
Port 27015 in UDP for the game. The same port in TCP is used for RCON: only open it if you administer the server remotely.
How do I update a Garry's Mod server on a VPS?
Stop the server, run the SteamCMD command app_update 4020 validate again, then restart. Do it at every game update, otherwise up-to-date players are refused.
How do I add a Workshop collection on a Linux server?
Add +host_workshop_collection followed by the collection ID to the startup line: the server downloads it at launch.