How to Make Garry's Mod Server on Centry 7?

Source: Internet
Author: User
Keywords how to make a garrys mod server how to create a server on garry's mod garrys mod game server

Garry's Mod can fully control and modify the video game engine-Origin Engine. You can use Garry's Mod to make almost any game you want. Setting up a Garry's Mod server is a great way to play with friends on the Internet, while also controlling the server.

This guide describes how to create, maintain and protect Garry's Mod server.
Alibaba Cloud Simple Application Server:  Anti COVID-19 SME Enablement Program
$300 coupon package for all new SMEs and a $500 coupon for paying customers.

Ready to work
You will need a Steam account and a copy of Garry's Mod.
Complete our tutorial: Install SteamCMD for the Steam game server. This will install and run SteamCMD on your Linode. This tutorial will start at the end of the SteamCMD page.
Note that this tutorial is written for non-root users. Commands that require elevated privileges are prefixed with sudo. If you are not familiar with the sudo command, you can check our "Users and Groups" wizard.

Prerequisites for building Garry's Mod

As you can see from the SteamCMD guide, Gmod requires two more steps.

    1. Add firewall rules. This command assumes that you only have firewalld rules in the SteamCMD guide. This will insert the rules for opening port 10999 after the existing SteamCMD rules.
sudo firewall-cmd --zone=public --add-port=27000 27030/udp --permanent
    2. Install additional 32-bit software packages:
sudo yum install ncurses-libs.i686
Install Garry's Mod
    1. Make sure you are in the directory ~/Steam, and then visit the Steam> prompt.
cd ~/Steam && ./steamcmd.sh
    2. At the SteamCMD prompt, log in anonymously:
login anonymous
        Or log in with your Steam username:
login example_user
    3. Install Gmod into the Steam user's home directory:

force_install_dir ./gmod app_update 4020 validate
        This may take some time. If the download does not seem to be moving, please be patient. After the download is complete, you should see
 To the following result:

Success! App '4020' fully installed. Steam>
    4. Exit SteamCMD:

quit
Note: To update Gmod, please run the above 4 commands again.

Configure Garry's Mod
This section will configure different aspects of the server, including game modes and studio plug-ins.

Startup script
    1. Use the following to create a startup script for Gmod:


~/startgmod.sh1 2 3 4
#!/bin/sh cd ./Steam/gmod screen -S "Garry's Mod Server" ./srcds_run -game garrysmod +maxplayers 20 +map gm_flatgrass
        When run, the script will change the directory ~/Steam/gmod and execute Garry's Mod in the screen session.
   The srcds_run binary can take more parameters, you can see Valve's developer's wiki.

    2. Make the script executable automatically:

chmod +x ~/startgmod.sh
Update script
Garry's Mod wiki has instructions for updating Gmod using scripts instead of manually updating via SteamCMD. Please refer to the installation of Garry's Mod.

Automatically start after server restart
This will automatically restart Garry's Mod when your server restarts.

       1. Open Crontab (open in vim):
crontab -e

       2. Enter the start command. Make sure that the binary flag is the same as in the startup script.

@reboot /home/steam/Steam/gmod/srcds_run -game garrysmod +maxplayers 20 +map gm_flatgrass
       3. Exit vim, press Esc, then type: x and press Enter.

Server configuration file

The server.cfg file is empty by default, and any configuration options that you want to specify for the server must be added. This is optional, and here is a good reference.


~/steam/GMOD/garrysmod/cfg/sever.cfg


hostname "server_hostname"
sv_password "server_password"
sv_timeout 60
rcon_password "rcon_password"
mp_autoteambalance 1
mp_limitteams 1
writeid
writeip
Workshop plugin
Create a collection of plugins to be installed on the server in Garry's Mod Collections. You need to log in to Steam.
Note the plugin ID. It is located at the end of the URL and is represented by'X':
http://steamcommunity.com/sharedfiles/filedetails/?id=XXXXXXXXX

Obtain the Steam API key from the Steam API Key page. Pay attention to the key.
Paste the Steam API key and creative workshop plug-in ID into the startup script. E.g:
./srcds_run +maxplayers 20 +gamemode terrortown +map cs_office -authkey YOURKEYGOESHERE +host_workshop_collection 157384458
This command sets the game mode to Trouble in Terror Town (TTT), but if you have already downloaded the game mode, you can change to the game mode you want.

For more information about Workshop Addons, see the dedicated server workshop in Garry's Mod wiki.

Use server
    1. Now your server is installed and configured, you can run the script from the steam user's home directory through startgmod.sh
 Originally started it.

         cd ~/ && ./startgmod.sh
         Warning: From now on, unless you want to stop Gmod, do not press Ctrl + C in the console.

    2. To detach from the screen session running the server console, press the following two key combinations in succession:
          Ctrl + A Ctrl + D.

    3. To restart the console, type the following command:
 screen -r       
    4. To stop the server, call out the GMOD console and press Ctrl + C.

More information
For additional information on this topic, you may want to refer to the following resources. Although these resources are provided in the hope that they are useful, please note that we cannot guarantee the accuracy or timeliness of externally hosted materials.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.