Setting Up a Garry's Mod Server
Step 1 — Install SteamCMD
add-apt-repository multiverse -y
dpkg --add-architecture i386
apt update
apt install steamcmd lib32gcc-s1 -y
Step 2 — Download GMod Server Files
adduser steam && su - steam
steamcmd +force_install_dir ~/gmodserver +login anonymous +app_update 4020 validate +quit
Step 3 — Create a Startup Script
nano ~/start-gmod.sh
#!/bin/bash
cd ~/gmodserver
./srcds_run -game garrysmod +gamemode sandbox +map gm_flatgrass +maxplayers 16 +hostname "My GMod Server" -port 27015
chmod +x ~/start-gmod.sh
Step 4 — Open Firewall Ports
ufw allow 27015/tcp
ufw allow 27015/udp
ufw allow 27005/udp
Step 5 — Start the Server
screen -S gmod ~/start-gmod.sh
Install SourceMod and MetaMod (for plugins)
cd ~/gmodserver/garrysmod
wget https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6934-linux.tar.gz
tar -xzf sourcemod-1.11.0-*.tar.gz
Change Game Mode (Examples)
- TTT:
+gamemode terrortown +map ttt_minecraft_b5
- DarkRP:
+gamemode darkrp +map rp_downtown_v4c_v2
- PropHunt:
+gamemode prop_hunt +map ph_office