Linux Dedicated Server Setup

From GMod Wiki

Jump to: navigation, search


Contents

Penguin.png Linux

Install Guide

Stop.png You will need to be root at one point in this guide so be careful! You can do serious damage while logged in as root.


Create a user (Optional)

Never run srcds as root.


You should use an unprivileged user to run srcds.

If you have root access:

# useradd -m -s /bin/bash -d /home/gmod gmod

Set the password for the account- use something secure, using letters and numbers and mixed case.

# passwd gmod

Login as gmod before continuing.

Make a folder for your server

Go to your home folder if not already there:

cd ~
mkdir srcds
cd srcds

Quick Installer

Just use this five second script if you want to:

#!/bin/bash
echo "Garry's Mod Installer"
echo "A screen may ask you to agree, just type yes when this happens!"
echo "Starting in five seconds!"
sleep 5
wget http://www.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
./steam
./steam -command update -game tf -dir .
./steam -command update -game garrysmod -dir .
echo "Installed! Any problems should have been reported!"

To use it:

nano installgmod.sh
Paste it into there (copy it, then when nano is up RIGHT CLICK if you're using putty!)
chmod +x installgmod.sh
./installgmod.sh

It should then do everything for you unless there is a problem.

Problems

If you get the "lib/ld-linux.so.2: bad ELF interpreter: No such file or directory." problem, it is associated with running a 64 bit os. For some odd reason, linux does not install the 32 bit gcc libs REQUIRED to run the bin file on a 64 bit os. Follow the directions below to make it work. This also works if you get this error "bash: ./hldsupdatetool.bin: No such file or directory" you may be missing lib32gcc1, follow the directions below.

This works on Centos 6.0, and requires a sudo bump up or root console:

yum install glibc.i686

If you are running Ubuntu run this as root:

apt-get install lib32gcc1

You can read about the problem here.

Installing Steam (Manual Way)

Download the dedicated server update tool, make it executable and run it.

wget http://www.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin

You will need to agree to the terms of the license agreement - type 'yes' and press return.

If you receive an error about uncompressing, make a symbolic link to the gunzip tool called "/usr/bin/uncompress". If you already have a tool called uncompress, be sure to move it away from /usr/bin/uncompress first.

ln -s /usr/bin/gunzip /usr/bin/uncompress

Now run Steam - Providing you have an active Internet connection and the Steam servers are up, it will update itself.

./steam

Now we want to install Garry's Mod.

Installing GM10 Content

Enter the following:

./steam -command update -game tf -dir .
./steam -command update -game garrysmod -dir .

This will download the Team Fortress 2 and Garry's Mod content. You have to download the Team Fortress 2 Content so that you get the latest Lin-Bins for your server.

You could also try this:

./steam -command update -game "Counter-Strike Source" -dir .
./steam -command update -game garrysmod -dir .
Info 64.png If css does not mount, open up the css folder (root/css) and move the cstrike folder in it to the orangebox folder (root/orangebox).

This will download the Counter Strike Source and Garry's Mod content, if you don't want to download the Team Fortress 2 content, but it is not confirmed that it will download the latest Lin-Bins for your server!

Installing extra game content

See the Extra Content section of General Server Setup Information.

Info 64.png Currently there are issues with some add-ons related to filename case-sensitivity on most Linux filesystems. In some situations running a shell script to recursively change the filenames to lowercase solves this issue. Alternatively you can move your linux server installation to a JFS partition.

Optionally Creating a Startup Script

You can now in theory just run the server with this command: orangebox/srcds_run -console -game garrysmod +maxplayers 16 +map gm_construct -autoupdate

(you need to be in the orangebox folder and then run ./srcds_run -console -game garrysmod +maxplayers 16 +map gm_construct -autoupdate)

However if you close SSH your server will close too.

We want to attach our GMod server to a virtual screen so we can log off and come back later or share the screen with other users (Other admins for example).

Open up a file called startgmod.sh with your favourite editor, for example:

nano -w startgmod.sh

Enter the following into the file:

#!/bin/bash
echo "Starting up Garry's Mod 10 server."
sleep 5
screen -A -m -d -S gm10server ./srcds_run -console -game garrysmod +maxplayers 16 +map gm_construct -autoupdate
echo "Started. Type screen -x to resume!"

You may wish to edit maxplayers and map.

Once you've got to this stage you're good to go. Make the script executable before running it:

chmod +x startgmod.sh

If server gives an error "Segmentation failed" and you're using 64bit linux, you can try launching directly srcds_i486 instead of srcds_run.

Everyday Server Operations

Starting Up

Type:

./startgmod.sh

Shutting Down

Type:

screen -x

This resumes your screen session, sharing it with any other users. If the server is still active with players, it's advisable to shut it down by typing:

killserver

Once you've done that, press Ctrl+C+X to kill the screen.

If it's hung, just press Ctrl+C+X.

Administration

If you type:

screen -x

You're sitting at the console of your server.

Info 64.png To disconnect from screen, type Ctrl+A+D.

Trouble Shooting

Segmentation Fault

You have probably overwitten the binary files and you need to redownload this,

Type:

cd /srcds/
rm -rf bin
./steam -command update -game tf -dir . -verify_all

this wil fix it.

Invalid game type 'garrysmod' sepecified

(Or: orangebox/srcds_run: No such file or directory)

You are not in the orangebox folder.

Goto orangebox:

cd orangebox

from there you can run srcds_run

./srcds_run -console -game garrysmod +maxplayers 16 +map gm_construct -autoupdate

Access denied on srcds_run

You must chmod the srcds_run,

type:

cd /srcds/orangebox/
chmod 0755 srcds_run

now it will work.

High CPU Usage

This is a very common issue with most recent distros of Linux. Especially servers with Dual Core processors.

I suggest looking here for steps on how to recompile your Linux Kernel to support SRCDS.

lua_shared.so error

Valve recently upgraded their Linux compiling system, and upgraded their libraries to higher versions then that are in most distributions.

The safest fix it to manually compile libstdc++, however the easiest and quickest fix it just to downgrade the shared objects that the server will use, however this may provide unwanted results.

http://www.facepunch.com/showthread.php?p=30735545#post30735545

Vehicles crash the server

This is a GCC bug, and a fix is available.

Info 64.png This seems to have been fixed.

http://www.facepunch.com/threads/1089190-Niggles-V2-while-true-do-annoygarry()-end?p=30729170&viewfull=1#post30729170

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox