How to setup a dedicated server for GMOD (Garry's Mod)
Publisher: Psychz Networks, March 05,2021Garry's Mod (GMod) is a physics sandbox stuffed with art and models from Valve software's popular games, including Half-Life 2 and Counter-Strike. With a large library of generic objects, recognizable props from Valve's games, and pre-built devices such as thrusters and wheels, users can build and share nearly anything they can imagine.
The following article will learn how to set up and install the Gmod server on Ubuntu 18. We will first start with understanding the hardware specifics and other dependencies
- System requirement
- Ports Specifications
- Add new user
- Install the dependencies
- Installing SteamCMD
- Installing the Garry's Mod server
- Running Garry's Mod server
- Connecting to your game server
System Requirements
- CPU: 2.4 GHz/3.4GHz Turbo
- RAM: 8 GB
- Disk space: 35 GB
Ports required Open
You'll want to open the following ports:
- Game Client: UDP 27015
- Raw UDP Port: UDP 27016
- RCON Port: TCP 27036
Create a new user
For security reasons, we will create a new user and setup the game server under it. It is not recommended to use root access for running game server.
# sudo adduser gmod
output
Adding new group `gmod' (1001) ...
Adding new user `gmod' (1001) with group `gmod' ...
Creating home directory `/home/gmod' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gmod
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
Note: You can choose the fill in the information above as per your requirement, or you can hit enter at each step to skip the steps.
Let us now switch to this user
# su - gmod
Now, let us make a folder where we would be installing all the game files
# mkdir gmod_server
Install the dependencies
If you are using 64-bit distribution, you need to install a package named lib32gcc1 or ia32-libs. This is because Steam is compiled for i386 architecture only.
# sudo apt-get install lib32gcc1 software-properties-common -y && sudo dpkg --add-architecture i386 && sudo apt-get update
Install SteamCMD
Download the compressed file from Steam server
Extract the content of the files using following command
# tar -xvzf steamcmd_linux.tar.gz
Installing the Garry's Mod server
Let us first login to the steam server
# ./steamcmd.sh
SteamCMD should download an update, then will give you a steam prompt like this:
Steam>
Now, log in using your steam account.
output
Logged in OK
Waiting for user info...OK
Steam>
Now type
steam> force_install_dir /home/steam/gmod_server
Note:You can replace the directory path as per your requirement.
steam>app_update 4020 -validate
Note: The Garry's Mod server will start downloading; this may take a minute. 4020 is the AppID of Gmod on the steam server.
Output
.
.
Update state (0x61) downloading, progress: 93.02 (3703162662 / 3981008900)
Update state (0x61) downloading, progress: 93.02 (3703162662 / 3981008900)
Update state (0x61) downloading, progress: 93.13 (3707493627 / 3981008900)
Update state (0x61) downloading, progress: 94.84 (3775739513 / 3981008900)
Update state (0x61) downloading, progress: 94.92 (3778885241 / 3981008900)
Update state (0x61) downloading, progress: 95.11 (3786225273 / 3981008900)
Update state (0x61) downloading, progress: 96.96 (3859839418 / 3981008900)
Update state (0x61) downloading, progress: 99.78 (3972093010 / 3981008900)
Success! App '4020' fully installed.
You can now logout from the steam account
steam> quit
Running Garry's Mod server
We will now run the game server so your players can start connecting.
Go to your folder where we have installed Gmod files.
# cd server_path
Now, run the following command to start the server.
# ./srcds_run -game garrysmod -maxplayers 16 +gamemode sandbox +map gm_flatgrass
Output
.
.
.
.
RecordSteamInterfaceCreation (PID 20342): SteamGameServer013 /
RecordSteamInterfaceCreation (PID 20342): SteamUtils010 /
RecordSteamInterfaceCreation (PID 20342): SteamNetworking006 /
RecordSteamInterfaceCreation (PID 20342): SteamGameServerStats001 /
RecordSteamInterfaceCreation (PID 20342): STEAMHTTP_INTERFACE_VERSION003 /
RecordSteamInterfaceCreation (PID 20342): STEAMINVENTORY_INTERFACE_V003 /
RecordSteamInterfaceCreation (PID 20342): STEAMUGC_INTERFACE_VERSION014 /
RecordSteamInterfaceCreation (PID 20342): STEAMAPPS_INTERFACE_VERSION008 /
Connection to Steam servers successful.
Public IP is 104.217.3.7.
Assigned psychz_net gameserver Steam ID [A-1:3595079686(16693)].
VAC secure mode is activated.
Note down your Public IP in case you want to share it with your friends. In the above case, the Public IP is 104.217.3.7.
Joining the server
Step 1: From your local machine, open Garry's Mod
Step 2: Click options
Step 3: Click the ~ key (below escape)
Step 4: Type connect then the server IP, so in my case:
connect 104.217.3.7
Conratulations! You have now successfully connected to your newly established Garry's Mod Sever.
We hope you have found this guide helpful and could successfully deploy GMod on your Ubuntu server. Please click on the up-vote button to show your appreciation.