About Gmod and this guide
Gmod (or Garry’s Mod) is a sandbox physics game based on the Counter-Strike: Source engine. The game places you in an empty world with access to items from Source games, and you can do/build anything you want.
This guide will show you how to set up Gmod
What is required?
The only thing you need is a Linux VPS running Debian (or Ubuntu) with at least 512MB RAM (preferably 1GB), a good CPU core (especially a host that allows you to utilise it) and a good connection speed (at least 10mbps up). At least 10GB HDD space for extra maps, mods, etc.
Since many hosts ban gameservers and/or don’t allow you to use a lot of CPU, I would recommend using Vultr since I have used them before and I am very happy with the performance and price. You can also check this thread for any Vultr coupons/offers.
Configuring the VPS
First, we want a clean VPS, so run the following command and hit enter
apt-get remove --purge -y apache2* bind9* sendmail* vim vim-* samba*
Then we want to upgrade everything and also installed some required libraries so run the following command as well and hit enter
apt-get update && apt-get -y dist-upgrade && apt-get -y install lib32gcc1
Then we’ll create a Gmod user so it’s not running as root. Run the following command and hit enter
adduser gmod
Now choose a secure password, and fill in the rest of the info (you can just press enter and leave everything (except the password) blank if you want).
Now log out, and log back in with the gmod user.
Installing Gmod
Before installing Gmod, we need to install the Steam client, so run the following command and press enter
mkdir ~/bin && cd ~/bin && wget http://media.steampowered.com/client/steamcmd_linux.tar.gz && tar -zxvf steamcmd_linux.tar.gz && ./steamcmd.sh +login anonymous +quit
Once that’s installed, we can download and install Gmod. Run the following command which will change to the home directory, download a shell script (you can open this in any text editor to check what it does first) and then run that shell script, which will download Gmod to the gmod folder. Press enter after, and it will show you the progress of the dowload.
cd ~ && wget http://ehwtf.com/gmod/update_gmod.sh && chmod +x update_gmod.sh && ./update_gmod.sh
Starting Gmod
To start Gmod, and keep it running after we disconnect from the VPS, we need to start it in a screen session.
Run the following command and press enter
screen -S gmod
Then, once you’re in a screen session, run the following command and press enter to start the server.
~/gmod/srcds_run -game garrysmod +maxplayers 12 +map gm_flatgrass
Note: changing the number after +maxplayers will change the max player limit. Also, after +map you can choose specify the map. The default maps installed are gm_flatgrass (flat area) or gm_construct (small area with some buildings)
Once the server is running, hold down the Ctrl and A button, and then while doing that, press D on your keyboard. You can then log off your VPS
Stopping and restarting Gmod
To stop Gmod, you need to re-enter the screen session, so enter the following command and press enter
screen -r gmod
Now, to stop Gmod press Ctrl + C
Then type the following command and press enter
exit
To start the server again, follow Starting Gmod section above.
Any issues/errors
If you have any issues, please leave a comment below. I will do my best to reply.