Install Black Mesa on Debian or Ubuntu

Updated by Linode Contributed by Davide Beatrici

Contribute on GitHub

View Project | View File | Edit File

This is a Linode Community guide. Write for us and earn $250 per published guide.


This guide will show you how to set up your own Black Mesa server on a Linode running Debian or Ubuntu.

Before You Begin

  1. You will need a Steam account and a copy of Black Mesa.

  2. Complete our guide: Install SteamCMD for a Steam Game Server. This will get SteamCMD installed and running on your Linode and this guide will pick up where the SteamCMD page leaves off.

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Prerequisites for Black Mesa

From the SteamCMD guide, one additional step is needed specifically for Black Mesa.

  1. Add two firewall rules to slightly extend the port range available to the game. This command assumes that you have only the iptables rules in place from the SteamCMD guide.

    1
    2
    sudo iptables -R INPUT 5 -p udp -m udp --sport 26900:27030 --dport 1025:65355 -j ACCEPT
    sudo iptables -I INPUT 7 -p udp -m udp --dport 26900:27030 -j ACCEPT
    

Install Black Mesa, Dedicated Server

  1. Execute SteamCMD:

    1
    cd ~/Steam && ./steamcmd.sh
    
  2. Login as anonymous:

    1
    login anonymous
    
  3. Download the server:

    1
    app_update 346680 validate
    
  4. Exit from SteamCMD:

    1
    quit
    

Run Black Mesa, Dedicated Server

  1. Go into the Black Mesa Dedicated Server folder:

    1
    cd "steamapps/common/Black Mesa Dedicated Server"
    
  2. Run the Server:

    1
    ./srcds_run -game bms +hostname "My Linode" +map gasworks +maxplayers 24
    

The game parameter specifies the game’s files directory; don’t change it. This is the only parameter you can’t write in server.cfg because it specifies the game folder, where the server.cfg file itself is.
The hostname parameter specifies your server’s name in the browser list. By default it’s specified in server.cfg, so the +hostname parameter is overridden by it.
The map parameter specifies the map with which the server needs to start. You must write the name of the map file without the prefix.
The maxplayers parameter specifies the maximum number of players allowed to play on the server.

You can read the entire list of parameters on the Valve Wiki.

To keep the server running, execute it using Screen:

1
screen ./srcds_run -game bms +map gasworks +maxplayers 24

Configure a Black Mesa Dedicated Server

At the time of writing this guide, Black Mesa has yet to share with customers any official documentation regarding configurations.

Server.cfg

The server.cfg file contains the settings of your server. It is not needed because you can start the server every time by specifying desidered values using parameters.

/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/cfg/server.cfg
1
2
3
4
5
6
7
8
9
10
11
12
// Black Mesa server.cfg file
hostname "Black Mesa: Deathmatch" --> Your server's name.
mp_timelimit 900                  --> Round time limit.
mp_warmup_time 30                 --> Time before the match starts.
// sv_lan 0                       --> LAN Mode. (0 = disabled|1 = enabled).
// rcon_password                  --> The RCON password to login as admin to send commands to your server while you're in-game.
// mp_flashlight 1                --> Flashlight allowed. (0 = disabled|1 = enabled).
// mp_forcerespawn 0              --> Forced respawn, without the player prompt. (0 = disabled|1 = enabled).
// mp_friendlyfire 0              --> When enabled, a player can shoot another one of his own team. (0 = disabled|1 = enabled).
// mp_fraglimit 45                --> The number of kills needed to end the match.
// sv_logecho 1                   --> Prints logs in the console (0 = disabled|1 = enabled).
// sv_logfile 1                   --> Saves the logs to a file (0 = disabled|1 = enabled).

The settings in server.cfg will override the ones that you specify (using parameters) when you start the server.

Config_deathmatch.cfg

The config_deathmatch.cfg file contains the settings of the gamemode. You can edit almost everything in this file. It’s located at: /home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/cfg/config_deathmatch.cfg

Maps

Currently, there are 10 official maps in Black Mesa Dedicated Server: * dm_bounce * dm_chopper * dm_crossfire * dm_gasworks * dm_lambdabunker * dm_power * dm_stack * dm_stalkyard * dm_subtransit * dm_undertow

Three additional official maps are available in the Steam Workshop: * dm_boom * dm_rail * dm_shipping

Custom Maps

  • Custom maps in BSP format need to be put in the same folder as the official ones: /home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/maps/.

  • Custom maps in VPK format need to be put in the addons folder: /home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/addons/

  • Custom maps downloaded from the workshop need to be put in the workshop folder: /home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/addons/workshop

The add-ons to be loaded need to be specified in the addonlist.txt file. In the following example, maps that were downloaded from workshop to the list are added to dm_boom and dm_shipping:

/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/addonlist.txt
1
2
3
4
5
"AddonList"
{
 "workshop\432070352.vpk"		"1"
 "workshop\432074065.vpk"		"1"
}

You can find more maps in the Steam Workshop.

Maps Rotation

When a match ends, the server starts a new one with the next map in the rotation list. The map rotation list is in mapcycle.txt:

/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/cfg/mapcycle.txt
1
2
3
4
5
6
7
dm_bounce
dm_gasworks
dm_lambdabunker
dm_stalkyard
dm_subtransit
dm_undertow
dm_custom

To put a custom map in the rotation, simply write its name; for example: if you have the map dm_custom.bsp, you need to write dm_custom inside mapcycle.txt.

Connect to Your Server

  1. Open Black Mesa, and click on the PLAY ONLINE option:

    Black Mesa Main Menu.

  2. Find your server in the server list:

    Black Mesa Server Browser.

  3. Double click on it to connect:

    Black Mesa In-Game.

Extra

Autostart with screen script

This script automatically starts a Black Mesa Dedicated Server into a Screen session.

  1. Go into the Black Mesa Dedicated Server folder:

    1
    cd "/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/"
    
  2. Create the file to contain the script:

    /home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/run.sh
    1
    2
    3
    4
    #!/bin/sh
    cd "$HOME/Steam/steamapps/common/Black Mesa Dedicated Server"
    screen -S "BMDS" -d -m
    screen -r "BMDS" -X stuff "./srcds_run -game bms +map gasworks +maxplayers 24\n"
    
  3. Run the script:

    1
    ./run.sh
    

The game parameter specifies the game’s files directory, don’t change it. This is the only parameter you can’t write in server.cfg because it specifies the game folder, where the server.cfg file itself is.
The hostname parameter specifies your server’s name in the browser list. By default it’s specified in server.cfg, so the +hostname parameter is overridden by it.
The map parameter specifies with which map the server needs to start. You must write the name of the map file without the prefix.
The maxplayers parameter specifies the maximum number of players allowed to play on the server.

You can read the entire list of parameters on the Valve Wiki.

MetaMod

MetaMod is an add-on for servers using Source Engine that works as a “base” for other plug-ins like SourceMod.

  1. Go into the bms folder:

    1
    cd "/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/"
    
  2. Download MetaMod:

    1
    wget http://www.metamodsource.net/mmsdrop/1.10/mmsource-1.10.7-git951-linux.tar.gz
    

    This URL costantly changes as MetaMod is updated. Please check the downloads page for the current URL.

  3. Extract the downloaded archive:

    1
    tar -zxvf mmsource-1.10.7-git951-linux.tar.gz
    
  4. Cleanup:

    1
    rm mmsource-1.10.7-git951-linux.tar.gz
    
  5. Run the server and enter the command meta list in the console:

    1
    2
    meta list
    No plugins loaded.
    

If you get the same output, it means that MetaMod is working.

SourceMod

It is recommended that you install the SourceMod add-on. It provides useful functions, such as votemap, random map cycle, bans, reserved slots, admin system, and player commands; you can customize it as you want.

  1. Go into the bms folder:

    1
    cd "/home/steam/Steam/steamapps/common/Black Mesa Dedicated Server/bms/"
    
  2. Download SourceMod:

    1
    wget https://www.sourcemod.net/smdrop/1.8/sourcemod-1.8.0-git5829-linux.tar.gz
    

    This URL constantly changes as SourceMod is updated. Please check the downloads page for the current URL.

  3. Extract the downloaded archive:

    1
    tar -zxvf sourcemod-1.8.0-git5829-linux.tar.gz
    
  4. Cleanup:

    1
    rm sourcemod-1.8.0-git5829-linux.tar.gz
    
  5. Run the server and enter the command meta list in the console:

    1
    2
    3
    4
    meta list
    Listing 2 plugins:
     	 [01] SourceMod (1.8.0.5829) by AlliedModders LLC
     	 [02] SDK Tools (1.8.0.5829) by AlliedModders LLC
    

If you get similar output, it means that MetaMod and SourceMod are working.

Now, SourceMod will be automatically loaded by MetaMod when starting the Black Mesa Dedicated Server.

Read the MetaMod Official Wiki and the SourceMod Official Wiki for info about configurations, plug-ins, files, etc.

Enjoy!

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This guide is published under a CC BY-ND 4.0 license.