1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

v 2.5.x How to Install a Garry's Mod Server onto your VPS

Discussion in 'Tutorials' started by Pab14567, Aug 3, 2016.

  1. Pab14567

    Pab14567 Well-Known Member

    So I took HackCrafts guide and I re-made it and updated it and added a little bit more and went into a little bit more depth. ( Or if you don't want a new tab, just read here )


    Hi! This is a more updated version from Hackcraft's How to Install a Garry's Mod server onto your server.

    Getting a VPS and the Right OS

    So I know there is multiple VPS's out there, I personally use VULTR You can check them out here

    VULTR[www.vultr.com] I can vouch for them as I'm currently using their 10$ plan and it works amazing, runs smooth, their SSD storages boots up the server alot quicker and get's stuff done quicker :)

    Other VPS providers are :

    So once you pick out your VPS your VPS control panel should look something like this


    This Guide will consist of Ubuntu 16, but I am sure this can work on older versions like Ubuntu 14, 15. Other OS's have different commands and I am more familiar with Ubuntu.

    All the tools you will need

    You really do not need that many tools for this, but here's a list

    A Code editor.
    I personally use Sublime Text as it's amazing and has multi-line editing, you can check them out here


    or you can use a more simple code editor but still works great just not with many functionality as Sublime Text.


    A FTP.
    I use Filezilla, I used to use WINSCP but I found its just a bit more problematic, but it's your prefence. You can dowload them here:


    (OPTIONAL) A SSH Program.

    This is completely optional you don't need it, as the VPS should already have a terminal you can use, but I found it preferred. You can download one of them here :


    Download the first one in the list. : " Putty.exe"

    Once you have these installed, you are ready to go!

    Installing Garry's Mod.

    Seeing as you're already logged into the terminal run this command

    Code (Text):
     apt-get install tmux
    If it asks you to continue press y and continue

    Once it's finished installing do the following commands in order:

    Code (Text):
     adduser garrysmod
    When it asks for the name and etc, just leave it blank and press y at the end and enter to continue

    Code (Text):
     su garrysmod
    Switches to the user garrysmod

    Code (Text):
    Enters your own directory

    Next we will install the script which will helps us install the server.

    Code (Text):
     wget http://gameservermanagers.com/dl/gmodserver
    Code (Text):
     chmod +x gmodserver
    Makes it a executable so we can run it.

    Code (Text):
     ./gmodserver install
    The server will now start to install onto your vps, and when it asks for hostname go ahead and put one ( you can change it later) and if it asks for rcon you can leave it blank.

    Once it finishes installing, you have a garrysmod server:D

    Installing Counter-Strike:Source

    We'll be following the same path as the previous section except with CS:S
    run the following commands in order onto your terminal.

    Code (Text):
    su root
    Switches back to root account and enter password again

    Code (Text):
    adduser css
    do everything as you did before.

    Code (Text):
     su css
    switches user to css

    Code (Text):
    home directory

    Code (Text):
     wget http://gameservermanagers.com/dl/cssserver
    script which installs for us css

    Code (Text):
     chmod +x cssserver
    makes it executable so we can run it.

    Code (Text):
     /cssserver install
    installs css leave the hostname and rcon password blank when asked for it

    Once that's done you'll be good to go :D Now onto mounting the content and you'll be good to go :)

    Managing your server files. ( and mounting css )

    So now we get to the part where we upload files and manage our server/ edit stuff.

    Go ahead and open up FileZilla ( same process with WinSCP )

    Go click the top left button " File " then click on Site Manager, A new window will pop up and look at the bottom and click the button " New Site"

    You can edit the name as you wish of it, and go to the right side and enter the IP address of the vps and the port: (22)
    Once you do that, click on the bar "Protocol" and click on the option that says "SFTP SSH File Transfer Protocol."

    then to the bottom click on the bar : Logon type
    then click on the option: Normal

    afterwards, enter username root then put the password of the root account and connect ! :D

    Once you're there go ahead and navigate to

    and edit the "mount.cfg" and inside the file you should have this

    Code (Text):
     // "cstrike" "C:\steamcmd\steamapps\common\Counter-Strike Source Dedicated Server\cstrike"
    Go ahead and replace it with this

    Code (Text):
     "cstrike" "/home/css/serverfiles/cstrike"
    Once that's done, save the file and re-upload to the vps and you're good :D CSS has been mounted :) Also take note, the cfg file of the gmod server is called "gmod-server.cfg" its not the regular server.cfg, so keep in mind, in gmod-server.cfg is where you edit hostname, password, and all the other commands.

    Starting the server.

    So now that you've done everything, go ahead and navigate to
    and go into the file called "gmodserver" and edit the file.

    This is the command line for you server.
    This is where you put the default map, gamemode, and workshop collection and also SLOTS. Yes you can change your slots as you please, ( only as much as your vps can handle ) and the field that says
    Code (Text):
    Replace the 0's with the VPS's IP address ( the one you used to log into the terminal ( ssh ) ) Once you finished editing the command line to your liking you are good to go :D All that's left is to start the server up and the console

    go ahead go back into your terminal and type the following
    Code (Text):
    When you do that you will be given a list of commands which are available to control your server.

    now type
    ./gmodserver start
    The server will now boot up and start and you're done :D You have successfully installed and ran your garry's mod server :D

    Now to access console just type
    Code (Text):
     ./gmodserver console
    and press y again for it to continue and you are done :)

    Congratulations on installing and running your first VPS Garry's Mod server and have fun!

    Permission Errors.
    You may be getting these errors after you add new files to the garrysmod server. Where you cannot start or stop or restart the server after this, because your account does not have access to it, so all you need to do to fix this is go back into your terminal and run the following chown command

    Code (Text):
     chown -R garrysmod:garrysmod /home/garrysmod
    This will fix it , but you will have to keep doing it every time you add new files to the server.
    Last edited: Aug 28, 2016
  2. E2B

    E2B New Member

    Thank you for the guide.
  3. Pab14567

    Pab14567 Well-Known Member

    I edited some things, and posted, the important things here, incase people are lazy and dont want to open up a new tab
  4. Pab14567

    Pab14567 Well-Known Member



    Open up your terminal or SSH program and go into your root directory.

    Type all of the following commands: ( I'll give explanation )

    To block all non-required ports

    Code (Text):

    iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
    iptables -A OUTPUT -p icmp --icmp-type echo-reply -j DROP
    This basically tells the firewall to ignore every ICMP packet it receives, and take absolutely no action on it. This also means if someone tries to ping your server, they will get no response. The second line tells the firewall to block all outgoing ICMP packets, this is much less important, but just double ensures there won’t be any ICMP communication happening.

    Next, we need to specifically allow all the ports required for Garry’s Mod (27005 - 27015 inclusive) with these commands:

    Code (Text):
    iptables -I INPUT -p tcp --dport 27005:27015 -j ACCEPT
    iptables -I INPUT -p udp --dport 27005:27015 -j ACCEPT
    Code (Text):

    iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    Now if you're using putty to run the server ( an SSH program ) run this code:
    Code (Text):
    iptables -I INPUT -p tcp --dport 22 -j ACCEPT
    if you're using the terminal provided to you by the vps then don't run it

    Code (Text):

    iptables -A INPUT -j REJECT
    This is the final code to set up the tardy log


    Go ahead and stay in your root folder and type this:

    Code (Text):

    apt-get install iptables-persistent
    This is to make sure that we don't need to re-type all the above every time we restart your vps
    Just follow the instructions and type y if it asks if you want to save tables files or something

    This next one is only for if you're using the SSH program: This app bans the IP of the user trying to bruteforce your SSH terminal and gain access to your vps. This also means if you forget your password and try to attempt to many times you will also get banned out of your own vps also

    Code (Text):

    apt-get install fail2ban
  5. NV Sam Pepper

    NV Sam Pepper Member

    Or you could use Linux Game Server Manager, Which does all of this automatically after doing 4 commandline commands.

Share This Page