Garry's Mod on CentOS 7

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

Garry’s Mod enables complete control and modification of the video game engine, Source Engine. With Garry’s Mod, you can create almost any game you want. Setting up a Garry’s Mod server is a great way to play with friends over the internet while maintaining control over the server.

This guide shows how to create, maintain, and secure a Garry’s Mod server.

Before You Begin

  1. You will need a Steam account and a copy of Garry’s Mod.

  2. Complete our guide: Install SteamCMD for a Steam Game Server. This will get SteamCMD installed and running on your Linode and this guide will pick up where the SteamCMD page leaves off.

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Prerequisites for Garry’s Mod

From the SteamCMD guide, two additional steps are needed specifically for Gmod.

  1. Add a firewall rule. This command assumes that you have only the firewalld rules in place from the SteamCMD guide. This inserts a rule for port 10999 after the pre-existing rules for SteamCMD.

    sudo firewall-cmd --zone=public --add-port=27000 27030/udp --permanent
  2. Install an additional 32-bit package:

    sudo yum install ncurses-libs.i686

Install Garry’s Mod

  1. Be sure you are in the directory ~/Steam, then access the Steam> prompt.

    cd ~/Steam && ./
  2. From the SteamCMD prompt, login anonymously:

    login anonymous

    Or log in with your Steam username:

    login example_user
  3. Install Gmod to the Steam user’s home directory:

    force_install_dir ./gmod
    app_update 4020 validate

    This can take some time. If the download looks as if it has frozen, be patient. Once the download is complete, you should see this output:

    Success! App '4020' fully installed.
  4. Quit SteamCMD:

    To update Gmod, run the above 4 commands again.

Configure Garry’s Mod

This section configures different aspects of the server, including gamemode and workshop addons.

Startup Script

  1. Create a startup script for Gmod with the following contents:

    File: ~/
    cd ./Steam/gmod
    screen -S "Garry's Mod Server" ./srcds_run -game garrysmod +maxplayers 20 +map gm_flatgrass

    When run, the script will change directories to ~/Steam/gmod and execute Garry’s Mod in a Screen session. The srcds_run binary can take many more arguments which you can see at Valve’s Developer wiki.

  2. Make the script executable:

    chmod +x ~/

Update Script

The Garry’s Mod wiki has instructions to use a script to update Gmod rather than manually through SteamCMD. See under Installing Garry’s Mod.

Automatic Startup After Server Reboots

This will automatically restart Garry’s Mod when your server reboots.

  1. Open Crontab (this will open in vim):

    crontab -e
  2. Enter the startup command. Be sure that the binary flags are the same as in your startup script.

    @reboot /home/steam/Steam/gmod/srcds_run -game garrysmod +maxplayers 20 +map gm_flatgrass
  3. To exit vim, press Esc, then type :x and hit Enter.

Server Config File

The default server.cfg file is blank, and any configuration options you want to specify for the server must be added. This is optional, but below is a sane starting point.

File: ~/Steam/gmod/garrysmod/cfg/server.cfg
hostname "server_hostname"
sv_password "server_password"
sv_timeout 60
rcon_password "rcon_password"
mp_autoteambalance 1
mp_limitteams 1

Workshop Addons

  1. Create a collection of addons you want to install on your server at Garry’s Mod Collections. You will need to be logged in to Steam.

  2. Note the collection ID. It is located at the end of the url, denoted by the ‘X’s here:
  3. Acquire a Steam API key from the Steam API Keys page. Note the key.

  4. Paste the Steam API key and Workshop Collection ID into your startup script. For example:

    ./srcds_run +maxplayers 20 +gamemode terrortown +map cs_office -authkey YOURKEYGOESHERE +host_workshop_collection 157384458

    This sets the game for the Trouble in Terrorist Town (TTT) gamemode, but can be changed to your desired gamemode, if you have it downloaded.

    For more info on Workshop Addons, see Workshop for Dedicated Servers in the Garry’s Mod wiki.

Using the Server

  1. Now that your server is installed and configured, it can be launched by running the script from your steam user’s home directory.

    cd ~/ && ./
    From this point, do not press the Control+C keys while in the console unless you want to stop Gmod.
  2. To detach from the screen session running the server console, press these two key combinations in succession:

    Control+A Control+D

  3. To bring the console back, type the following command:

    screen -r
  4. To stop the server, bring back the Gmod console and press CONTROL + C.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on

Your Feedback Is Important

Let us know if this guide was helpful to you.

Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.