Your FACE is a blog!
RSS icon Home icon
  • Garry’s Mod Dedicated Server on Linux w/ SteamPipe and Extra Content

    Posted on August 23rd, 2013 Jouva Moufette No comments

    Hey it’s been a while since I posted something here. Figured I’d post something useful!

    I like Garry’s Mod. I also enjoy running it as a dedicated server rather than as local server to take some relief of processing off my computer. But recently, Valve has created SteamPipe, changing how content gets downloaded. After much searching for information about how to get this all to work, I figured I’d post what I found out here so others can find it hopefully.

    SteamCMD: The replacement for HLDS Update Tool

    First, you must grab the new Steam Console Client, otherwise known as SteamCMD. We’ll create a “Steam” folder for this purpose. You can name it whatever you want, but I personally not install this right into your home directory; a sub folder is sufficient.  If you name it something else, simply change anything below that is relative to that folder to whatever you named it instead

    mkdir Steam
    cd Steam
    wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
    tar xvzf steamcmd_linux.tar.gz

    You can then run ./steamcmd.sh and see if it loads properly. If so, you can type quit at the Steam> prompt. Otherwise, I’d suggest trying to find what’s going on and diagnosing it. A search on your favorite search engine is usually sufficient for this.

    Grabbing the content the easy way: Scripting

    Next, we’re going to create a script that has SteamCMD install or update any content that Garry’s Mod can use and is available for Linux, as well as Garry’s Mod itself. Note that we’re also installing Garry’s Mod in its own separate folder outside of Steam. Here’s the content of the file

    Steam/gm_content.txt
    @ShutdownOnFailedCommand 1
    login anonymous
    // HL2:MP
    app_update 232370
    // HL2 EP1
    app_update 380
    // HL2 EP2
    app_update 420
    // HL2 Lost Coast
    app_update 340
    
    // TF2
    app_update 232250
    // Portal
    app_update 400
    // Portal 2
    app_update 620
    // L4D
    app_update 510
    // L4D2
    app_update 222860
    // CS:S
    app_update 232330
    // CS:GO
    app_update 740
    // DoD:S
    app_update 232290
    // Nuclear Dawn
    app_update 111710
    // Garry's Mod
    force_install_dir ../gmodds
    app_update 4020
    quit

    Smart people will see that I’ve labeled each app to install. Smart people will also realize that, like many programming languages, “//” is a comment. So if you want to not install particular add-on content, put a “//” in front of the app_update line that corresponds to that particular game, if you’re interested in other type of games like casino games you can go online to find casino slots which are a good option to play and make money online. Also, consider exploring the world of best online casino games Canada for a thrilling gaming experience.
    .

    The script to run the script

    Next, the shell script that does the job.

    update_gmod.sh
    #!/bin/sh
    echo "==============================================="
    echo "=== GARRY'S MOD AND RELATED CONTENT UPDATER ==="
    echo "==============================================="
    cd Steam
    ./steamcmd.sh +runscript gm_content.txt
    echo "Done!"

    Pretty simple really. It just goes into that Steam directory and runs the ./steamcmd.sh script and tells it one command: “use our text script we just made above”. This makes it easier to read and handle if you want to add/remove more content later.

    Where’s the beef?!

    Now that we have content and have Garry’s Mod installed, we need to tell Garry’s Mod where the content is, as it’s outside of the game. For this we have the mount.cfg file. Again, like a programming language, // is a comment, so if you want to disable particular content, put // at the beginning of a line. Modify the rest of the path (i.e. “/home/games/Steam”) to be appropriate, but otherwise, this is a copy/paste job:

    gmodds/garrysmod/cfg/mount.cfg
    //
    // Use this file to mount additional paths to the filesystem
    // DO NOT add a slash to the end of the filename
    //
    "mountcfg"
    {
    "hl2" "/home/games/Steam/SteamApps/common/Half-Life 2/hl2"
    "hl2mp" "/home/games/Steam/SteamApps/common/Half-Life 2 Deathmatch Dedicated Server/hl2mp"
    "episodic" "/home/games/Steam/SteamApps/common/Half-Life 2/episodic"
    "ep2" "/home/games/Steam/SteamApps/common/Half-Life 2/ep2"
    "lostcoast" "/home/games/Steam/SteamApps/common/Half-Life 2/lostcoast"
    "tf" "/home/games/Steam/SteamApps/common/Team Fortress 1 Dedicated Server/tf"
    "portal" "/home/games/Steam/SteamApps/common/Portal/portal"
    "l4d2" "/home/games/Steam/SteamApps/common/Left 4 Dead 2 Dedicated Server/left4dead2"
    "l4d2dlc1" "/home/games/Steam/SteamApps/common/Left 4 Dead 2 Dedicated Server/left4dead2_dlc1"
    "l4d2dlc2" "/home/games/Steam/SteamApps/common/Left 4 Dead 2 Dedicated Server/left4dead2_dlc2"
    "l4d2dlc3" "/home/games/Steam/SteamApps/common/Left 4 Dead 2 Dedicated Server/left4dead2_dlc3"
    "l4d2lv" "/home/games/Steam/SteamApps/common/Left 4 Dead 2 Dedicated Server/left4dead2_lv"
    "cstrike" "/home/games/Steam/SteamApps/common/Counter-Strike Source Dedicated Server/cstrike"
    "csgo" "/home/games/Steam/SteamApps/common/Counter-Strike Global Offensive Beta - Dedicated Server/csgo"
    "dod" "/home/games/Steam/SteamApps/common/Day of Defeat Source Dedicated Server/dod"
    "nucleardawn" "/home/games/Steam/SteamApps/common/Nuclear Dawn/nucleardawn"
    }

    Play it, Sam

    Now to actually run a server. You can modify parameters if you want, but I wanted to show a few interesting ones here as well.

    start_gmod.sh
    #!/bin/sh
    echo "Starting GMod server..."
    cd gmodds/
    screen -A -m -d -S gmod ./srcds_run -console -game garrysmod +maxplayers 4 +map gm_flatgrass +host_workshop_collection XXXX -authkey YYYY

    The gmodds folder is where we installed Garry’s Mod, as seen in the .txt script which had the force_install_dir command. If you chose a different folder, modify that line here as well.

    Cool tricks with screen

    I seriously hope you’re running this session with screen. Seriously. screen has some nice parameters here which are of interest. -A means if we’ve changed window size when we’re re-attaching, go re-adapt the session to the new size. -m -d starts screen in detached mode. I generally don’t want it to stay attached right away when I run it unless I’m debugging. So I have it auto detach. -S gmod names the screen session. This way I don’t have to search for the current process ID of the screen session. I can simply use screen -r gmod to reattach.

    Server Parameters (and how to use Workshop Content!)

    As for the source engine dedicated server parameters, many should be familiar. Modify max players or the map to whatever you wish. But here’s some new stuff: +host_workshop_collection can be used if you have a particular Collection of Workshop content that you want to be loaded by the server easily. Easy updates, easy install. This is great for models or scripts or maps or whatever you might want. XXXX is the Workshop collection ID. Search around to see how to get that number. It’s simple (pssst it’s at the end of the URL for your collection!). If you’re using workshop content, you must have -authkey to download it. To get this or generate one, go here: http://steamcommunity.com/dev/apikey and then replace YYYY with that key.

    Hope this has been helpful! Leave comments if you have questions and have done at least a little bit of your own research first.

     

    16 responses to “Garry’s Mod Dedicated Server on Linux w/ SteamPipe and Extra Content” RSS icon

    • Hello There,

      The app number for single player game (hl2 episodic and portal) are not corect from my side it returns a no subscription error. I’am searching for the corect one.
      Thanks for the tutorial.

    • Hey there it’s me again. Since the last time I didn’t manage to get the singleplayer games to come up and be download.
      So to be sure i’m doing your tutorial on a brand new folder and I’ll keep you updated if my server as been able to download all the content or not.

      • Ok so portal, half life 2 and episodic, left 4 dead 1 have a “no subscription” error again. I have tried other appid related to these game using the steamDB website.
        It’s annoying because some gamemodes cannot properly run without Half life most of the time.
        I’m on Ubuntu server 12 which is based on debian.

        Oh BTW it’s a good tutorial thanks for that, it complete well with the garry newman one about mounting games.

        • Are you using any parameters or commands in addition to what is being listed here that otherwise log you in as a regular user? Those will conflict with the need to be an anonymous but “logged in” user to get these packages.

          Also thanks for sending comments. It reminded me that I was missing Portal 2 and L4D1 so I added them

          • NO as I mentioned, I have followed your tutorial and I have not added any additional params to the steamcmd program. I’m using “steam” user to run my steamcmd server but I might try to do it with root just to test if it’s work. I’am downloading another linux distribution just to test if it’s an ubuntu server Issue.
            I think James Foley and me have the same problem.
            Thanks for the little update.
            Can you tell what linux distribution are you using ?

            • The user you run this as should not matter. It’s almost definitely not an ubuntu issue as I am also using Ubuntu 12.04 LTS on the machine with this script, non root.

              For the heck of it, let’s make sure there’s no corrupt data. Remove the .steam directory from your home directory and try again.

    • Thanks for this, helped quite a bit though I do get an invalid platform error for a couple of games. (Ubuntu 13.10)

      Any ideas on how to get around those?

      • Like I just told Skullmasher, Ubuntu is what I’m currently using and should be fine. For the heck of it, let’s make sure there’s no corrupt data. Remove the .steam directory from your home directory and try again.

    • Hi, i’ve been messing around looking for a complete tutorial to host a Gmod linux based dedicated server, but i only got a few pieces… and the pieces you give are nice, you made a good resumé of needed game files for gmod so thanks for your work !

      So i noticed that you’re installing everything into the same folder : I can guess it saves space, and could be a good option for me too…

      But isn’t ehre any conflicts between different game files and folders ?

      Thanks in advance

    • has anyone figured out No subscription for l4d2?

    • If you are getting no subscription you will need to use this command
      login

      of your steam account. that will start downloading all of it.
      Exxcept L4D I got a invalid platform
      anyway how can I tell if its got mounted on my srver.

      Thank you all.

    • oops forgot you will need to key in your steam user name and password after login


    Leave a reply

    You must be logged in to post a comment.