How To Install Garry's Mod Server on CentOS 7

In this tutorial, I will explain how to setup a Garry's Mod server. This tutorial was written for CentOS 7.

Prerequisites

Let's make sure that the system is fully updated. Create a new user for this server, and be sure to use a strong password.

yum update
yum upgrade -y
adduser gmod
passwd gmod

Open the required firewall ports with firewall-cmd.

firewall-cmd --zone=public --add-port=27015/tcp --permanent
firewall-cmd --zone=public --add-port=27015/udp --permanent
firewall-cmd --reload

Install the required system libraries to run SteamCMD.

yum install glibc.i686 libstdc++.i686 -y

Now, switch to the user that was just created.

su gmod
cd ~

Download SteamCMD by using wget.

wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar xf steamcmd_linux.tar.gz

Install the game server files with SteamCMD.

./steamcmd.sh +login anonymous +force_install_dir ./gmod +app_update 4020 validate +quit

When it says Success! App '4020' fully installed., simply type quit and press enter.

The game server is now installed.

Customizing The Server

To change the name of your server, edit the server.cfg file.

nano ~/gmod/garrysmod/cfg/server.cfg

Paste the following into server.cfg and change ServerName and RconPassword to anything you would like.

hostname "ServerName"
rcon_password RconPassword

Updating Your Server

We will create a script so that you can update your server with a single command. First, create the file update_gmod.txt.

nano /home/gmod/update_gmod.txt

Paste in the following:

login anonymous
force_install_dir ./gmod
app_update 4020
quit

To update your server, you just need to run the following command:

cd ~
./steamcmd.sh +runscript update_gmod.txt

Running your server

Navigate to the gmod folder and run your server.

cd /home/gmod/gmod/
screen -dmS gmod ./srcds_run -game garrysmod -console -port 27015 +maxplayers 18 -tickrate 66 +map gm_flatgrass

At this point, your server is now running in the background. You may shut it down at anytime with the following command.

screen -S gmod -X quit

Enjoy your new Garry's Mod server!

  • CentOS, Game Servers, Linux Guides
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Setup Ragnarok Online Server on Ubuntu 14.04 x64

In this article, we are going to setup a Ragnarok Online Server on Ubuntu 14.04 x64. You can be...

Setting up a Name Server for IPv6 rDNS in CentOS

Managing your own IPv6 rDNS is a fairly simple task. After setting up the name server, please...

Reset the Root Password in CentOS

If you have forgotten the root password it is possible to set a new one by interrupting the boot...

How to Install and Configure vsftpd on CentOS 7

FTP (File Transfer Protocol) is one of the most popular methods to upload files to a server....

How to enable EPEL repository?

The EPEL repository is an additional package repository that provides easy access to install...