You’re going to first start of by updating CentOS to ensure the latest bug and security updates are patched.
sudo yum upgrade
We need to install some basic things needed for the steamcmd and the srcds to run correctly.
sudo yum install glibc.i686 libstdc++.i686
Before the installation starts, you will be asked If you would like to continue. You can safely answer ‘Y’. Now you want to navigate to your home directory where we will need to create a folder especially for steamcmd.
sudo mkdir steamcmd
Enter into the directory by using:
cd steamcmd
Start the download of the steamcmd installer by entering the following:
sudo wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
We can extract the contents of the steamcmd installer simply by entering:
sudo tar -xvzf steamcmd_linux.tar.gz
Running the SteamCMD command line is the next step. Once the extraction has completed we can start with the download of the Garry’s Mod server files.
sudo ./steamcmd.sh
Once you are in the SteamCMD enter the following commands and adjust the directories as you wish.
login anonymous
force_install_dir gmod
app_update 4020 validate
This will then begin to install all the files and components needed for your Garry’s Mod server. This may take a while dependant on the amount of requests the Steam mirrors are currently experiencing.
Once the installation has completed you can just type ‘quit’
to exit out of the SteamCMD.
You will now need to open the following ports to allow your players to connect
firewall-cmd --zone=public --add-port=27015/tcp --permanent
firewall-cmd --zone=public --add-port=27015/udp --permanent
firewall-cmd --reload
To start up your server you will need to navigate to the install directory. This is the one you had just defined in the SteamCMD commands. In our case, ‘gmod’.
cd gmod
Once you are in the directory you can launch your server via the following command. This is just a basic command and can be edited to suit your server.
sudo ./srcds_run -game garrysmod +maxplayers 8 +map gm_construct
When running the server I would suggest either launching it using tightvnc or using screen in order to keep it running, if you launch it using just putty when you close the session the server will also close.
Running your server with the root user account is not recommended so we advise to create another user account with access to the server.