Half-Life 2 Guide

Open Fortress: Linux Dedicated Server Setup for Half-Life 2

Open Fortress: Linux Dedicated Server Setup

Overview

What? No Linux guide? No worries, I’ve got you covered.This guide assumes you have some knowledge with Linux and server hosting, but if you don’t, it’s fine too.If you have any issues, ask on the official Open Fortress discord server!

Software requirements:

  • On 64-bit Ubuntu / Debian based distros run:
    sudo dpkg –add-architecture i386; sudo apt update; sudo apt install p7zip lib32gcc1 libstdc++6 libstdc++6:i386 libncurses5:i386 libtinfo5:i386 libcurl4-gnutls-dev:i386 screen subversion

    ⁠ ⁠ On 32-bit run:

    sudo apt install p7zip libstdc++6 libncurses5 libtinfo5 libcurl4-gnutls-dev screen subversion
  • On 64-bit CentOS / Fedora run:
    sudo yum install p7zip p7zip-plugins libgcc.x86_64 libgcc.i686 glibc.i686 libstdc++.x86_64 libstdc++.i686 ncurses-libs.i686 libcurl.i686 screen subversion

    ⁠ ⁠ * Use dnf instead of yum on Fedora/RHEL.

  • On Arch Linux run:
    sudo pacman -Syy p7zip lib32-gcc-libs gcc-libs lib32-ncurses lib32-libcurl-gnutls screen svn

1. Install SteamCMD for Linux

For consistency’s sake, we’ll be working in a directory named ofserver in the home folder of a user named steam. You can folllow exactly what we do here or rename commands and paths accordingly to your setup.

Create a new directory named ofserver in your user’s home directory and go into it

cd ~ mkdir ofserver && cd ofserver

Next, download the linux SteamCMD Tar archive and unpack it

curl -O https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz tar xvzf steamcmd_linux.tar.gz

You can now run steamcmd with

./steamcmd.sh

And exit it with

quit

2. Install TF2 and Source SDK 2013

For automation and ease of use’s sake, we’ll be using auto-update scripts to ease the updating process.

While still in the /ofserver/ directory, create a file named fullupdate.txt with the following contents:

@ShutdownOnFailedCommand 1 @NoPromptForPassword 1 login anonymous force_install_dir “./tf2d” app_update 232250 force_install_dir ./sdk app_update 244310 quit

And now to install the necessary Team Fortress 2 files and Source SDK 2013 MP files using that newly created script, run that script in steamcmd once with the following command:

./steamcmd.sh +runscript fullupdate.txt

This will install the necessary files in directories named /Team Fortress 2 Dedicated Server/ and /sdk/ within the /ofserver/ directory.

3. Install Open Fortress

Go into the folder named /sdk/ from the previous step, and run this one-liner:

svn checkout https://svn.openfortress.fun/svn/open_fortress/ open_fortress This will download a copy of the latest files on the official Open Fortress SVN repository.

4. Final links

Go into the /sdk/ directory and from there go into the /bin/ directory.
And paste & run these commands:

ln -s datacache_srv.so datacache.so ln -s dedicated_srv.so dedicated.so ln -s engine_srv.so engine.so ln -s materialsystem_srv.so materialsystem.so ln -s replay_srv.so replay.so ln -s scenefilecache_srv.so scenefilecache.so ln -s shaderapiempty_srv.so shaderapiempty.so ln -s soundemittersystem_srv.so soundemittersystem.so ln -s studiorender_srv.so studiorender.so ln -s vphysics_srv.so vphysics.so

And go to the /sdk/open_fortress/bin directory and run this command:

ln -s server.so server_srv.so

This will create necessary file links for files that don’t exist but should be there.

And you’re done! How to start the server

And that’s all. Wasn’t so hard, was it?
Now, how to run a server.

Create a script to run your server in the /ofserver/sdk/ directory, name it something like run.sh. Here’s a sample server run script.

#!/bin/sh ./srcds_run -console -game open_fortress +maxplayers 32 +map dm_hydro

Make it executable with

chmod +x run.sh

Change the launch parameters of the script (whatever is after “./srcds_run”) to your heart’s content. Remember to keep -console -game open_fortress, though.

Run the newly created run.sh script (prefferably in a screen – read below) to start the server.

It’s recommended to run the server in a screen session. Screen is a utility that allows you to run things in “virtual” consoles, so that you can easily attach or detach them, allowing you to run the server without having a terminal open all the time.

To start a new screen session, just type

screen

Your new screen session will be automatically “attached”.
To detach from the screen session, press CTRL+A and then D. Detach before closing a terminal, otherwise your server will die.
To reattach a screen session, type

screen -r

To kill a screen session, just press CTRL+D while in the screen.

Auto updating

Since Open Fortress is in rapid development and updates are made every day, it’s important to keep your gameserver updated, otherwise players who update their local copies will eventually encounter problems or won’t be able to play on your server at all.

To update TF2 and and SDK 2013 automatically, place the following in your launch parameters in /ofserver/sdk/run.sh:

-autoupdate -steam_dir ~/ofserver/ -steamcmd_script ~/ofserver/fullupdate.txt

For Open Fortress content however you’ll need something more.
Here’s a script that will update just Open Fortress in the setup from this guide. Place it in the /ofserver/ directory and name it updateof.sh and make it executable (with chmod +x)

#!/bin/bash
pkill srcds_linux
pkill srcds_run
pkill screen
svn cleanup $LOCAL_REPO
svn update $LOCAL_REPO –non-interactive –trust-server-cert-failures=unknown-ca,cn-mismatch,expired,not-yet-valid,other –username ‘ofs’ –password ”
screen -d -m /home/steam/ofserver/sdk/run.sh

Now, this script won’t run itself, so run

crontab -e

Pick your editor of choice (if it prompts you) and at the end of the file place the following:

0 5 * * * /home/steam/ofserver/updateof.sh

This will check every day at 5AM for an update and restart the server.

Server settings, configuration

Whatever comes out of the box doesn’t have to be your server forever! Open Fortress and the Source engine have a LOT of server settings that can change how your server works, what gamemodes it runs etc.

To change them, create a file named server.cfg if it doesn’t exist in the ~/ofserver/sdk/open_fortress/cfg/ directory and edit it with your custom Convars (Console Variables), which control the server’s functionality.
A few notable Convars:

// Changes your server’s name visible in the server browser. hostname “My Epic Gaming Server” // Sets your RCON password to allow for remote console command execution on the server. // DO NOT SHARE THIS! This grants anyone who has the password control over your server! rcon_password “thisPasswordShouldBeVeryLongAnd_c0mpl1c4t3d!@#$” // Set to 1 to make your server LAN-only. Keep at 0 otherwise. sv_lan 0 // Time per map in the rotation, in minutes. 0 to never rotate the map on a timer. mp_timelimit 10 // Maximum number of rounds to play per map before forcing a mapchange mp_maxrounds 1 // Maximum number of kills needed to win the round in Deathmatch. mp_fraglimit 50 // Allow clients to upload customization files (e.g. sprays) sv_allowupload 1 // Allow clients to download files (e.g. sprays, custom maps, custom content, etc.) sv_allowdownload 1 // Maximum allowed file size for uploading in MB (Optional) net_maxfilesize 15

More Open Fortress specific settings have already been documented in the Windows guide, starting on page 16 in This Document[docs.google.com]

There are also launch parameters, settings that only can be applied on server start. They are the settings with dashes (-) or pluses (+) visible after
./srcds_run
In your run.sh file. Change any launch parameters over there.
Launch parameters with pluses (+) instead of dashes (-) are console commands that will be executed on server start but can also be run while the server is running. Parameters with minuses cannot.
Most popular launch parameters:

// Sets your server’s max player connected limit. +maxplayers 24 // Bind the server to a different port (27015 is the default) -port 27015 // Disables VAC. -insecure // Timeout before the server restarts if it crashes. Only works if you have // the -autoupdate parameters from the previous step. -timeout 0 // Disables SourceTV functionality on your server – may reduce RAM used by the server. -nohltv // The map that the server starts with. Use the changelevel command if the // server is already running instead of map. +map dm_2fort

TROUBLESHOOTING

(Work in progress)

  • I cannot connect to my server, and the server is invisible in the game browser.
    There are so many possible causes for this, ranging from Source engine BS, ISP BS and bad router BS that it’s best you ask for help on the official Open Fortress discord.

  • I can connect to my server, but the server is invisible in the game browser.
    Try the following in server console:

    ip <your public ip here> sv_lan 0 heartbeat map <some mapname>

    in console, replacing the map with your map and IP of course.
    If the issue is still not fixed, contact the OF Discord

  • [S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
    This doesn’t cause a crash. Safe to ignore.

  • “Warning: /home/steam/ofserver/sdk/core is truncated: expected core file size”, followed by a crash.
    Your gameinfo.txt is broken. Use the vanilla one, or if you’re using different folder name for TF2, edit properly. Ask in discord for help.

  • dlopen failed trying to load: /home/ubuntu/.steam/sdk32/steamclient.so
    This should be safe to ignore and shouldn’t crash, but if you feel better not seeing the error, link over the binary to that path.

    ln -s ~/ofserver/linux32/steamclient.so ~/.steam/sdk32/

    (if sdk32 doesn’t exist in .steam, create it)

  • “error.mdl was not precached. If you are getting this error, you’re not mounting TF2 correctly.”
    Self explanatory, you’re not mounting TF2 correctly. Contact the discord server and we’ll help you out.

  • ./srcds_run line 324 18491 Segmentation fault $HL_CMD
    You shouldn’t be getting this error on Open Fortress, and this can only popup on RHEL-based distributions (Fedora, CentOS).
    Triple check that you have libcurl.i686 installed, and run the following commands:

    ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4
  • Server is failing to load and segfault crashes!
    If your server is failing to load and then displays a segment fault crash. You might have forgot to symbolically link your server.so file. To do so just do.

    ln -s ~/ofserver/sdk/open_fortress/bin/server.so ~/ofserver/sdk/open_fortress/bin/server_srv.so
SteamSolo.com