Some of you may not know, but I’m a big fan of gaming. I have a special place in my heart for Source games specifically. When I was 12 I bought the Orange Box, specifically to play Team Fortress 2, eventually playing the Half-Life 2 games and Portal.

I then bought Garry’s Mod, which is pretty much dozens of different gamemodes mashed together into a single game client, a true testimony to what an active modding community can achieve if they put their backs into it.

I had registered to the Google Cloud Platform (GCP for short) almost a year ago, but had little use for it outside of its free API offerings (I built a WhatsApp bot and integrated some geo-searching funcionality to it via the Google Places API). Well, Google does give you 300$ to try out their services, and it’s valid for 1 year only. My year’s about to expire, I have 300$ worth of GCP credits to spend, what should I do?

It was around that time that I was introduced to a custom map in Half-Life’s (yes, the original!) mod Sven Co-Op. The map is called bm_sts and it’s for the time, I must say it was pretty damn impressive (even in today’s standards). You create an army of monster, level them up and let them fight each other, every so often there’s a bonus round where the players fight each other is various short-burst gamemodes. It’s intense, it’s fun, and as of late some guy made a GMod version!

I was hooked from the minute I saw it, and upon looking for servers running this gamemode, I got an empty list.
Well, I have some credits, a game I’m completely obsessed about, and absolutely no knowledge whatsoever in Source Dedicated Server hosting… Time to make a game server!

The things I did on the GCP side (which I’m not going to dive into because that’s general cloud stuff) are:

  1. I created an Ubuntu VM (duh!)
  2. I gave it a static public IP address
  3. I opened the needed ports (27015 UDP/TCP, both ways)

So the first thing I needed to do to create the server is, well, install Steam on it, specifically the commandline version of Steam called SteamCMD. I had to run a bunch of commands:

sudo add-apt-repository multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install lib32gcc1 steamcmd

Since I was running the server on a 64-bit machine, I had to install some 32-bit libraries, as you can see.

Now, before you proceed, it might be a good idea to create a new user with which you’ll administer the server, running the server with root is highly discouraged. In my case, I’ll create a user called “steamadmin”.
Also, for the sake of minimizing disorganization, I’ll create the folder /opt/steamgames in which we’ll install the games.

sudo useradd steamadmin --shell /bin/bash # Default shell is sh
sudo passwd !$ # Sets user password, !$ means last word in the last command
sudo mkdir /opt/steamgames
sudo chown steamadmin !$  && !#:0 chgrp !#:2 !$ # !:n refers to n-th word on line
# Unpacked command (You can run either of these, they're the same):
sudo chown steamadmin /opt/steamgames  && sudo chgrp steamadmin /opt/steamgames

Ok, fantastic! Now that we have created our user and game install folder, and gave the user ownership of it, let’s get to actually installing the server. The command we need is:

steamcmd +force_install_dir /opt/steamgames +login anonymous +app_update 4020

After the dedicated server software downloads, we can start the server! If you navigate to the installation directory, you’ll see a file names srcds_run, this executable is the dedicated server software used to run our server. We can pass it some arguments or specify them in the different configuration files. Let’s take a look at this line:

./srcds_run -game garrysmod -maxplayers 16 +host_workshop_collection 2463084481 +gamemode sandbox +map gm_construct

Now, this is pretty self-explanatory, we specify some basics here, such as the game, max players, gamemode and map, and we can even point to a certain workshop collection that the server will download. The number is the collection ID, and you can get it from the URL when you navigate to the collection on the Steam Workshop.

As you may have noticed, we’re missing some important information, like the name of the server, variables, and the games we’d like to mount. To do these things, we’ll utilize several files. They all reside in <installation dir>/garrysmod/cfg.


This file is where we define the server name and other important things such as server variables.

Here’s an example:

"hostname"              "This is my server"
"sbox_noclip"           "0"
"sv_alltalk"            "1"
"nextlevel"             "gm_construct"
"gamemode"              "sandbox"


This file specifies game content to mount into our server, and where their installation is located.

Here’s an example:

//      "hl" : "/opt/steamgames/steamapps/common/Half-Life"
        "hl2" : "/opt/steamgames/steamapps/common/Half-Life 2/hl2"
        "episodic" : "/opt/steamgames/steamapps/common/Half-Life 2/episodic"
//      "ep2" : "/opt/steamgames/steamapps/common/Half-Life 2/ep2"
//      "cstrike" : "/opt/steamgames/steamapps/common/Counter-Strike Source"
//      "tf" : "/opt/steamgames/steamapps/common/Team Fortress 2"

In this file, only HL2 and HL2:EP1 (“Episodic”) will be mounted, the other games are commented out and the server will ignore them.

Well, that’s pretty much all you need to know to start your own Garry’s Mod server.
I hope you found this tutorial useful and you can feel free to contact me if you have any questions.


About the Author

Orel Fichman

Tech Blogger, DevOps Engineer, and Microsoft Certified Trainer

No responses yet

Leave a Reply

Your email address will not be published.