How to run a Gmod server on a Linux VPS

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 CtrlC

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.

How to set up a Linux VPS to be used as a seedbox

What is a seedbox?

A seedbox is a private server used for uploading and downloading digital files. Since VPSes are cheap and usually connected with speeds of 100mpbs and above they make great budget seedboxes.

What software and configuration is required?

The software installed with this guide will be rTorrent (a command-line torrent client), ruTorrent (a web interface for rTorrent), lighttpd (a webserver used to access ruTorrent), PHP (required by ruTorrent) and Screen (required for running rTorrent in the background)

Removing default apps and upgrading

Since we’re going to be using this VPS for torrents and will install lighttpd, we can remove the pre-installed webserver, mailserver, etc.

To do this, enter the following command and press enter

apt-get update && apt-get remove --purge -y apache2* bind9* sendmail* samba* && apt-get -y autoremove && apt-get -y upgrade

Sometimes, sendmail doesn’t get fully removed, so once that has finished, press the up arrow on your keyboard (which repeats the previous command, without submitting it) and then press enter and let it run again.

Installing and setting up the required apps

To install the apps we need, enter the following command and press enter

apt-get install -y screen rtorrent lighttpd php5-cgi php5-cli curl ffmpeg mediainfo unrar nano && lighty-enable-mod fastcgi-php auth

Setting up the folders

We need a folder for current torrents (session), a folder for ruTorrent to watch (watch) for new torrents, a folder for ruTorrent (/var/www/t) and a folder for the downloads (/var/www/d) so run the following command to create these folders

cd ~ && mkdir rtorrent && mkdir rtorrent/watch rtorrent/session /var/www/t /var/www/d

Installing ruTorrent

Run the following command to install ruTorrent into the /var/www/t folder

cd /var/www && wget https://github.com/Novik/ruTorrent/archive/master.zip && unzip master.zip && rm master.zip && mv ruTorrent-master/ t && chmod 0777 t/share/settings t/share/torrents

Starting rTorrent

We need to run rTorrent in a screen session so it will continue to run when the connection to the VPS is closed. Run the following command

cd ~ && screen -S rt

Then, you’ll have be in a screen session so type the following

rtorrent

Then, hold Ctrl + A and press D which will disconnect the screen session and leave it running in the background

Securing your webserver

Of course, we don’t want everyone accessing ruTorrent and our downloads, so we need to password protect the folders

Run the following command

cd /etc/lighttpd/conf-enabled && rm 05-auth.conf && wget ehwtf.com/seedbox/05-auth.conf && nano /etc/lighttpd/lighttpd.user && /etc/init.d/lighttpd restart

It will then bring up a blank white window

Head to this site and generate a htpasswd file (delete everything in the left hand box and type in admin (space) yourPasswordHere then click Generate htpasswd content)

Copy everything from the box on the right hand side (example: admin:$apr1$sgwrguwr$egrrrhr) and then go back to PuTTY, press Ctrl + X then type Y and then press enter

Now we just need to make sure we can see a list of files when we access the torrents folder. Enter the following command

echo ‘dir-listing.activate = “enable”‘ >> /etc/lighttpd/lighttpd.conf && /etc/init.d/lighttpd restart

Finished

To test it, access your webserver like this

http://YOURSERVERIP/t

It should ask you for a username and password. Use admin and the password you chose earlier. You should then be able to use ruTorrent. To see downloads, just go to the following address

http://YOURSERVERIP/d

If you find any problems, or it doesn’t ask for a username/password, please leave a comment and I will try to help.

How to set up a GUI (Xfce) and RDP on a Linux VPS

About this guide

One major noticeable difference between a Linux server and a Windows server is the fact that a Windows Server usually has a GUI, and a Linux server usually has no GUI.

This guide will talk you through the steps of setting up a GUI on your Linux VPS, as well as VNC and Xrdp so you can access the machine easily from your Windows machine without additional software.

The guide is written with Debian in mind but should also work on Ubuntu. I recommend having at least 256MB RAM on your machine, but preferably more than 512MB.

If you don’t have a VPS already, and are looking for something cheap yet reliable with high performance, I highly recommend Ramnode and you can read why here. If, on the other hand you just want a cheap Windows VPS, you can read my guide on how to add a Windows ISO to Vultr.

We’ll need to log into the VPS through SSH to issue the commands, so if you’re not sure how to do that, you can read how in the beginning of my guide here.

Removing default apps and upgrading

If you’re going to be using this VPS purely for web browsing, word publishing, etc. then we can remove the pre-installed webserver, mailserver, etc.

To do this, enter the following command and press enter

apt-get update && apt-get remove --purge -y apache2* bind9* sendmail* samba* && apt-get -y autoremove && apt-get -y upgrade

Sometimes, sendmail doesn’t get fully removed, so once that has finished, press the up arrow on your keyboard (which repeats the previous command, without submitting it) and then press enter and let it run again.

Installing Xfce (GUI) and Xrdp

Now, we’re going to install Xfce which will provide a graphical user interface on your VPS, as well as xfonts, tightvncserver and Xrdp which are needed to connect remotely. To do this, simply run the following command

apt-get update && apt-get -y install xfce4 xfonts-base tightvncserver xrdp

Finished

You should now be able to connect with RDP. Just enter the IP address and connect.

If you have any issues or questions, leave a comment below.