Dedicated legacy Linux server extras: Difference between revisions
No edit summary |
Ditto |
||
| (12 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
{{Ambox|contents=This article is based on a guide written by Raizo, the original of which can be found [https://blog.raizo.dev/posts/tf2-classic-linux-server-tutorial/ here].}} | |||
{{Ambox|contents=This guide is written for the old ''Team Fortress 2 Classic'' non-Steam builds. This guide will not work for the modern ''Team Fortress 2 Classified'' Steam builds as it requires special steps.}} | |||
== | == SourceMod+Metamod setup == | ||
SourceMod+Metamod is powerful administrator tool for dedicated server owners and operators. SourceMod lets you add administrators easily based on SteamID, control and authenticate to the server securely and even add additional functionality to everyone on server like extended map voting functionality. | SourceMod+Metamod is powerful administrator tool for dedicated server owners and operators. SourceMod lets you add administrators easily based on SteamID, control and authenticate to the server securely and even add additional functionality to everyone on server like extended map voting functionality. | ||
| Line 10: | Line 11: | ||
=== Prerequisites === | === Prerequisites === | ||
This guide assumes you already have a dedicated Linux server | This guide assumes you already have a dedicated Linux server installed that can run without issues. If not you should follow [[Dedicated Linux server|this guide]] to setup your server first. | ||
This guide will use | This guide will use a <code>/opt/</code>-based installation, so feel free to follow this guide directly if you use the same directory too. We'll refer to it as <code>/opt/tf2classic/server/</code>, sometimes just <code>../server/</code>. Otherwise remember to use your own path instead. | ||
=== Getting SourceMod and MetaMod === | === Getting SourceMod and MetaMod === | ||
Visit the Stable builds section of [https://www.sourcemod.net/downloads.php?branch=stable sourcemod.net] and grab the latest Linux build | Visit the Stable builds section of [https://www.sourcemod.net/downloads.php?branch=stable sourcemod.net] and grab the latest Linux build and upload it to your server using SFTP. If you do not have SFTP on your server, download it to your server using wget or similar tool. | ||
Using Terminal or SSH instead of SFTP, first navigate to your server tf2classic folder. We'll navigate to <code>/opt/tf2classic/server/tf2classic/</code> first. | |||
<br>Then you can run wget to download SourceMod archive to your current directory: | |||
Then you can run wget to download SourceMod archive to your current directory: | |||
<code><nowiki>$ wget https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6917-linux.tar.gz</nowiki></code> | <code><nowiki>$ wget https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6917-linux.tar.gz</nowiki></code> | ||
You’ll also need stable [https://www.sourcemm.net/downloads.php?branch=stable Metamod:Source]. Download it with one of the ways you did. | You’ll also need stable [https://www.sourcemm.net/downloads.php?branch=stable Metamod:Source]. Download it with one of the ways you did. | ||
| Line 29: | Line 27: | ||
<code><nowiki>$ wget https://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1148-linux.tar.gz</nowiki></code> | <code><nowiki>$ wget https://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1148-linux.tar.gz</nowiki></code> | ||
''These links in wget examples may be outdated. You can check both SourceMod & metamod:source downloads page for the newest version and replace any outdated URL's from there.'' | |||
<code> | You can now extract both inside your <code>tf2classic</code> folder: | ||
<code><nowiki>$</nowiki> tar -xf sourcemod-1.11.0-git6917-linux.tar.gz</code><br> | |||
<code><nowiki>$</nowiki> tar -xf mmsource-1.11.0-git1148-linux.tar.gz</code> | <code><nowiki>$</nowiki> tar -xf mmsource-1.11.0-git1148-linux.tar.gz</code> | ||
You can delete the archive files after the extracted files are in correct place. | You can delete the archive files after the extracted files are in correct place. | ||
<code><nowiki>$</nowiki> rem sourcemod-1.11.0-git6917-linux.tar.gz</code> | <code><nowiki>$</nowiki> rem sourcemod-1.11.0-git6917-linux.tar.gz</code><br> | ||
<code><nowiki>$</nowiki> rem mmsource-1.11.0-git1148-linux.tar.gz</code> | <code><nowiki>$</nowiki> rem mmsource-1.11.0-git1148-linux.tar.gz</code> | ||
=== Replacing <code>metamod.vdf</code> === | |||
Correct <code>metamod.vdf</code> is necessary for metamod:source to start correctly. Since this is a third party mod, we can use a web tool to generate a custom metamod.vdf file that points to <code>tf2classic</code>. Otherwise, we create one from scratch in text editor. | |||
You should navigate to your <code>../server/tf2classic/addons/</code>. | |||
You | You can now delete <code>metamod.vdf</code> and <code>metamod_x64.vdf</code> in this directory. No need to back up these or anything, they are less than useless for TF2C server. | ||
<code><nowiki>$</nowiki> rem metamod.vdf</code><br> | |||
<code><nowiki>$</nowiki> rem metamod_x64.vdf</code> | |||
Head over to [https://www.sourcemm.net/vdf sourcemm.net/vdf]. | Head over to [https://www.sourcemm.net/vdf sourcemm.net/vdf]. | ||
You’re going to leave the “Game:” blank, or as “—”. In the “Game Folder” box, enter <code>tf2classic</code>. | You’re going to leave the “Game:” blank, or as “—”. In the “Game Folder” box, enter <code>tf2classic</code>. After downloading generated file with these variables, use SFTP to transfer it to your server's <code>../server/tf2classic/addons/</code> directory. | ||
If you | If you currently do not have SFTP available on your game server, you can alternatively do everything from Command Line/SSH, provided you have a text editor like <code>nano</code> installed. | ||
Make sure that you | Make sure that you are working in <code>../server/tf2classic/addons</code> directory. | ||
First create a <code>metamod.vdf</code> file in this directory with following command: | First create a <code>metamod.vdf</code> file in this directory with following command: | ||
| Line 61: | Line 60: | ||
<code><nowiki>$</nowiki> touch metamod.vdf</code> | <code><nowiki>$</nowiki> touch metamod.vdf</code> | ||
Followed by opening the file in your favorite command line editor, <code>nano</code> in this example: | Followed by opening the file in your favorite command line text editor, <code>nano</code> in this example: | ||
<code><nowiki>$</nowiki> nano metamod.vdf</code> | <code><nowiki>$</nowiki> nano metamod.vdf</code> | ||
And type in the following: | And type in the following to this blank file: | ||
<nowiki>"Plugin" | <nowiki>"Plugin" | ||
| Line 76: | Line 75: | ||
===Importing custom gamedata=== | ===Importing custom gamedata=== | ||
To fix many functions of SourceMod when running under Team Fortress 2 Classic, we need to import custom gamedata. | To fix many functions of SourceMod when running under Team Fortress 2 Classic, we need to import custom gamedata. | ||
<br>Move first to work under <code>../server/tf2classic/</code> directory (<code>/opt/tf2classic/server/tf2classic/</code>) | <br>Move first to work under <code>../server/tf2classic/</code> directory. (<code>/opt/tf2classic/server/tf2classic/</code>) | ||
If you are working with Ubuntu Server, you might have <code>git</code> | If you are working with Ubuntu Server, you might have <code>git</code> installed. Try first the following command: | ||
<code><nowiki>$</nowiki> git clone <nowiki>https://github.com/ | <code><nowiki>$</nowiki> git clone <nowiki>https://github.com/tf2classic/SM-TF2Classic-Tools.git</nowiki></code> | ||
If you do not have <code>git</code>, download | If you do not have <code>git</code>, download the repo with wget directly: | ||
<code><nowiki>$</nowiki> <nowiki>wget https://github.com/ | <code><nowiki>$</nowiki> <nowiki>wget https://github.com/tf2classic/SM-TF2Classic-Tools/archive/master.zip</nowiki></code> | ||
Then unzip it: | Then unzip it: | ||
| Line 90: | Line 89: | ||
<code><nowiki>$</nowiki> unzip master.zip</code> | <code><nowiki>$</nowiki> unzip master.zip</code> | ||
<code>cd</code> into the directory, being either <code>TF2Classic-Tools</code> or <code>TF2Classic-Tools-master</code> depending on how you downloaded it. | <code>cd</code> into the directory, being either <code>SM-TF2Classic-Tools</code> or <code>SM-TF2Classic-Tools-master</code> depending on how you downloaded it. | ||
<br>Run the following command to copy <code>sourcemod</code> directory to your server's <code>addons</code> folder: | <br>Run the following command to copy <code>sourcemod</code> directory to your server's <code>addons</code> folder: | ||
<code><nowiki>$</nowiki> cp -r sourcemod/ ../addons/</code> | <code><nowiki>$</nowiki> cp -r sourcemod/ ../addons/</code> | ||
Then, we need to stop sourcemod from auto-updating its gamedata. Locate the sourcemod <code>core.cfg</code> config file (located in <code>addons/configs</code>) and change: | |||
<code>"DisableAutoUpdate" "no"</code> | |||
to | |||
<code>"DisableAutoUpdate" "yes"</code> | |||
Now we have the necessary gamedata for plugins and core SM and MM functions to work with TF2C. | Now we have the necessary gamedata for plugins and core SM and MM functions to work with TF2C. | ||
| Line 99: | Line 106: | ||
===Setting yourself as the “root” admin user and finalizing.=== | ===Setting yourself as the “root” admin user and finalizing.=== | ||
To register yourself as an administrator on your server | To register yourself as an administrator on your server's SourceMod, we have to add people to <code>admins_simple.ini</code> file. | ||
You want to find out your SteamID using a website like [https://steamid.io/ steamid.io]. Enter your steam community URL to the site and you should get set of info that includes your <code>steamID</code>, which should be in <code>STEAM_0:1:16</code> format. | You want to find out your and/or your to-be administrator's SteamID using a website like [https://steamid.io/ steamid.io]. Enter your steam community URL to the site and you should get set of info that includes your <code>steamID</code>, which should be in <code>STEAM_0:1:16</code> format. | ||
Open the file <code> | Open the file <code>../server/tf2classic/addons/sourcemod/configs/admins_simple.ini</code> with a text editor, <code>nano</code> for example. The file will be full of guidance and additional information about how the file works after slashes. Do not worry about leaving it all in as every line beginning with number of slashes are simply ignored, so this filled looking file is empty as it comes to how SourceMod handles it. Punch a new line at the bottom of this file and enter the following: | ||
<code>"STEAM_0:1:16" "99:z"</code> | <code>"STEAM_0:1:16" "99:z"</code> | ||
Replace <code>STEAM_0:1:16</code> with your own or your master administrator's steamID that you extracted with afformentioned [https://steamid.io steamid.io] for example. "99:z" in this case assigns high | Replace <code>STEAM_0:1:16</code> with your own or your master administrator's steamID that you extracted with afformentioned [https://steamid.io steamid.io] for example. "99:z" in this case assigns high immunity level and root (full) access for administration and server control. You can add more people to <code>admins_simple.ini</code> file but you should limit their access to the server appropriately by using examples within the file itself and documentation from SourceMod's wiki: https://wiki.alliedmods.net/Adding_Admins_(SourceMod) | ||
Save, exit and start/restart your server and everything should be running fine. You can test this by typing <code>meta version</code> in your server console (or RCON). You should see a line like <code>"Loaded As: Valve Server Plugin."</code>. Additionally, if you assigned yourself as an administrator for the server, typing <code>!admin</code> or <code>/admin</code> in chat should bring up administrative menu on player hud. <code>sm_admin</code> should additionally work when typed in to your client console window, and you can use <code>sm_rcon</code> to use SourceMod to relay any console command to the server, if you set yourself up with <code>z</code> flag. | |||
Further tweaking of SourceMod to suit your needs is out of scope for this guide. You can get familiar with SourceMod's other functions and configuration in their wiki: [https://wiki.alliedmods.net/Category:SourceMod_Documentation wiki.alliedmods.net/Category:SourceMod_Documentation] | |||
Additionally, if you have setup RCON on your server before setting up SourceMod, you should disable it by wiping <code>rcon_password ""</code> empty in <code>server.cfg</code>. After it is working, using SourceMod and <code>sm_rcon</code> for RCON commands is more secure for publicly hosted servers. | |||
[[Category:Guides]] | |||
Latest revision as of 12:28, 2 March 2026
| This article is based on a guide written by Raizo, the original of which can be found here. |
| This guide is written for the old Team Fortress 2 Classic non-Steam builds. This guide will not work for the modern Team Fortress 2 Classified Steam builds as it requires special steps. |
SourceMod+Metamod setup
SourceMod+Metamod is powerful administrator tool for dedicated server owners and operators. SourceMod lets you add administrators easily based on SteamID, control and authenticate to the server securely and even add additional functionality to everyone on server like extended map voting functionality.
SourceMod isn’t necessarily drag-and-drop like supported SM games are such as live TF2 and CS:Source due to this simply being a mod built off of Source SDK 2013 with things like a different game name (tf2classic), offsets, signatures, etc.
While the process of getting SM to work isn’t that hard, generic source server guides do not cover few unique factors that come with setting up fully working MM+SM for mods like TF2 Classic.
Prerequisites
This guide assumes you already have a dedicated Linux server installed that can run without issues. If not you should follow this guide to setup your server first.
This guide will use a /opt/-based installation, so feel free to follow this guide directly if you use the same directory too. We'll refer to it as /opt/tf2classic/server/, sometimes just ../server/. Otherwise remember to use your own path instead.
Getting SourceMod and MetaMod
Visit the Stable builds section of sourcemod.net and grab the latest Linux build and upload it to your server using SFTP. If you do not have SFTP on your server, download it to your server using wget or similar tool.
Using Terminal or SSH instead of SFTP, first navigate to your server tf2classic folder. We'll navigate to /opt/tf2classic/server/tf2classic/ first.
Then you can run wget to download SourceMod archive to your current directory:
$ wget https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6917-linux.tar.gz
You’ll also need stable Metamod:Source. Download it with one of the ways you did.
$ wget https://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1148-linux.tar.gz
These links in wget examples may be outdated. You can check both SourceMod & metamod:source downloads page for the newest version and replace any outdated URL's from there.
You can now extract both inside your tf2classic folder:
$ tar -xf sourcemod-1.11.0-git6917-linux.tar.gz
$ tar -xf mmsource-1.11.0-git1148-linux.tar.gz
You can delete the archive files after the extracted files are in correct place.
$ rem sourcemod-1.11.0-git6917-linux.tar.gz
$ rem mmsource-1.11.0-git1148-linux.tar.gz
Replacing metamod.vdf
Correct metamod.vdf is necessary for metamod:source to start correctly. Since this is a third party mod, we can use a web tool to generate a custom metamod.vdf file that points to tf2classic. Otherwise, we create one from scratch in text editor.
You should navigate to your ../server/tf2classic/addons/.
You can now delete metamod.vdf and metamod_x64.vdf in this directory. No need to back up these or anything, they are less than useless for TF2C server.
$ rem metamod.vdf
$ rem metamod_x64.vdf
Head over to sourcemm.net/vdf.
You’re going to leave the “Game:” blank, or as “—”. In the “Game Folder” box, enter tf2classic. After downloading generated file with these variables, use SFTP to transfer it to your server's ../server/tf2classic/addons/ directory.
If you currently do not have SFTP available on your game server, you can alternatively do everything from Command Line/SSH, provided you have a text editor like nano installed.
Make sure that you are working in ../server/tf2classic/addons directory.
First create a metamod.vdf file in this directory with following command:
$ touch metamod.vdf
Followed by opening the file in your favorite command line text editor, nano in this example:
$ nano metamod.vdf
And type in the following to this blank file:
"Plugin"
{
"file" "../tf2classic/addons/metamod/bin/server"
}
before saving and exitting.
Importing custom gamedata
To fix many functions of SourceMod when running under Team Fortress 2 Classic, we need to import custom gamedata.
Move first to work under ../server/tf2classic/ directory. (/opt/tf2classic/server/tf2classic/)
If you are working with Ubuntu Server, you might have git installed. Try first the following command:
$ git clone https://github.com/tf2classic/SM-TF2Classic-Tools.git
If you do not have git, download the repo with wget directly:
$ wget https://github.com/tf2classic/SM-TF2Classic-Tools/archive/master.zip
Then unzip it:
$ unzip master.zip
cd into the directory, being either SM-TF2Classic-Tools or SM-TF2Classic-Tools-master depending on how you downloaded it.
Run the following command to copy sourcemod directory to your server's addons folder:
$ cp -r sourcemod/ ../addons/
Then, we need to stop sourcemod from auto-updating its gamedata. Locate the sourcemod core.cfg config file (located in addons/configs) and change:
"DisableAutoUpdate" "no"
to
"DisableAutoUpdate" "yes"
Now we have the necessary gamedata for plugins and core SM and MM functions to work with TF2C.
Setting yourself as the “root” admin user and finalizing.
To register yourself as an administrator on your server's SourceMod, we have to add people to admins_simple.ini file.
You want to find out your and/or your to-be administrator's SteamID using a website like steamid.io. Enter your steam community URL to the site and you should get set of info that includes your steamID, which should be in STEAM_0:1:16 format.
Open the file ../server/tf2classic/addons/sourcemod/configs/admins_simple.ini with a text editor, nano for example. The file will be full of guidance and additional information about how the file works after slashes. Do not worry about leaving it all in as every line beginning with number of slashes are simply ignored, so this filled looking file is empty as it comes to how SourceMod handles it. Punch a new line at the bottom of this file and enter the following:
"STEAM_0:1:16" "99:z"
Replace STEAM_0:1:16 with your own or your master administrator's steamID that you extracted with afformentioned steamid.io for example. "99:z" in this case assigns high immunity level and root (full) access for administration and server control. You can add more people to admins_simple.ini file but you should limit their access to the server appropriately by using examples within the file itself and documentation from SourceMod's wiki: https://wiki.alliedmods.net/Adding_Admins_(SourceMod)
Save, exit and start/restart your server and everything should be running fine. You can test this by typing meta version in your server console (or RCON). You should see a line like "Loaded As: Valve Server Plugin.". Additionally, if you assigned yourself as an administrator for the server, typing !admin or /admin in chat should bring up administrative menu on player hud. sm_admin should additionally work when typed in to your client console window, and you can use sm_rcon to use SourceMod to relay any console command to the server, if you set yourself up with z flag.
Further tweaking of SourceMod to suit your needs is out of scope for this guide. You can get familiar with SourceMod's other functions and configuration in their wiki: wiki.alliedmods.net/Category:SourceMod_Documentation
Additionally, if you have setup RCON on your server before setting up SourceMod, you should disable it by wiping rcon_password "" empty in server.cfg. After it is working, using SourceMod and sm_rcon for RCON commands is more secure for publicly hosted servers.