Absurd Minds

More than 100 years without a motto.
It is currently 25 Jun 2018 09:32

All times are UTC-04:00




Post new topic  Reply to topic  [ 19 posts ] 
Author Message
PostPosted: 08 Jul 2011 15:58 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
I am going to try to set up a CentOS server on my home machine and optimize it for gaming. This will be the guide to doing it.

Before you begin, I suggest taking a look at the useful software for running a game server. Though this software isn't required, I think it makes things significantly easier. For example, even though I am setting up this server in my computer room, it is still significantly easier for me to use PuTTY on my main computer instead of having to go back and forth from one computer to another.

Table of Content
  1. Installing Centos
  2. Initial Configuration
    1. Configuring the Firewall
    2. Updating the Installation
  3. Basic Server Configuration for Game Servers
  4. Installing a HLDS Game Server
  5. Launching your Game Server
  6. Basic Server Configuration
    1. Core Server Files
    2. Auxiliary Server Files
    3. Adding Metamod
    4. Adding AmxModX
      1. Adding plugins
      2. Adding admin
  7. Optimizing the System
    1. pingboost
  8. Installing HLTV
  9. Adding Rules to iptables
  10. Installing a Team Fortress 2 or a Half-Life 2 server
  11. Basic TF2 Server Configuration
    1. Installing Metamod:Source
    2. Installing SourceMod
      1. Installing plugins
      2. Adding admin


Top
   
PostPosted: 08 Jul 2011 16:07 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing CentOS

The first thing you need to do is download CentOS. There are tons of mirrors. You can find a list of those CentOS mirrors here. It will be either eight or so CDs or two DVDs. Make sure you download the most recent version unless you have some reason not to.

Put that CD into the server machine and boot the machine you are wanting to install it on from CD Drive. (Usually pushing F12 during boot brings up a boot menu.)

Once it boots from the disc it will lead you through the installation. It will ask you for a graphical install or a text install. Since I am setting this up to be a server and thus I don't need any graphical interface whatsoever, I chose text install.

The first part is just loading a bunch of drivers.

My installation hung right here at "Loading ata_piix driver". Apparently, CentOS 5.x has some sort of bug that makes it incompatible with a Dell Inspiron 530 (the exact computer I was trying to load it on). I went into the BIOS like the bug report suggested and changed my Sata Mode to RAID. It seems to have fixed the problem.

Next, it asked if I wanted to test the CD media. Since I had sort of scratched it up I decided to choose "OK", but it does take a while, so unless you really have a reason to verify your CD, I would suggest simply choosing "Skip".

It will now ask you for your language and your model keyboard. The answers will probably be "English" and "us". "us" is just a standard qwerty keyboard with no special buttons. Chances are, unless you know your keyboard is something special, it is just a "us" keyboard.

Next it asks what Hard Drive I want to install on. Since this computer has only one hard drive, and I am devoting this entire hard drive to the server (that is, I don't want to partition it at all), I am going to choose that hard drive. I also chose "Remove all partitions and use default partitioning". Unless you're doing something fancy, the default partitioning scheme should be fine.

Next it asks if I want to configure eth0, which is the network card. I chose "Activate on boot" and "Enable IPv4 support".

Since you are running a server (and I assume you're using a router), you don't want your machine's IP address to change. So choose "Manual address configuration" instead of DHCP. Choose an IP address that you want for your machine. Usually it will be something like 192.168.0.4 or something along those lines. This would be if your router's internal IP address is 192.168.0.1. (If you want more information about the IP address, check out this thread.)

If you have trouble figuring out any of the next values, you can usually find it by opening a command prompt on a computer that is connect to the same network, and typing
Code:
ipconfig /all
This will tell you tons of things about your network.

It will also ask for your Prefix (Netmask). It is probably 255.255.255.0, but check this with ipconfig /all.

The next asks for Gateway, Prinary DNS, and Secondary DNS. The Gateway is probably going to be the address of the router, which you can check with ipconfig /all. It will be called the "Default gateway".

For the Primary DNS, I put 192.168.1.1. (I initially didn't put anything because I couldn't figure out what I was supposed to put, but it led to problems later. After some searching around, I put my router's IP address, and now everything works fine.) I did not put a secondary DNS.

Now you must choose a hostname for your server. I just called my server1 because I'm not imaginative.

Choose what time zone your in.

Now, choose a root password. The "root" user in a linux environment is the one who has the power to do everything. Root security is very important, and you need to pick a good root password or you risk compromising your system.

Now the installation will ask about some things you may want to install. Since I am installing this simply to be a server machine, I am going to uncheck the "Desktop" feature. I can do everything I need to through the command line, so I see no reason to have that. Instead, I chose "Server". Also make sure to check "Customize Software Selection".

Now it gives me a big list of other things I can install. I am planning on using this server to run a HLDS game server, HLTVs, and maybe a website. I can always go back later and install other packages if I need to, but to start out with, this is what I chose:
  • Base
  • DNS Name Server
  • Development Libraries
  • Development Tools
  • Editors
  • FTP Server
  • Java
  • Java Development
  • Legacy Network Server
  • Mail Server
  • MySQL Database
  • Network Servers
  • Ruby
  • Server Configuration Tools
  • System Tools
  • Text-based Internet
  • Web Server
  • Windows File Server
Click OK a couple of times, and the installation is finally ready to begin.


Top
   
PostPosted: 08 Jul 2011 20:01 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Firewall Configuration

The most important thing to do now is configure the Firewall. CentOS comes installed with IPtables. When you reboot the computer, you should be presented with a screen that looks something like this:

Image

Now, if you don't click on anything for a bit, it will go past this screen. If you restart your computer and go make yourself a snack and it is already on the logon screen, you can restart the machine to get back to here.

Anyway, choose Firewall Configuration.

I left the Security Level "Enabled", but I changed SELinux to "Disabled". SELinux is usually more hassle than it's worth, especially on a home game server like this.

Then I chose "Customize" to customize my firewall's settings.

A "Trusted Device" basically means that, if selected, any traffic on this device will be allowed in. Basically, it disables the firewall for that device. (This would be important if you had one network device for internal network traffic and a different device for traffic from outside the network.) Since I only have one internet device, and I want all the traffic on it to be monitored by the firewall, I do not select anything for "Trusted Device".

I'm not quite sure what "MASQUERADE Devices" means, but this should probably remain unchecked and should definitely stay unchecked if you only have one network device (like I do).

I now need to decide what type of traffic I want to allow on my server. I'm going to say that these services are trusted:
  • www (because I'm planning on putting a website on this machine)
  • ssh (because I'm planning on controlling my server remotely through PuTTy)
  • FTP (because I will be using FTP access to upload files to the machine)
I'm going to start with this, but if I find I need to reconfigure this later I can.

Other ports: Since I am planning on running game servers, I also need to allow other, non standard ports. Portforward.com has a great list of applications and their ports. For example, for Counter Strike, I would need to enable TCP traffic on ports 27020-27039 and UDP traffic on 1200 and 27000-27015. I'm going to edit these into the firewall after the system reboots.

Once you've got that done, reboot the computer.


Top
   
PostPosted: 09 Jul 2011 12:46 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Updating the installation

Now get some software and update some stuff. Your installation disc was probably somewhat out of date, so this will allow you update the packages that it initially installed.
Code:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum update
That updated everything. Now I'm going to install some basic packages that I'll need for later on.
Code:
yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++
For example, wget is the package that allows you to get files from the internet. lynx is a text-based browser. So we're just installing a few basic packages that will allow us to do everything more efficiently.


Top
   
PostPosted: 09 Jul 2011 13:15 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Basic Server Configuration for Game Servers

Now that I've got the basics, I need to do a few things specifically for the purpose of having a game server.

I should have already installed most of the needed packages during the initial installation process, since I checked pretty much everything that I would need.

Now I need to make a user to run the game server. You should never run processes as root if you don't have to. You don't have to run a game server as root, do don't!
Code:
useradd gamer
passwd gamer
Now enter in the password. Remember, linux does NOT generally mirror your password typing with ***** or similar. As you push keys, it will look like you're not typing anything, but you are.

When you create a user, it creates a home directory /home/gamer. If you log into ssh with your gamer account, it will automatically take you to that home directory. If you're operating as root, you'll have to cd there. But that'll be the directory in which you build your game servers.


Top
   
PostPosted: 09 Jul 2011 14:13 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing a Game Server

You can now actually install a game server. Since my other tutorial was for FreeBSD, I'll make a separate tutorial for CentOS, since a few of the commands are slightly different.

Since you've already made the gamer user, you need to either log in to your server using that name and password, or simply switch users.
Code:
su gamer
What I am going to do now is set up a test server in condition zero that I can use to test plugins or mods. I'm going to make a czero directory for my various czero servers, and then a test folder to put the test server in.

(Fun fact: You can go to your user's home directory by using "cd ~". ~ is the shortcut for the user's home directory.)
Code:
[/home/gamer] $ mkdir ./czero
mkdir ./czero/test
cd ./czero/test
Now that I've got the directory, I am going to install the appropriate files.

(Fun Fact: If you are using PuTTY, you can copy a URL from your browser, and then paste it into your command line in PuTTY by using right click.)
Code:
wget http://storefront.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
yes
When I tried this the first time, I kept getting a strange error:
Code:
sh: uncompress: command not found
tar: This does not look like a tar archive
tar: Error exit delayed from previous errors
Apparently, I had to link the "uncompress" command to "gzip" so that it would actually uncompress the file.
Code:
ln -s /bin/gzip /bin/uncompress
(I had to do this as root.)

Once I had that fixed, I continued with the installation.
Code:
chmod +x steam
./steam -command update -game czero -dir .
Notice the . at the end of the line. That tells it to install in the current directory.

You will probably have to run this command twice. (Fun Fact: Hitting the up key at the command line will re-enter the line you just used. So instead of typing the whole line again, just hit up and then enter.) This may take a while depending on your internet connection and how responsive the steam servers currently are. In the various servers I have installed, it has taken anywhere between 5 minutes and 45 minutes.

For a full list of games that you can install using the HLDS update tool, check out this link. Look at the "update" column for the code you should use when installing the server.

Once this has completed, you have a basic HLDS server.

[youtube]
[/youtube]


Top
   
PostPosted: 09 Jul 2011 15:09 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Launching Your Game Server

Now that your server is installed, you can launch it. You will launch it from the directory in which you initially installed the Steam program. In my case, that is ~/gamer/czero/test.

First off, are you accessing your server through PuTTY, or are you sitting at the physical machine? If you are using PuTTY, read this next part. If not, you can skip ahead.

------

PuTTY is a means of accessing your server, but when you close your PuTTY window, your session will close, which means that anything your user was running (including a server) will shut down. To remedy this problem, use a program called "screen".

First, we will install screen.
Code:
yum install screen
Now, before launching your server, open up a new screen session. This screen session operates exactly like a normal session. You start screen by simply typing "screen" at the command line.

If you're unfamiliar with screen, this is a really good tutorial for using it.

-----

Anyway:

Launching the server basically uses three things: You tell it what game to launch, you define some command line operations, and you can define some cvars.

This is an example of a command line to launch a czero server:
Code:
./hlds_run -game czero +ip xxx.xxx.xxx.xxx +port 27015 -pingboost 1 +map de_dust2_cz -autoupdate +maxplayers 20
Stuff with a "-" in front of it is a command line variable. There is a full list of Command Line Parameters here. Most of them you will never use, but a lot of them can be helpful if you're needing to configure your server beyond the "normal" in order to optimize it.

Stuff with a "+" in front if it is simply a cvar that you adding to the command line instead of the server.cfg. For example, you can put "map de_dust2_cz" in your server.cfg file, or you can put +map de_dust2_cz in your command line. This is completely up to you.

It doesn't really matter what order you put the stuff in, but just remember to start with "./hlds_run -game <game name>". Remember this list of games from earlier? This time, look at the "launch" column to see what to put into <game name> for the game you are running.


Top
   
PostPosted: 09 Jul 2011 16:59 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Core Server Files

Your basic server has a few core server files that you can edit to optimize your server to your liking.

All of these server files are located in the game server's directory, in a subdirectory for that specific game. For example, it might be located at /home/user/server/czero, or at ~/test/cstrike.

You can use nano, a linux text editor, to edit any file. Either cd to the directory of the file, or add the directory before the file.

Examples: From the current directory, use
Code:
nano server.cfg
From a different directory, use
Code:
nano ~/czero/test/czero/server.cfg
The most important is your server.cfg file.

server.cfg

The server.cfg file is one of the most extensive and most customizable in the game. There are tons of different cvars you can add. I will attempt to explain all of those, as well as group them by category.

Ban files
exec banned.cfg - executes the banned.cfg file
exec listip.cfg - executes the listip.cfg file
writeid - writes new banned users to the appropriate list

Server configurations
hostname "server name" - changes the name of the server in the game server list
rcon_password "password" - sets the rcon password to allow users to execute commands on the server remotely
sv_password "password" - locks the server so users have to type a password in order to enter
sv_lan <0|1> - toggles if the server is only accessed on the lan (1) or if it is accessible outside of it's lan (0)
sv_region <0|1|2|3|4|5|6|7|255> - sets the server's region. List of regions.
log <on|off> - sets whether the server will log key events
mp_logdetail <0|1> - sets whether the server will log with high detail
mp_logmessages <0|1> - sets whether the server will log chat messages
pausable <0|1> - sets whether or not the server can be paused
sv_cheats <0|1> - toggles VAC secure mode

Upload and download
sv_downloadurl "http://www.xxxxx.xxx" - allows you to set a fast download URL
sv_allowupload <0|1> - sets whether players are allowed to spray custom sprays in a server
sv_allowdownload <0|1> - sets whether players are allowed to download content from the server
decalfrequency <integer> - the time, in seconds a players must wait before spray a tag again
mp_consistency <0|1> - whether or not a player needs to have default models, sounds, etc., when joining your server

Voice
sv_voiceenable <0|1> - sets whether players can talk
sv_voicecodec voice_speex - the voice codec. voice_speex is the default
sv_voicequality <1|2|3|4|5> - 1 is terrible, 3 is about normal, 5 is for highly competitive servers
sv_alltalk <0|1> - sets whether or not players can hear players on the other team

Gameplay
mp_c4timer <integer> - time, in seconds, the c4 will tick before exploding
mp_autoteambalance <0|1> - sets whether the teams will auto team balance if there are too many players on one team
mp_limitteams <0|1|2> - sets the number of players one team must have over another team in order to trigger an auto team balance. 0 disables.
mp_allowspectators <0|1> - sets whether players can spectate in the server.
mp_autokick <0|1> - decides if idle players or team kills should be automatically kicked
mp_freezetime <integer> - the number of seconds at the beginning of the round before players can begin to play
mp_buytime <integer> - the number of minutes a player is allowed to buy for
mp_startmoney <integer from 800-16000> - the number of dollars players start the match with
mp_flashlight <0|1> - sets whether or not players can use flashlights
mp_footsteps <0|1> - toggles footstep sounds
mp_forcecamera <0|1|2> - 0: dead players can spectate anyone. 1: dead players can only spectate teammates. 2: dead players can only spectate teammates in first person view
mp_friendlyfire <0|1> - toggles friendly fire
mp_hostagepenalty <integer> - the number of hostages a player can kill before being kicked
mp_tkpunish <0|1> - sets whether a player will be slayed for team killing.
mp_timelimit <integer> - the number of minutes before a map change
mp_maxrounds <integer> - the number of rounds before a map change
mp_winlimit <integer> - the number of rounds a team must win before a map change
mp_roundtime <integer> - the number of minutes in each round
mp_chattime <integer> - the number of seconds the score board idles before the map changes

HLTV
sv_hltv <0|1> - sets whether or not HLTVs are allowed to connect
sv_proxies <0|1|2> - the number of HLTVs that are allowed to simultaneous connect to a server

Bot control
humans_join_team <T|CT|any> - sets which teams humans are allowed to join
bot_join_team <T|CT|any> - sets which teams bots are allowed to join
bot_quota <integer> - sets the number of bots on the server
bot_auto_vacate <0|1> - sets whether bots will leave when the server is full to make room for a human
bot_difficulty <0|1|2|3> - sets the bot difficulty
bot_join_after_player <0|1> - sets whether the bots stay on the server or if they only join after a human joins
bot_allow_grenades <0|1>
bot_allow_shield <0|1>
bot_allow_snipers <0|1>
bot_allow_machine_guns <0|1>
bot_allow_rifles <0|1>
bot_allow_shotguns <0|1>
bot_allow_submachine_guns <0|1>
bot_allow_pistols <0|1>
bot_prefix <prefix> - allows you to put a prefix on the bot's names
bot_chatter <on|off> - toggles the bot radio chatter
bot_defer_to_human <0|1> - toggles whether a bot will defuse/plant/rescue hostages if humans are still alive
bot_stop <0|1> - toggles whether or not the bots move

Server rates - for a detailed explanation of server rates, check out this thread.
sys_ticrate <integer 0-1000> - sets the fps of the server
sv_maxrate <integer>
sv_minrate <integer>
sv_maxupdaterate <integer 0-100>
sv_minupdaterate <integer>


banned.cfg

This file allows you to ban users by SteamID. A general input looks like this:

Code:
banid <time in minutes> <steamID>
For example, to permanent ban a user, I use
Code:
banid 0.0 STEAM_0:1:234567
To ban a user for 1 day, I could use
Code:
banid 1440.0 STEAM_0:1:234567
listip.cfg

This file is for banning IP addresses.
Code:
banip <time in minutes> <IP Address>
motd.txt

This is the MOTD that people will see when they first join the server, before they choose what team they go on. You can edit this however you want, to make a nice fancy MOTD if you desire. You can add things like your server's name, your server's rules, a list of admin, or whatever. It uses HTML, so if you know HTML you can also configure the text styles and colours.

Fixing the MOTD scrolling problem

I noticed on my server, after I had added a bunch of lines to the MOTD, that the MOTD needed to scroll. It was too much text to fit on the screen at once, so the MOTD had a scroll bar. For some reason, though, dragging the scoll bar did not work. The scroll bar went down, but the text did not move up. It made it impossible to read the rest of the MOTD.

To fix this problem, delete the following line at the top of the MOTD:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
I have no idea what that line does or why it breaks the scrolling, but removing that line fixes the problem.

mapcycle.txt

These are all the maps that the server cycles through. If you download a custom map, you need to add it to the mapcycle.txt in order for it to show up in the map rotation. This is also the order the maps cycle in. Switch the maps around to change up the order that they come up in.

I found it extremely helpful to just keep them in alphabetical order. It made it a lot easier to remove maps if I ever needed to, and since I was using an AMX map vote plugin, it didn't get boring - it wasn't all the cs maps first, and then all the de maps.

If you're not using AMX, try mixing up the maps into an order that seems like it would be fun. Maybe put lesser-played maps in between dust2 and aztec, to keep the gaming interesting. Or, delete all but the four or five most popular maps, to have a server with only those most popular and well-played maps.


Top
   
PostPosted: 09 Jul 2011 17:05 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Auxiliary Server Files

There are some auxiliary server files that, while you don't necessarily have to edit them, may be interesting to edit.

BotChatter.db
This file tells the server where to find the sound files that the bots use when talking. You could edit these files to point to random sounds or your own bot chatter if you wanted.

BotProfile.db
In here, you can edit the bot profiles. You can change their teamplay, their courage, their accuracy, stuff like that.


Top
   
PostPosted: 10 Jul 2011 16:37 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing metamod

Now that I have my basic server, I want to edit it. I'm trying to make a server that runs AmxModX, which requires metamod. (You should check this URL to get the latest version of metamod.)

I need to be in my game's home directory. (czero, cstrike, dod, whatever it is.) So in my example, I'm at ~/czero/test/czero.
Code:
mkdir ./addons
mkdir ./addons/metamod
mkdir ./addons/metamod/dlls
cd ./addons/metamod/dlls
wget http://prdownloads.sourceforge.net/metamod-p/metamod-p-1.19p32-linux_i586.tar.gz
tar xfz metamod-p-1.19p32-linux_i586.tar.gz
I personally like to delete the tar.gz file once I've extracted it.
Code:
rm metamod-p-1.19p32-linux_i586.tar.gz
Now, back in the server's root directory, there is a file called liblist.gam. I have to edit it. I can either go back there by typing the full path of the directory:
Code:
cd ~/czero/test/czero
Or I can use a handy shortcut. cd ../ means to go up a directory:
Code:
cd ../../../
Code:
nano liblist.gam
Edit the line: gamedll_linux "dlls/cs_i386.so"
Replace it with: gamedll_linux "addons/metamod/dlls/metamod_i386.so"

Now you have metamod installed and you can go on to install other mods, like AmxModX.

[youtube]
[/youtube]


Top
   
PostPosted: 10 Jul 2011 16:57 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing AmxModX

I am creating this test server primarily to test out AMX plugins, so I'm going to install AmxModX next.

First, I have to get the necessary files. Make sure you download the AMX base file, and then the specific AMX file that works with whatever game you are running. I am installing the cstrike one since I am running a Condition Zero server.

Once I have these files, I will extract them.

Then I will create a file called "plugins.ini" in the metamod directory that tells metamod that I am running AMX.

I need to start out in my server's base czero folder.
Code:
cd /home/gamer/czero/test/czero
wget http://downloads.sourceforge.net/project/amxmodx/AMX%20Mod%20X%20Base/1.8.1/amxmodx-1.8.1-base.tar.gz
wget http://downloads.sourceforge.net/project/amxmodx/Counter-Strike%20Addon/1.8.1/amxmodx-1.8.1-cstrike.tar.gz
tar xfz amxmodx-1.8.1-base.tar.gz
tar xfz amxmodx-1.8.1-cstrike.tar.gz
Again, I like to remove the tar.gz files.
Code:
rm amxmodx-1.8.1-base.tar.gz
rm amxmodx-1.8.1-cstrike.tar.gz
Code:
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > /home/gamer/hlds/czero/addons/metamod/plugins.ini
Now you have a basic HLDS server with AmxModX running. Time to do some more configuration!

[youtube]
[/youtube]


Top
   
PostPosted: 11 Jul 2011 18:00 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Adding Plugins

Adding plugins to a server can seem tricky, but it's actually just a lot of steps.

Step 1: Find (or make) a plugin.
If you know the AMX scripting language, you can make your own plugin, but chances are you'll just want to download plugins that other people have made. The place to do that is alliedmods. They have tons of plugins, and if you can't find what you're looking for you can put in a plugin request and possibly have somebody make it for you.

Step 2? Compile the plugin.
There are two types of files you might download from alliedmods: An amxx file (which is the actual plugin) and a sma file (which is the scripting file). Or you may just have a sma file that you wrote yourself. Either way, at some point, you may have to compile a plugin.

Put the .sma file into the czero/addons/amxmodx/scritping folder. Let's say it is called filename.sma. In that directory, use the following command:
Code:
./amxxpc filename.sma
This will compile your filename.sma into an amxx file, called filename.amxx. Now, move that file to the /amxmodx/plugins folder.
Code:
mv filename.amxx ../plugins
Step 3: Edit the plugins.ini file.
There is a file in /amxmodx/configs called plugins.ini. Use nano to edit it. At the bottom, there should be a section for Third party plugins. Add filename.amxx to the list. It should now look something like this:
Code:
; AMX Mod X plugins

; Admin Base - Always one has to be activated
admin.amxx              ; admin base (required for any admin-related)
;admin_sql.amxx         ; admin base - SQL version (comment admin.amxx)

; Basic
admincmd.amxx           ; basic admin console commands
adminhelp.amxx          ; help command for admin console commands
adminslots.amxx         ; slot reservation
multilingual.amxx       ; Multi-Lingual management

................

; Enable to use AMX Mod plugins
;amxmod_compat.amxx     ; AMX Mod backwards compatibility layer

; Custom - Add 3rd party plugins here
filename.amxx
This tells AMX to look for that plugin.

Step 4: Edit the plugin cvars.
Most plugins have variables that you can control, called cvars. These will be things like how long it takes to respawn, how much money players get at the beginning of rounds, or other variables related to whatever plugin you have installed. These cvars go into the amxx.cfg file located in /amxmodx/configs. Again, use nano to open this file.

If you downloaded the plugin from alliedmods, it should have had a list of cvars. Add these cvars to the end of your amxx.cfg file, and configure them to your liking.

Step 5? Editing the modules.
Some plugins require specific modules to be active in order to operate. You can edit the active modules by editing /amxmodx/configs/modules.ini. A ; in front of a line means that the line is a comment. To activate a module, delete the ; in front of the line.


Top
   
PostPosted: 11 Jul 2011 18:12 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Pingboost

Now that I've got my test server set up, I'm going to launch it. I'm going to use the following launch parameters.
Code:
./hlds_run -game czero +port 27015 +maxplayers 10 +map de_dust2_cz +sys_ticrate 1000
I am trying to create a server that pulls close to 1000 fps. So I typed "stats" in the console to figure out how much it was actually pulling.

Image

As you can see, even though I specified sys_ticrate 1000, I am still only getting around 300fps. This is terrible.

The first thing I can do is add pingboosting. Pingboost is a HLDS method of increasing server performance by changing the way it handles information. I really don't understand it, but I do know there are 3 types of pingboosting. pingboost 1 is the least effective but also least resource-intensive; whereas pingboost 3 is the most effective and most resource-intensive.

So I launched my server again.
Code:
./hlds_run -game czero +port 27015 +maxplayers 10 +map de_dust2_cz +sys_ticrate 1000 -pingboost 1
Image
As you can see, I gained almost 200fps just by using pingboost.
Next I tried pingboost 2
Image
Here I got extremely close to 1000. It is unrealistic to expect to get 1000 all the time, and 980 is pretty damn good, so I'm going to stick with that. I don't want to waste that extra CPU just trying to get 10 more fps.

That's a quick fix, but not really practical for somebody whose machine might not be able to handle pingboosting. Next I'll look at some other system tweaks that can help maximize your server.


Top
   
PostPosted: 17 Jul 2011 02:12 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing HLTV

Now that I've got some servers installed, I am also going to install some HLTV servers. HLTV allows you to record demos of matches or let players spectate a server without occupying a slot. So it's a useful thing if you're into competitive gaming.

First, create some sort of directory for it to go in.
Code:
[gamer@localhost ~]$ mkdir ./hltv
mkdir ./hltv/czero
cd ./hltv/czero
Now, install a normal game server for whatever game you want HLTV. For example, I want an HLTV for my czero scrim server, so I'm making another czero server.

Now, I installed that server in ~/hltv/czero. Within this directory, I need to create an hltv config file. I'm going to call this file hltv_scrim.cfg, because this is the config I'll use to connect the hltv to my scrim server.
Code:
// set HLTV proxy name as shown in score board
name "Absurd Minds' HLTV"

// set HLTV name, how it should appear in game server browsers
hostname "Absurd Minds' HLTV"

//HLTV player slots - the number of people who can connect to HLTV
maxclients "20"

// set offline info text clients will see as reject reason if HLTV isn't broadcasting yet
offlinetext "Sorry, game is delayed. Please try again later."

// Delay between actual server play and HLTV broadcast
delay 120.0

// allow 3.5 KByte/sec as client rate. This is good a value
// for internet broadcasts. On LAN you may set this value to 10000
maxrate 3500

// log HLTV console in proxy.log
// logfile 1      

// local chatting for HLTV spectators enabled
chatmode 1

// if the server the HLTV is connecting to has a password, enter it here
serverpassword   "xxx"

// proxy's adim password for rcon, commentator etc.
adminpassword   "xxxx"

// show message for 5 seconds each 60 seconds in center of X axis (-1) and
// above help text bar (0.85). Color given as hexadecimal RGBA .
loopcmd 1 60 localmsg "You're watching HLTV. Visit www.valvesoftware.com" 5 -1 0.85 FFA000FF

// hltv.tga will be shown instead of the default HLTV logo in spectator GUI
// bannerfile "hltv.tga"

// these commands will be executed on connecting spectator client and may be used
// to adjust settings for HLTV (for example voice parameters)
signoncommands "voice_scale 2; voice_overdrive 16; volume 0.5; echo Voice adjusted for HLTV"

echo hltv.cfg loaded.

//Game Server Connection Info - enter the game server ip and port in the following
// format by adding a new line below the example shown. Then start your HLTV server
connect xxx.xxx.xxx.xxx:xxxx
Now I'm going to launch my server with the following command:
Code:
./hltv +exec hltv_scrim.cfg -port 27015
Oh snap! An error!
Code:
Error:libsteam_api_c.so: cannot open shared object file: No such file or directory
WARNING! System::DispatchCOmmand: command "name "Absurd Minds HLTV" " not registered.
WARNING! System::DispatchCOmmand: command "hostname "Absurd Minds HLTV" " not registered.
WARNING! System::DispatchCOmmand: command "maxclients "20" " not registered.
WARNING! System::DispatchCOmmand: command "offlinetext "Sorry, game is delayed. Please try again later." " not registered.
WARNING! System::DispatchCOmmand: command "delay 120.0 " not registered.
WARNING! System::DispatchCOmmand: command "maxrate 3500 " not registered.
WARNING! System::DispatchCOmmand: command "chatmode 1 " not registered.
WARNING! System::DispatchCOmmand: command "serverpassword "" " not registered.
WARNING! System::DispatchCOmmand: command "adminpassword "xxx" " not registered.
WARNING! System::DispatchCOmmand: command "loopcmd 1 60 "You're watching Absurd Minds HLTV. www.absurdminds.net" 5 -1 0.85 FFA000FF " not registered.
WARNING! System::DispatchCOmmand: command "signoncommands "voice_scale 2; voice_overdrive 16; volume 0.5; echo Voice adjusted for HLTV" " not registered.
To fix this, I typed the following: (Note: If you run your server in screen, type this after you open your screen console.)
Code:
export LD_LIBRARY_PATH=".:LD_LIBRARY_PATH"
If you get a continuously scrolling message, for example
Code:
>
No challenge for your address.

>
No challenge for your address.

>
No challenge for your address.
or
Code:
>
Bad challenge.

>
Bad challenge.
add the following to the end of your hltv.cfg file:
Code:
nomaster 1


Top
   
PostPosted: 21 Jul 2011 16:27 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Adding Rules to iptables

As I mentioned in the first post, CentOS default installs a firewall called iptables. This firewall is very powerful and very well built, but it can be difficult to configure it.

Basically, iptables monitors all the traffic into your network adapter. It looks at this traffic, where it came from, where it is trying to go, what type of information it is sending, etc. Once it gathers that information, it consults its list of rules and decides what to do with the packets. For example, it may accept the data, or it might reject it and not allow it through.

In general, it's a good idea to reject everything other than what you specifically want to accept. iptables lists its rules in a list, and it reads the list one at a time. The very last rule generally says "drop everything else". So I need to add a rule in there that tells the firewall to accept the important ports.

The first thing you should do is check out portfoward.com's list of ports. Basically any game you can think should be up there, with a list of ports that need to be forwarded.

Then you should turn on iptables, if it's not already started.
Code:
service iptables start
You can add rules to iptables by typing the rules in the command line. I started out with the following rule, because I am running multiple HLDS servers that I want to run:
Code:
iptables -A INPUT -p tcp --dport 27015:27020 -j ACCEPT
This said that I added a rule to the INPUT chain (the chain that looks at incoming traffic). If the protocol of that data is tcp (-p tcp) and it's destination is any of the ports between 27015-27020 (--dport 27015:27020), to accept that traffic (-j ACCEPT).
I also added these two rules to deal with the UDP traffic of a HLDS:
Code:
iptables -A INPUT -p udp --dport 27015:27020 -j ACCEPT
iptables -A INPUT -p udp --dport 1200 -j ACCEPT
.

Next I saved the rules:
Code:
service iptables save
If I were to stop and restart iptables, it would restart with the rules I just added. If I didn't save them and I restarted iptables, it would flush the added rules and restart with the previous rules.

If I type
Code:
service iptables status
I can see an output of all my rules.
Code:
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
2    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:1200
3    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpts:27000:27039
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpts:27000:27039
 
Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
 
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
 
Chain RH-Firewall-1-INPUT (2 references)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255
3    ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0
5    ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353
6    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631
7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631
8    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
9    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
10   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:23
11   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:25
12   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80
13   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:21
14   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443
15   ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:137
16   ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:138
17   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:139
18   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:445
19   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:2049
20   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
It looked all right to me, but when I started the server, I still couldn't see it. Upon further investigation, I noticed that the firewall was actually taking incoming traffic and sending it to a different chain, RH-Firewall-1-INPUT. So I changed my rules a little bit and saved:
Code:
iptables -A RH-Firewall-1-INPUT -p tcp --dport 27000:27039 -j ACCEPT
iptables -A RH-Firewall-1-INPUT -p udp --dport 27000:27039 -j ACCEPT
iptables -A RH-Firewall-1-INPUT -p udp --dport 1200 -j ACCEPT
service iptables save
But this still didn't work, and here is why. If I add a rule by doing -A, it appends the rule to the end of the chain. However, iptables reads the rules in order. So, by adding my rules to the end, it actually added them to after the rule to reject all other traffic. So iptables was rejecting the packets before it was able to see that I wanted to accept them.

So I deleted my mistake rules
Code:
iptables -D RH-Firewall-1-INPUT -p tcp --dport 27000:27039 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -p udp --dport 27000:27039 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -p udp --dport 1200 -j ACCEPT
service iptables save
Then, instead of using the -A command to add it to the end of the rules list, I need to use the -I command, which will put it at the beginning of the list:
Code:
iptables -I RH-Firewall-1-INPUT -p tcp --dport 27000:27039 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -p udp --dport 27000:27039 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -p udp --dport 1200 -j ACCEPT
service iptables save
Once I put my rules in like this, it worked fine.


Top
   
PostPosted: 06 Oct 2011 20:37 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
EDIT: The below guide on how to install a TF2 server is out of date. Valve requires all of their games to be installed through the SteamCMD program. That means that installing a TF2 server is exactly like installing a CS:GO server, except you'll use the appropriate Dedicated Server ID for the game you're wanting to start.

I also want to install a Source server, in this case, a TF2 server.

First, I create a directory in my user's home directory in which to put the server. Then I cd to that directory.
Code:
mkdir ./source/tf2
cd ./source/tf2
Installing the server is very similar to installing a HLDS.
Code:
wget http://storefront.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
yes

chmod +x steam
./steam -command update -game tf -dir .
Now, when you install it, it will take quite a while. If you are installing it remotely through PuTTY, it would be a good idea to use screen.

(Remember, you can always check out this page for a full list of games you can install using the hldsupdatetool.)

You have no installed a TF2 server.

To launch the server, use a command line very similar to that of the HLDS
Code:
./srcds_run -game tf +ip yourIP +port yourPort +maxplayers 24 +map ctf_2fort
When I first tried this, I got an error:
Code:
error while loading shared libraries: libz.so.1: cannot open
shared object file: No such file or directory
I fixed that by installing a library as root.
Code:
su - root
Password:
yum install zlib.i386
su gamer
Once I did that, the game executed fine.

Now it's time to configure it.


Top
   
PostPosted: 31 Oct 2011 18:23 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing Metamod Source is slightly different from installing Metamod for HLDS servers, but not too much different.

First off, you have to download the most recent linux version of Metamod. To do this, make sure you are in the server's base directory (in this case, tf).
(Note: These URLs may be out of date. Make sure to check the main metamod page for the most recent Metamod release.)
Code:
wget http://www.n00bsalad.net/sourcemodmirror/mmsource-1.9.0-linux.tar.gz
tar xfz mmsource-1.9.0-linux.tar.gz
rm mmsource-1.9.0-linux.tar.gz
You'll see it actually creates the addons/metamod directory, which is different from the HLDS version.

Next, you have to generate a metamod.vdf file. Once you have done that, place it in the addons folder.

You can now launch your server with metamod. To test to make sure Metamod is running, you can type "meta version" in the server's console. If it gives you an output, you are good. If it says "Command not found", you have installed it incorrectly some how.


Top
   
PostPosted: 31 Oct 2011 18:31 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
You have to install Metamod in order for you to be able to install SourceMod. Once you've gotten Metamod installed, you can continue on by intalling SourceMod.

First off, download the SourceMod file into the game's base directory (in this case, tf).
Code:
wget http://y4kstudios.com/sourcemod/mirror/sourcemod-1.4.6-linux.tar.gz
tar xfz sourcemod-1.4.6-linux.tar.gz
rm sourcemod-1.4.6-linux.tar.gz
And that's it! Restart your server. You can test your install by typing "meta list" in the server's console. It should list SourceMod as one of the metamod plugins.


Top
   
PostPosted: 07 Nov 2011 12:07 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8286
Installing plugins is a lot easier in SourceMod than installing plugins in AMX Mod X. All you have to do is place the files in the appropriate place (plugins will always tell you where the files go), and it's done.

For example, I would put the .smx file (the plugin) in the orangebox/addons/sourcemod/plugins directory. Simply placing the plugin in that directory automatically activates it without you having to place the name in a plugins.ini file like with AMXX. If you wish to disable a plugin, simply move the .smx file to the /plugins/disabled directory.

To refresh the plugins after installing, either restart the server or type "sm plugins refresh" in the game console. You can also type "sm plugins list" to make sure your plugin is active.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 19 posts ] 

All times are UTC-04:00


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited