How to Create Your Own Garry's Mod Server
Complete guide to create a dedicated Garry's Mod server on a VPS or dedicated Linux server: SteamCMD, GSLT token, gamemode, Workshop collection, administrators, RCON and systemd service.
On this page
Your values
Enter them once and the commands in this guide update.
This guide explains how to install and configure a dedicated Garry's Mod server on your VPS or dedicated Linux server: GSLT token, gamemode selection, Workshop collection, administrators, RCON and systemd service.
Order a Server
To host your Garry's Mod server, HostMyServers offers several gaming-oriented options. The Source engine mainly relies on a single core: favor a high-frequency processor.
- Performance VPS - Dedicated resources and fast processors, ideal for Garry's Mod
- NVMe VPS - For a small server or a test server
- Eco Dedicated Servers - To host several game servers
- Performance Dedicated Servers - Maximum performance
Prerequisites
- SSH access as root or user with sudo privileges
- 64-bit Linux system (Debian 12/13 or Ubuntu 22.04/24.04 recommended)
- Active firewall: nftables (recommended), iptables or ufw (use only one firewall tool at a time)
- A Steam account that owns Garry's Mod, to create the GSLT token
- Port 27015 UDP accessible, and port 27015 TCP (RCON) accessible from your fixed IP address only
Required Configuration
Facepunch does not publish an official configuration for the server. These values are estimates for a Sandbox server, to be adjusted according to the number of players and addons.
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 2 GB | 4 GB and more |
| CPU | 2 cores | 4 high-frequency cores |
| Storage | 10 GB | 30 GB NVMe SSD, more with the Workshop |
| Network | 100 Mbps | 1 Gbps |
System Update
sudo apt update && sudo apt upgrade -yInstalling Dependencies
SteamCMD and the default version of the server are 32-bit programs. Enable the i386 architecture, then install the required libraries:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y wget tar git lib32gcc-s1 lib32stdc++6 lib32z1 libtinfo6:i386 libncurses6:i386Creating a Dedicated User
The server must never run as root:
sudo adduser --disabled-password --gecos "" gmodPorts Used
| Port | Protocol | Usage |
|---|---|---|
| 27015 | UDP | Game and server list queries |
| 27015 | TCP | RCON (remote administration), restrict to your IP address |
Firewall Configuration
Open the game port to everyone, and restrict RCON to your fixed IP address: replace YOUR_IP.
With UFW
sudo ufw allow 27015/udp
sudo ufw allow from YOUR_IP to any port 27015 proto tcp
sudo ufw reloadWith iptables
sudo iptables -A INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p tcp -s YOUR_IP --dport 27015 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4Saving the rules across reboots requires the iptables-persistent package.
With nftables
These commands use the inet filter table and the input chain, present by default in /etc/nftables.conf on Debian.
sudo nft add rule inet filter input udp dport 27015 accept
sudo nft add rule inet filter input ip saddr YOUR_IP tcp dport 27015 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.confInstalling SteamCMD
Log in as the gmod user:
sudo -iu gmodCreate the directories and download SteamCMD:
mkdir -p ~/steamcmd ~/gmod-server
cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzf steamcmd_linux.tar.gzDownloading the Server
Start the server installation (application ID 4020):
./steamcmd.sh +force_install_dir /home/gmod/gmod-server +login anonymous +app_update 4020 validate +quitWhen it finishes, the message Success! App '4020' fully installed. is displayed.
Creating the GSLT Token
Facepunch requires a GSLT (Game Server Login Token) token for each server. Without a token, the server is heavily penalized in the server list ranking.
- Open the Steam Game Server Account Management page
- In App ID of the base game, enter 4000 (not 4020)
- Add a memo to identify the server, then click Create
- Copy the token you get
The Steam account must not be limited, community banned or locked. It must have an eligible phone number and own Garry's Mod.
Server Configuration
server.cfg File
nano ~/gmod-server/garrysmod/cfg/server.cfghostname "My Garry's Mod Server"
sv_password ""
rcon_password "ChangeMe"
sv_region 3
sv_lan 0
// Sandbox mode limits
sbox_maxprops 200
sbox_maxragdolls 10
sbox_maxvehicles 4
sbox_maxnpcs 10
sbox_godmode 0
sbox_playershurtplayers 1
// Ban lists
exec banned_user.cfg
exec banned_ip.cfgProtect the file, since it contains the RCON password:
chmod 600 ~/gmod-server/garrysmod/cfg/server.cfg| Parameter | Description |
|---|---|
hostname |
Public name of the server |
sv_password |
Password to join (empty = public) |
rcon_password |
RCON password |
sv_region |
Server list region (3 = Europe) |
sv_lan |
0 = server visible on the Internet |
sbox_maxprops |
Maximum number of props per player |
sbox_maxragdolls |
Maximum number of ragdolls per player |
sbox_maxvehicles |
Maximum number of vehicles per player |
sbox_maxnpcs |
Maximum number of NPCs per player |
sbox_godmode |
1 = invincible players |
sbox_playershurtplayers |
1 = players can hurt each other |
Launch Script
The script gathers the startup parameters and the token:
nano ~/gmod-server/start.sh#!/bin/bash
cd /home/gmod/gmod-server
exec ./srcds_run -game garrysmod -console -norestart \
-port 27015 \
+maxplayers 32 \
+gamemode sandbox \
+map gm_construct \
+sv_setsteamaccount YOUR_GSLT_TOKENReplace YOUR_GSLT_TOKEN, then restrict access to the script:
chmod 700 ~/gmod-server/start.sh| Parameter | Description |
|---|---|
-game garrysmod |
Game to launch (mandatory) |
-console |
Console mode |
-norestart |
Lets systemd handle restarts |
-port |
Server port |
+maxplayers |
Maximum number of players |
+gamemode |
Gamemode loaded at startup |
+map |
Starting map |
+host_workshop_collection |
Workshop collection to load |
+sv_setsteamaccount |
GSLT token |
First Launch
~/gmod-server/start.shThe server is ready when the console indicates it is connected to the Steam servers. Type quit to stop it, then exit the gmod user's session:
exitConfiguration as systemd Service
Create Service File
sudo nano /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=/home/gmod/gmod-server
Environment=TERM=xterm
ExecStart=/home/gmod/gmod-server/start.sh
LimitNOFILE=2048
Restart=on-failure
RestartSec=20
[Install]
WantedBy=multi-user.targetEnable and Start Service
sudo systemctl daemon-reload
sudo systemctl enable gmod.service
sudo systemctl start gmod.serviceManagement Commands
# Check status
sudo systemctl status gmod.service
# Stop server
sudo systemctl stop gmod.service
# Restart server
sudo systemctl restart gmod.service
# View logs
sudo journalctl -u gmod.service -fChecking That It Works
sudo systemctl is-active gmod.service
sudo ss -ulnp | grep 27015The service must be active and port 27015 must be listening. Then connect from the game to confirm access.
Connecting to the Server
- Launch Garry's Mod
- Enable the console in the game options, then open it
- Type:
connect SERVER_IP:27015 - If a password is configured, first type:
password YourPassword
You can also add the server to your Steam favorites (View menu, Servers, Favorites tab).
Choosing a Gamemode
The gamemode is set with +gamemode in start.sh. Its value matches the folder name in garrysmod/gamemodes/, with the same capitalization. After every change, restart the service.
| Gamemode | Value | Note |
|---|---|---|
| Sandbox | sandbox |
Included, default mode |
| Trouble in Terrorist Town | terrortown |
Included, requires Counter-Strike: Source content and a ttt_ map |
| DarkRP | darkrp |
Third-party project, to be installed |
Trouble in Terrorist Town
Download the Counter-Strike: Source content as the gmod user (ID 232330):
sudo -iu gmod
cd ~/steamcmd
./steamcmd.sh +force_install_dir /home/gmod/css-content +login anonymous +app_update 232330 validate +quit
nano ~/gmod-server/garrysmod/cfg/mount.cfgDeclare this content in mount.cfg:
"mountcfg"
{
"cstrike" "/home/gmod/css-content/cstrike"
}Then edit the launch script, exit the session and restart the server:
nano ~/gmod-server/start.sh
exit
sudo systemctl restart gmod.serviceIn start.sh, use +gamemode terrortown and a ttt_ map present on the server, for example from your Workshop collection. Players without the Counter-Strike: Source content will see missing textures and models.
DarkRP
Install the gamemode from its official repository:
sudo -iu gmod
git clone https://github.com/FPtje/DarkRP.git ~/gmod-server/garrysmod/gamemodes/darkrp
nano ~/gmod-server/start.sh
exit
sudo systemctl restart gmod.serviceIn start.sh, use +gamemode darkrp. Do not modify the repository's files: the project explains how to customize the gamemode and provide its content to players.
Adding a Workshop Collection
Create the Collection
- On the Garry's Mod Workshop, create a collection and add your addons to it
- Set its visibility to Public or Unlisted: a private collection is not accessible to the server
- Note the ID at the end of its address (
?id=...)
Load the Collection
Open the launch script:
sudo -u gmod nano /home/gmod/gmod-server/start.shAdd this line before +sv_setsteamaccount, replacing COLLECTION_ID:
+host_workshop_collection COLLECTION_ID \Then restart the server:
sudo systemctl restart gmod.serviceThe server downloads the collection and its sub-collections at startup, and checks for updates at every restart. To disable these updates, add host_workshop_autoupdate 0 to server.cfg. Be careful: a server left on an old version of a map can prevent players from connecting.
Listing Addons Without a Collection
Since game version 2026.09.22, you can also declare addons in garrysmod/cfg/srcds_workshop_ids.txt, which you create yourself:
"my_workshop_addons"
{
"1"
{
"wsid" "123277559"
}
"2"
{
"wsid" "111412589"
}
}Making Players Download the Content
The collection's maps and the Workshop-linked gamemode are offered to players automatically. For any other addon containing models, textures or sounds, create this file:
sudo -u gmod mkdir -p /home/gmod/gmod-server/garrysmod/lua/autorun/server
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/lua/autorun/server/workshop.luaresource.AddWorkshop( "ADDON_ID" )Add one line per addon. There is no need to do this for an addon made up solely of Lua code, and a collection ID is not accepted here.
Administration
Adding Administrators
First get the player's SteamID (in the STEAM_0:X:XXXXXXXX format) with the status command, once they are connected. Then edit the user list:
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/settings/users.txt"Users"
{
"superadmin"
{
"YourNickname" "STEAM_0:X:XXXXXXXX"
}
"admin"
{
"AModerator" "STEAM_0:X:XXXXXXXX"
}
}Restart the server to apply the list. When a player connects, a message confirms their group. Steam must have authenticated the player: if the group is not applied, restart Steam and reconnect.
The game does not provide a full administration menu. To add one, you can install the third-party addons ULib and ULX in garrysmod/addons/.
Using RCON
Your IP address must be allowed on TCP port 27015. In the game console:
rcon_address SERVER_IP:27015
rcon_password YourPassword
rcon status| Command | Description |
|---|---|
status |
Shows connected players and their SteamID |
changelevel <map> |
Change the map |
kickid <userid> |
Kick a player |
banid <minutes> <steamid> kick |
Ban a player (0 = permanent) |
removeid <steamid> |
Remove a ban |
writeid |
Save the bans to banned_user.cfg |
say <message> |
Send a message to all players |
exec server.cfg |
Reload the configuration |
quit |
Stop the server |
Server Update
Stop the server, back up your configuration files, then update:
sudo systemctl stop gmod.service
sudo -iu gmod
cp ~/gmod-server/garrysmod/cfg/server.cfg ~/server.cfg.bak
cp ~/gmod-server/garrysmod/settings/users.txt ~/users.txt.bak
cd ~/steamcmd
./steamcmd.sh +force_install_dir /home/gmod/gmod-server +login anonymous +app_update 4020 +quit
exit
sudo systemctl start gmod.serviceIf you installed DarkRP, update it too with git -C ~/gmod-server/garrysmod/gamemodes/darkrp pull, from the gmod user's session.
Automatic Backup
Backup Script
sudo nano /home/gmod/backup.sh#!/bin/bash
umask 077
BACKUP_DIR="/home/gmod/backups"
GAME_DIR="/home/gmod/gmod-server/garrysmod"
DATE=$(date +%Y-%m-%d_%H-%M-%S)
mkdir -p "$BACKUP_DIR"
cd "$GAME_DIR" || exit 1
# Keep only the items that exist
ITEMS=()
for item in cfg settings data addons sv.db lua/autorun/server; do
[ -e "$item" ] && ITEMS+=("$item")
done
tar -czf "$BACKUP_DIR/gmod_$DATE.tar.gz" "${ITEMS[@]}"
# Delete backups older than 7 days
find "$BACKUP_DIR" -name "gmod_*.tar.gz" -mtime +7 -delete
echo "Backup completed: gmod_$DATE.tar.gz"sudo chown gmod:gmod /home/gmod/backup.sh
sudo chmod 700 /home/gmod/backup.shThe sv.db file is the server's SQLite database: many addons and gamemodes store their data in it.
Schedule Backup
To get a consistent database, this task stops the server during the backup, then restarts it:
sudo crontab -e# Backup and restart every day at 5 AM
0 5 * * * systemctl stop gmod.service; sudo -u gmod /home/gmod/backup.sh; systemctl start gmod.serviceTroubleshooting
The server won't start
-
Check the logs:
sudo journalctl -u gmod.service -n 100 -
Check that the GSLT token is valid, has not expired and was created with App ID 4000
-
Check that
start.shis executable:sudo -u gmod ls -l /home/gmod/gmod-server/start.sh -
Look for a missing library:
Terminalsudo -u gmod bash -c 'cd ~/gmod-server && LD_LIBRARY_PATH=.:bin ldd srcds_linux | grep "not found"'
linux32/steamcmd: No such file or directory
This message usually means that the 32-bit libraries are missing, even though the file exists. Install them:
sudo apt install -y lib32gcc-s1libtinfo.so.5 or libncurses.so.5 Warning
Recent versions of Debian and Ubuntu no longer provide these old libraries. Create links to the version 6 files:
sudo ln -sf /usr/lib/i386-linux-gnu/libtinfo.so.6 /usr/lib/i386-linux-gnu/libtinfo.so.5
sudo ln -sf /usr/lib/i386-linux-gnu/libncurses.so.6 /usr/lib/i386-linux-gnu/libncurses.so.5steamclient.so Error
Create the link to SteamCMD's 32-bit file:
sudo -u gmod mkdir -p /home/gmod/.steam/sdk32
sudo -u gmod ln -sf /home/gmod/steamcmd/linux32/steamclient.so /home/gmod/.steam/sdk32/steamclient.soPlayers can't connect
-
Check that port 27015 is open over UDP:
Terminalsudo ufw status sudo iptables -L INPUT -n --line-numbers | grep 27015 sudo nft list ruleset | grep 27015 -
Check that the server is listening:
sudo ss -ulnp | grep 27015 -
Wait for the Workshop download to finish at startup
The server doesn't appear in the list
- Check that
sv_lan 0is set inserver.cfg - Check in the logs that the GSLT token is being taken into account
- Wait a few minutes after startup
The Workshop collection doesn't download
- Check that the collection is public or unlisted
- Check the ID in
start.sh - Check the disk space:
df -h
Purple textures or ERROR models
The content is missing on the player's side. Add the addon with resource.AddWorkshop, or check mount.cfg if the content comes from another game.
The gamemode or an addon isn't loaded
Linux is case-sensitive. The name passed to +gamemode must exactly match the folder. For old addons installed by hand, use only lowercase in the folder name and adapt the Lua paths that refer to it.
FAQ
Do I need to open ports for Steam?
If your firewall blocks incoming traffic by default, these rules allow the server to receive replies from the Steam servers:
UFW:
sudo ufw allow proto udp from any port 27000:27030 to any port 1025:65535
sudo ufw allow proto udp from any port 4380 to any port 1025:65535
sudo ufw reloadiptables:
sudo iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65535 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65535 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4nftables:
sudo nft add rule inet filter input udp sport 27000-27030 udp dport 1025-65535 accept
sudo nft add rule inet filter input udp sport 4380 udp dport 1025-65535 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.confIs there a 64-bit version of the server?
Facepunch offers an x86-64 branch, which this guide does not cover. Like any development branch, it is updated regularly and may be less stable. See the Garry's Mod wiki before using it.
Can I host several servers on the same machine?
Yes. Use a separate folder, port (-port 27016, to be opened in the firewall), systemd service and GSLT token for each server.