Garry's Mod

Garry's Mod

137 ratings
How to set up a dedicated server (Garry's Mod)
By ajgeiss0702
This guide will show you how to set up a Garry's Mod Dedicated Server, will show you how to add workshop addons to it, and will show you how to mount Counter-Strike: Source content.
2
4
   
Award
Favorite
Favorited
Unfavorite
Introduction
Hello! I am aj, the owner of AstroGmod, and people have been asking me how to set up a server, so here ya go! This is how I do it, and I am well aware that there are other ways to do this.

Unfortunately, mac gmod servers can no longer be installed with the normal steamcmd tools. You can try to use Wine instead

Here is what we will be doing in this guide:
  • Installing SteamCMD (to download the server)
  • Installing the Garry's Mod server
  • Making a workshop collection to add addons to the server
  • Installing a CSS server (recommended, not required)
  • Mounting CSS content (recommended, not required)
  • Join it without having to look for it in the server browser

Some skills you will need for this guide:
  • Understand how to use a computer (duh)
  • Some-what comfortable with running command line based programs.

Here we go!

Installing SteamCMD
To install a DS (dedicated server, remember that) for pretty much any source game, you need to have SteamCMD installed. If you already have it installed, skip to the Downloading the Server header.

Installing cmd is different for different operating systems, so here are the different installs:


Windows
  1. Make a folder somewhere you will remember, and call it SteamCMD
  2. Download the zip from here
  3. Extract steamcmd.zip into the SteamCMD folder


Linux
This part will only use the command line
  1. Make a folder with the console command "mkdir FOLDERNAME" (without quotes, replace FOLDERNAME with what you named your folder)
  2. Use "cd FOLDERNAME" to go into the folder (replace FOLDERNAME with what you named your folder)
  3. Install SteamCMD, different for diffrent kinds of operating systems. The text will be what you put in the console


    You now have SteamCMD installed and I will show you how to use it in the next step


Installing the gmod server
Ok! now that you have SteamCMD installed, we have to download the actual server.


Automating the process
If you are lazy and don't want to spend the time doing all of this stuff, for mac and linux (idk for windows) first put in your steamcmd executable (steamcmd.sh or steamcmd.exe) then type this after:
+login anonymous +app_update 4020 validate +quit
dont forget the space before login (one between the executable and the login)

Launching SteamCMD
Launching SteamCMD is a little different for different operating systems.
  • Windows: Drag steamcmd.exe into cmd
  • Mac: type ./ then drag steamcmd.sh into the terminal
  • Linux: (make sure you did cd into the folder) type ./steamcmd.sh

Logging in and installing
SteamCMD should download an update, then will give you a steam prompt like this:
Steam>
Once you see this, follow these steps:
  1. Type
    login anonymous
  2. Now type
    force_install_dir ../SERVER
    (replace SERVER with what you want the folder to be called)
  3. Then type
    app_update 4020 -validate
    • The garrysmod server will start downloading, this may take a minute
  4. You can now type this to close steamcmd:
    quit

Congrats! The garrysmod server is installed! The next section will show you how to launch it to see that everything is working
Testing the server
Now that we have the server installed, we should test it to make sure it is working!

Starting the server
Windows:
  1. Make a new blank bat file (if you don't know how then google it)
  2. Paste in this:
    @echo off start srcds.exe -console -game "garrysmod" +exec "server.cfg" +gamemode sandbox +map gm_construct +maxplayers 16 pause
  3. Save the bat file in your server folder and double-click it. You should see your server start up. Now see "Getting the server IP"

Linux:
  1. Type into the console:
    cd SERVERPATH
    • replace SERVERPATH with the path to your server folder
  2. Run this command:
    ./srcds_run -game garrysmod -maxplayers 16 +gamemode sandbox +map gm_flatgrass
    • No, the dot at the beginning is NOT a mistake

    Getting the server IP
    1. Type status into server console (the thing that opened when you clicked the bat file)
    2. Copy the numbers before public ip example:
      hostname: Garry's Mod version : 16.12.01/24 6614 secure udp/ip : 192.168.7.5:11111 (public ip: 184.182.60.64) map : gm_construct at: 0 x, 0 y, 0 z players : 0 (16 max)
      In my case it would be 192.168.7.5:11111
    NOTE: when you want to send the ip to your friends later, send them the public ip!

    Joining the server
    1. Open Garry's Mod
    2. Click options
    3. Click the ~ key (below escape)
    4. Type connect then the server IP, so in my case:
      connect 184.182.60.64
    You should start joining your server

    Check these things:
    • You can connect
    • You can move around
    • You have items
    • You can spawn props
    If one or more of these things are not working, join my discord support channel and I will try to help you fix it.

    You can now stop your server by typing quit

    Congrats! Your server is now working! The next part will show you how to add addons to your server.
Adding addons to your server
In order to add addons to your server, we must make a workshop collection and put all of the addons you want in there.

Creating a collection and adding addons to it
To create a collection, just go to the Garry's Mod workshop page, hover over Browse, and click Collections. Then go ahead and click Create Collection

Go ahead and fill out everything it asks for, and click Save and Continue.
Then add all of the addons you want on the next page.

To add addons after this part, go to the addon page and click Add to Collection (right under the pictures), then check the box next to the collection name.

Once you have the collection created, you must add it to the server, so in your start script (what you run to start the server, a .bat file for windows) add this:
+host_workshop_collection WORKSHOPID
Make sure to replace WORKSHOPID with the collection id that can be found in the url bar.


So your start command should look something like this: (the file for windows will be different, but the part after srcds_run is the same)
./srcds_run -game garrysmod -maxplayers 16 +host_workshop_collection 910942406 +gamemode sandbox +map gm_flatgrass

When you start your server, the server will download all of the addons in that collection.


Your server now has addons! Next I will show you how to mount CSS so you will not just go through some props.
Mounting CSS
Even if you have textures, you may still pass through some css props if a map has it, which can sometimes break a game (and make some players mad). In order to fix this, we must install a Counter Strike: Source (CSS) server.

Installing the CSS server
  1. Launch steamcmd and login as anonymous
  2. use force_install_dir to make a folder (put it somewhere where you will be able to remember the path)
  3. This will put the css server in /css (in the home directory):
    force_install_dir ../css
  4. Install the server with
    app_update 232330 -validate

Mounting CSS
You need to tell your server where it can find the css files, right? To do this, go into your garrysmod server folder, go to garrysmod/cfg and open the mount.cfg. Remove the slashes infront of cstrike and put your path in the second quotes (replace the path that was already there)

So, your file should look something like this: (on windows make sure to put the drive letter before, like C, or D)
// // Use this file to mount additional paths to the filesystem // DO NOT add a slash to the end of the filename // "mountcfg" { "cstrike" "/home/ajgeiss0702/css_server/cstrike" // "tf" "C:\mytf2server\tf" }

Start your server and check to see if CSS is mounted by typing:
maps cs
If nothing shows up, CSS is not mounted and you did something wrong (Tell me in my discord and I will try to help you). If map names show up, you're good!
Customization
Now you can change the name, loading screen, and the password of your server!

All of these will be done in server folder/garrysmod/cfg/server.cfg


Changing the server title/name
Simply add hostname then the name you want in quotes.
Example:
hostname "AstroGmod"
This will make the server show up as AstroGmod in the server list.


Changing the loading screen
You can set a loading screen that will show while your players are downloading the addons for your server.
NOTE: You need some kind of web hosting/website for this to work. If you dont have one, 000webhost is what I used before I got my own website.
I recomend ICBTIALS[gmod.facepunch.com]. I use it on my server, and it looks pretty good.

Simply add sv_loadingurl then the URL in quotes.
Example:
This will make show my loading screen when players are loading (this is the URL I use for my servers)
DO NOT PUT MUSIC ON THE LOADING SCREEN!!
This annoys 99.9% of players that want to watch a video or something in the background while they are downloading all of your addons

Setting a password
Use this if you are just setting up a server for you and your friends and don't want random people to join.

Just add sv_password then the password you want in quotes.
Example:
sv_password "$Th1sIsTheStrong3stPasswordEverToEx1st"
FAQ
No one can connect! Even me!
Make sure you have allowed ports 27005-27015 through the firewall. Steps to do this can vary depending on what operating system you have
My friends can't join, but I can??
Make you have port forwarded with ports 27005 through 27015 (make the last number higher if you have more servers). Make sure you have also allowed both TCP AND UDP.

If that still does not work, make sure you are giving them the public ip, and not a 192.168.#.## or 10.#.#.## (local IP).

My friends can join, but I can't??
Make sure you use the LAN IP (192.168.#.## or 10.#.#.##) and give your friends the public one.

I can walk through some props (boxes usually)???
Please mount CSS (read the mounting CSS part of this guide).

How to I change the name of the server?
See the Customization part of the guide.

How to I set a password so random people cant join?
See the Customization part of the guide.

I'm getting ERROR! Failed to install app '4020' (Invalid platform)
Unfortunately, OSX (mac) gmod servers will not work anymore. Try using Wine[winehq.org], or find another computer with windows or linux
Conclusion
Thank you for taking the time to read my guide and set up a server! This is my first guide, so if you find any mistakes, then please tell me and I will try to fix it.

If you had any problems at any point in this process, please read the FAQ, then join my discord support channel[discord.gg] for the fastest support. If you do not have discord, use the comments.

Have fun!

Sources


167 Comments
2tone Nov 9 @ 11:25pm 
:steamthumbsdown:
2tone Nov 9 @ 11:25pm 
suka nihya ne ponyal, idi nahui
blue skeleton [goob :P] Apr 19 @ 2:15pm 
m friend cant join!!!111
Sir Kuhmsizhn Mar 19 @ 11:25am 
Succinct and to the point guide. Was about to contact you regarding issues with mounting episodic content, but I've managed to figure it all out. All I will add, is if you're installing on Windows, it's best to do step to of choosing your directory BEFORE logging in, if you come across the issue of not being able to select a directory before logon. Thank you for the guide, I can now set my friends on fire.
blue skeleton [goob :P] Oct 25, 2023 @ 10:41am 
nevermind its the configuration stuff
blue skeleton [goob :P] Oct 25, 2023 @ 10:35am 
Dedicated server app says my server is alive. but nothing
SmashFanx Sep 24, 2023 @ 3:58pm 
when i use force_install_dir it says i gotta use it before loging in, and app_update says app state is 0x202 or smth after the update job
Oxame May 19, 2023 @ 10:54am 
can u add VIDEO tutorial, And in some moments I do not understand anything...
i'll fa Q Jan 5, 2023 @ 8:00pm 
sudo chmod 777 ./steamcmd.sh
ilovepancakes1012 Dec 9, 2022 @ 8:46pm 
well yeah its kinda required to host a server