Dedicated Linux server extras: Difference between revisions

From TF2 Classic Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''Note: This guide was adapted and revised from a guide written by Raizo, the original of which can be found here: https://iraizo.github.io/tf2-classic-sourcemod-setup/''


== TF2 Classic SourceMod+Metamod Setup ==
== SourceMod+Metamod setup ==
<small>''Note: This guide was adapted and revised from a guide written by Raizo, the original of which can be found here: https://iraizo.github.io/tf2-classic-sourcemod-setup/''</small>


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 10:


=== Prerequisites ===
=== Prerequisites ===
This guide assumes you already have a dedicated Linux server running that can run without issues, if not lacking in additional components. If not you should follow [[Dedicated Linux server|this guide]] to setup your server first.
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 the same example install path as the main setup guide, so feel free to follow this guide directly if you did the setup guide too, or take not to reflect your own install path from the example one; <code>/opt/tf2classic/server/</code>.
This guide will use the same example install path as the main setup guide, so feel free to follow this guide directly if you use the same directory too <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. Download it to your server using wget/curl or to your machine and upload it to your server using SFTP:
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.


If using Linux Server Terminal or SSH instead of SFTP, first navigate to your server tf2classic folder, following example location from [[Dedicated Linux server|Dedicated Server Setup Guide]], you want to navigate to <code>/opt/tf2classic/server/tf2classic/</code> first.
Using Terminal or SSH instead of SFTP, first navigate to your server tf2classic folder, following example location from [[Dedicated Linux server|Dedicated Server Setup Guide]], you would 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>
''<small>This link may be outdated. You can check sourcemod downloads page for the newest version and copy URL of the newest build.</small>''


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 26:
<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>


you can now extract both inside your tf2classic folder (<code>/opt/tf2classic/server/tf2classic/</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><nowiki>$</nowiki> tar -xf sourcemod-1.11.0-git6917-linux.tar.gz</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>


There is still few crucial steps before launching the server.
=== 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.


=== Replacing <code>metamod.vdf</code> ===
You should navigate to your <code>../server/tf2classic/addons/</code>.
<code>metamod.vdf</code> is necessary for your server to recognize the game. Since this is a mod, we need to use a web tool to generate a metamod.vdf file for us that points to <code>tf2classic</code>.


You should navigate to your <code>~/server/tf2classic/addons/</code>, Following Dedicated Server Setup example, we should now navigate to: <code>/opt/tf2classic/server/tf2classic/addons/</code>
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.


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.
<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, at least currently, do not have SFTP available on your game server, you can alternatively do everything from Command Line/SSH connection.
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 have navigated to your <code>../tf2classic/addons</code> directory (<code>/opt/tf2classic/server/tf2classic/addons/</code>)
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 59:
<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 74:
===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> program already installed. Try first the following command:
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/Scags/TF2Classic-Tools.git</nowiki></code>
<code><nowiki>$</nowiki> git clone <nowiki>https://github.com/Scags/TF2Classic-Tools.git</nowiki></code>


If you do not have <code>git</code>, download this repo with wget directly:
If you do not have <code>git</code>, download the repo with wget directly:


<code><nowiki>$</nowiki> <nowiki>wget https://github.com/Scags/TF2Classic-Tools/archive/master.zip</nowiki></code>
<code><nowiki>$</nowiki> <nowiki>wget https://github.com/Scags/TF2Classic-Tools/archive/master.zip</nowiki></code>
Line 99: Line 97:
===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 with SourceMod, we have to add people to <code>admins_simple.ini</code> file.
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>/opt/tf2classic/server/tf2classic/addons/sourcemod/configs/admins_simple.ini</code> with a text editor, <code>nano</code> already familiar candidate. The file will be full of guidance and additional information how the file works for new users inside slashes. Do not worry about leaving all of it into the file as every line beginning with number of slashes are simply ignored, so this full 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:
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 umminity and root (full) access for administration. You can add more people to <code>admins_simple.ini</code> file but you should limit their access to the server by using examples within the file itself and documentation from SourceMod's wiki: https://wiki.alliedmods.net/Adding_Admins_(SourceMod)
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]


Save, exit and start/restart your server and everything should be running fine. You can make sure of 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.  
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.


Further tweaking of SourceMod to suit your needs is outside scope of 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]
[[Category:Guides]]

Latest revision as of 20:28, 15 November 2022

Note: This guide was adapted and revised from a guide written by Raizo, the original of which can be found here: https://iraizo.github.io/tf2-classic-sourcemod-setup/

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 the same example install path as the main setup guide, so feel free to follow this guide directly if you use the same directory too /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, following example location from Dedicated Server Setup Guide, you would 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/Scags/TF2Classic-Tools.git

If you do not have git, download the repo with wget directly:

$ wget https://github.com/Scags/TF2Classic-Tools/archive/master.zip

Then unzip it:

$ unzip master.zip

cd into the directory, being either TF2Classic-Tools or 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/

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.