potential threats

you are here :[ -->networks-->quake3 linux server howto]

base || coding || networks || linux || contact




Quake III Arena linux dedicated server HOWTO



this document explains how to install and configure a Quake III Arena (q3a) dedicated server on a linux box. it is assumed that you :

* have root shell access to a linux box (remote or local)
* know some linux basics (installing software, ssh, scp, ...)
* know some quake basics (q3config, mod, basic console commands, ...)
* want to install a quake (vq3/osp/cpma whetever) server ;-)
* you have 'screen' installed on your server (simply install it if you don't have it)





Contents

Preamble
* Disclaimer, License and Copyright
* Conventions used in this document
* A note to win32 users
* Contacting the author of this document

Part I - Server Installation
* Step 1 : Create a new user that the Quake Server will be running under
* Step 2 : Copy stuff we need to the Server
* Step 3 : Install Quake 3 and the mods

Part II - Server Configuration
* Step 4 : Create the server config file
* Step 5 : Create the server maprotation file
* Step 6 : Create a shellscript to start the server
* Step 7 : Copy the Files created in steps 4, 5 and 6 to the correct locations

Part III - Server Maintenance
* Step 8 : Start your Quake Server
* Step 9 : Quake Server remote Administration
* Step 10 : Stopping your Quake Server

Part IV - Appendix
* Appendix A : Where to go from here
* Appendix B : Setting up a defrag Server
* Appendix C : Quake 3 Servers behind firewalls and NAT / home routers
* Appendix D : Links and Sources





Disclaimer, License and Copyright

Copyright spirit 2007

I will not accept any responsibility for any incorrect information within this document, nor for any damage it might cause when applied.

You may redistribute and/or modify this document as long as you comply with the terms of the GNU Free Documentation Licence.





Conventions used in this document

Normal text looks like this, commands you have to type look like the next line:

user@localbox> $ ssh user@myserver.tld
root@myserver> # chmod a+x linuxq3apoint-1.32b-3.x86.run

Note that the shell prompt in front of the actual command indicates the user and the machine you have to run the command at:

root@myserver> #

obviously means that you need to run this command as root at your server.





A note to win32 users

This document assumes you're running linux on both the server and the box you use to connect to the server (via ssh) to configure it.

If you're running win32, you'll obviously need to get a ssh / scp client like putty for that OS first.

If this sounds strange to you get some info on linux and ssh before you try to use this howto.





Contacting the author of this document



Please do not ask me to install a quake server for you, I won't. I obviously don't need any reasons for that but here's a few anyways:

* This howto explains how to do it. If you don't understand it you need to learn more on linux or write me an email explaining exactly which part of this document you don't understand so I can improve it.

* If you don't setup the server yourself you won't by able to maintain it: it will be down after the next reboot, it will become insecure because you don't know how to update it.

* You shouldn't offer others root access to your server (that would obviously be necessary to have someone else configure it for you)

* If you don't know a thing about linux rent a game-server from some company, don't rent a root server.

* I don't have time to setup your server.

* I don't want to setup your server.



Also refrain from asking me how to use ssh, scp, rcon, iptables and vim in general (see notes above).

Apart from that, feel free to contact me with comments, error reports and suggestions on how to improve this document.





Step 1 : Create a new user that the Quake Server will be running under

there is no need to run a quake 3 server as root, and doing so is a very bad idea. running it under your standard user account isn't a good idea either. so we will add a new user called 'quake3' that the server will use.

1) connect to the server, become root

user@localbox> $ ssh user@myserver.tld

2) become root, create the user

user@myserver> $ su
root@myserver> # useradd -g users -d /home/quake3 -s /bin/bash -m quake3





Step 2 : Copy stuff we need to the Server

this can be done via scp, ftp or whatever, ftp should be faster than ssh. you may also use wget to get the stuff.

1) copy the newest quake3 pointrelease for linux to your server (note that you need the 1.32b pointrelease AND the 1.32c security fix!)

user@localbox> $ scp linuxq3apoint-1.32b-3.x86.run user@myserver:/home/user/
user@localbox> $ scp quake3-1.32c-linux.zip user@myserver:/home/user/

You may also get them via wget (from the id ftp or some mirror) at your server:

user@server> $ wget ftp://ftp.idsoftware.com/idstuff/quake3/linux/linuxq3apoint-1.32b-3.x86.run
user@server> $ wget ftp://some.mirror/quake3/linux/quake3-1.32c-linux.zip



2) copy the pak0.pk3 file from your q3a CD (or from your harddisk) to your server

user@localbox> $ scp pak0.pk3 user@myserver:/home/user/

3) copy any mod you want to install to your server

user@localbox> $ scp osp-Quake3-1.03a_full.zip user@myserver:/home/user/





Step 3 : Install Quake 3 and the mods

you can place the stuff into virtually any directory, but a good place is to install Quake 3 into /usr/local/games/quake3/ and the instructions in this HOWTO and the config- and startscripts provided later will expect quake 3 to be installed there. installation is pretty obvious :

1) run the pointrelease binary as root, install to /usr/local/games/quake3/

root@myserver> # chmod a+x linuxq3apoint-1.32b-3.x86.run
root@myserver> # ./linuxq3apoint-1.32b-3.x86.run



... and apply the 1.32c security fix by unpacking the zipfile and copying the binaries to the quake 3 directory the installation just created (should be /usr/local/games/quake3/).



2) copy the pak0.pk3 file to your q3a directory

root@myserver> # cp pak0.pk3 /usr/local/games/quake3/baseq3/

3) as your quake-server user, create the quake directory that will hold the mod files and your server config files and map rotation files :

quake3@myserver> $ cd
quake3@myserver> $ mkdir -p .q3a/baseq3/

4) install the mods in the .q3a/ directory you just created (not into .q3a/baseq3/)

quake3@myserver> $ mv osp-Quake3-1.03a_full.zip ~/.q3a/
quake3@myserver> $ cd ~/.q3a/
quake3@myserver> $ unzip osp-Quake3-1.03a_full.zip





Step 4 : Create the server config file

create a quake 3 config file that your server will use.

an example config file for a Quake 3 Server that runs the OSP mod and uses a Maprotate file called "maprotation-osp.cfg" is given below :

// ********************** START OF Q3A SERVER FILE **********************
// FILENAME : q3ded-osp.cfg


// q3a server config
// vq3 ffa
// make sure the map rotation file 'maprotate-osp-ffa.cfg' exists
// written by spirit, based on the config from holarse.net


// --- contact and admin ---
sets ".Admin"  "change_me"			// admin name
sets ".email" "change_me"			// admin email
sets ".www"   "change_me"		        // www site that offers maps rotated on the server etc


// --- basic stuff ---
seta rconPassword "change_me"           	// remote console admin password
seta g_gametype "0"				// gametype (0 = ffa, 1 = tourney,  2 = ffa, 3 = tdm, 4 = ctf)


// --- banner stuff ---
seta sv_hostname "change_me"		        // how the server shows up in q3a game browser
seta g_motd "change_me"		                // message of the day, shown on client connect


// --- misc ---
seta r_smp "0"					// whether the server has multiple CPUs
seta sv_pure "1"				// whether .pk3-files are cheat checked


// --- clients and slots ---
g_password "change_me"		        	// server password for clients who try to connect
g_needpass "0"					// whether the password is enabled / needed to connect
seta sv_maxClients "8"				// max players allowed on server, includes spectators
seta sv_privateClients "2"			// reserved slots for players who know the private password
seta sv_privatePassword "change_me" 		// private slot password
seta g_syncronousClients "0"			// whether clients are allowed to record demos
seta g_allowvote "0"				// map - map restart - kick - g_gametype


// --- annoyances ---
// Note that you need to turn punkbuster off on the command line when you start the server (q3ded +set sv_punkbuster 0 ...)
// because you can't change the setting anymore once the server process has started! Removing the next line (or putting 'sv_punkbuster 0'
// into your config file will NOT turn off punkbuster.
pb_sv_enable					// enable punkbuster server
pb_sv_guidrelax 7				// disable punkbuster CD-check
seta sv_strictauth "0"				// whether CD-key is checked on client


// --- network ---
seta sv_allowdownload "0"			// whether clients are allowed to d/l maps etc from server
seta sv_maxRate "10000" 			// download speed limit
seta sv_floodProtect "1" 			// whether server uses flood-protection
seta sv_master1 "master0.gamespy.com:28900"     // master servers where the server registers itself
seta sv_master2 "master.gamershut.de:27950" 	//   to be found by players.
seta sv_master3 "master.gnw.de:27950"		//   use +set dedicated x to tell the server whether or not
seta sv_master4 "master3.idsoftware.com:27950"  //   to register itself there, x = 2 : register x = 1 : don't


// --- weapons ---
seta g_quadfactor "3"				// quad damage multiplier, default = 3
seta g_weaponrespawn "5" 			// weapon respawn time in secs, default = 5
seta g_friendlyfire "0"				// whether you can do damage to your team members
seta g_teamAutoJoin "0"				// whether players are automatically added to a team
seta g_teamForceBalance "0"			// whether teams are auto-balanced by the server
seta g_forcerespawn "2"				// time after which players are forced to respawn, 0 = never


// --- movement ---
seta pmove_fixed "1"				// whether movement is independent of client framerate
seta pmove_msec "16" 				// dont ask me
seta sv_fps "30"				// server frame rate


// --- bots ---
seta bot_enable "1"				// whether bots are allowed on the server
seta bot_minplayers "0" 			// minimum players number, filled up with bots if fewer
seta bot_nochat "1"				// whether bots are allowed to chat


// --- map rotation ---
exec maprotation-osp.cfg


// ********************** END OF Q3A SERVER FILE **********************




Step 5 : Create the server maprotation file

create a quake 3 server maprotation file that your server will use.

an example maprotation file that rotates some maps from the OSP mod is given below :

// ********************** START OF Q3A MAPROTATION FILE **********************
// FILENAME : maprotation-osp.cfg


// map-rotation for q3a osp free for all (ffa)
// gametypes : 0 = ffa, 1 = tourney,  2 = ffa, 3 = tdm, 4 = ctf

set m1 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm12 ; set nextmap vstr m2"
set m2 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm8 ; set nextmap vstr m3"
set m3 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm9 ; set nextmap vstr m4"
set m4 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm6 ; set nextmap vstr m5"
set m5 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm5 ; set nextmap vstr m6"
set m6 "fraglimit 50; timelimit 0 ; g_gametype 0 ; map ospdm4 ; set nextmap vstr m1"
vstr m1


// ********************** END OF Q3A MAPROTATION FILE **********************




Step 6 : Create a shellscript to start the server

we'll use the unix program 'screen' in this script, so again make sure you have installed it.

an example startup script that runs the osp mod is given below. simply omit the '+set fs_game osp' if you want a vanilla q3a server (no mods) and set your servers IP, port and any name you want to identify the server.

some notes on adapting the script to your needs:

* choose a port > 1024. ports in the range 27960 - 27963 are recommended because servers using these ports are listed in the quake in-game server browser.

* using '+set dedicated 2' instead of '+set dedicated 1' will register your server with the masterservers you configured in the server config file. this will quickly fill the server with players.

* you can easily start multiple q3a servers (one running osp, one running rocket arena,...) if you set a different port for each of the servers.

// ********************** START OF SHELLSCRIPT TO START THE SERVER **********************
// FILENAME : start-osp-server.sh


#!/bin/sh
ip="ip_of_your_server"
port="port_of_your_server"
name="q3a-osp"

echo running server $name on $ip : $port

screen -A -m -d -S $name /usr/local/games/quake3/q3ded +set sv_punkbuster 1 +set fs_basepath /usr/local/games/quake3/ +set fs_game osp +set dedicated 1 +set com_hunkMegs 32 +set net_ip $ip +set net_port $port +set g_log $name.log +exec q3ded-osp-ffa.cfg


// ********************** END OF SHELLSCRIPT TO START THE SERVER **********************

so what does that script do? it uses screen (a unix screen manager, see 'man screen') to run the quake server in a detached screen session named "q3a-osp". this is needed to keep the quake server running when you disconnect from the remote host.

because q3ded is not a daemon process, it is attached to your terminal session and your q3a server would go down if you didn't use screen and quit the shell (type 'exit' or 'logout' in ssh/bash). this isn't what we want, so we use screen.

the name of the screen session can be used to bring the server back to your terminal by logging in via ssh or whatever and restoring the detached screen session of the server by typing

quake3@myserver> $ screen -r sessionname

to see the list of screen session for the current user, type

quake3@myserver> $ screen -list





Step 7 : Copy the Files created in steps 4, 5 and 6 to the correct locations

if you're using the scripts shown above, you should place them in the following locations :

* q3a server configuration file (q3ded-osp.cfg) :

/home/quake3/.q3a/baseq3/

* q3a server maprotation file (maprotation-osp.cfg) :

/home/quake3/.q3a/baseq3/

* q3a server startup shell script (start-osp-server.sh) :

/home/quake3/





Step 8 : Start your Quake Server

yeah, let's rock :

quake3@myserver> $ cd
quake3@myserver> $ ./start-osp-server.sh

that's it, it runs!





Step 9 : Quake Server remote Administration

q3a servers are usually administrated remotely via rcon. the rcon command of the quake 3 console lets you execute quake commands on a remote q3a server, no matter whether you are connected to it or not.

usage of rcon is protected by an rcon password that you set in the server config file.

1) start the rcon connection to your quake server

this can be done in two ways : most of the time you will simply connect to the server via quake 3 as a player - done.

if this is not possible (maybe the server is full and there are no private slots), you start quake3 on your local box and type the following command in the quake console :

/set rconaddress server_ip:server_port

2) authenticate via your rcon password

start a quake console and type :

/set rconpassword rconpassword

you can also put the password in your q3config.cfg on the client, of course.

3) execute quake commands on the server :-)

start a quake console and type '/rcon' followed by any quake server command. examples :

/rcon addbot Doom 5
/rcon players
/rcon kick camper
/rcon map pro-q3dm6
/rcon map_restart 1





Step 10 : Stopping your Quake Server

there are few reasons why you would ever want to stop your q3a server, and there's nothing special to it. just get the pid of the correct screen process via something like

quake3@myserver> $ ps aux | grep screen | grep servername

and kill the process :

quake3@myserver> $ kill pid

servername should be the name you specified in the startup script (i.e. "osp").





Appendix A : Where to go from here

You may want to :

* generate nice stats and show them on a website using vsp or a similar tool

* install additional mods and run multiple quake servers. this is made very easy by the scripts provided as you may already have noticed, see step 6 for more info

* setup a voice communication system like teamspeak for your clan members to use

* setup cron to purge your quake console logs on a regular basis





Appendix B : Setting up a Defrag Server

To set up a defrag server where you can interact with other players to perform team trickjumps, you need to add some defrag specific settings to your config. I put these lines in my defrag server config file :


// make sure punkbuster is turned off - it's completely useless in defrag
// Turning off punkbuster on your Quake 3 Server:
// Note that you need to turn punkbuster off on the command line when you start the server (q3ded +set sv_punkbuster 0 ...),
// because you can't change the setting anymore once the server process has started!
//set sv_punkbuster "0"

// set gamemode to multiplayer
seta df_gametype "6"

// allow more than 1 connection
seta sv_maxClients "6"

// allow players to interact (i.e. hit each others with weapons, jump on ach other etc)
seta df_mp_interferenceOff "0"

// movement should not depend on frames per second on the client
seta pmove_fixed "1"

// set server fps
seta sv_fps "125"

// set movement to vq3 (set to "1" for CPM physics)
seta df_promode "0"

// get rid off items, we have all weapons anyway
seta df_ndm_itemsSpawn "0"





Appendix C : Quake 3 Servers behind firewalls and NAT / home routers

People who want to connect to your server to play require access to the Quake 3 Server port range on your machine. If you setup a server from within quake 3 using the in-game menu, the port 27960 will be used. If you setup your server as described in this document and/or have multiple servers running, you had to choose a port for every quake server you are running. If you are running 3 servers, you may have picked ports 27960, 27961 and 27962. All ports are UDP, not TCP.

If you are running a quake server on a linux server that is using the IPTABLES firewall, you should add a rule to allow the quake ports (see above) in. You may want to do this using your webinterface or by adding a line like the following to your ruleset :

iptables -A INPUT -p udp -m udp --dport 27960:27962 -j ACCEPT

You should be done with that. The next part describes how to prepare your personal firewall and home router to run a quake server at home that allows public connections from the internet.

The configuration of your personal firewall should be quite easy, check the manual if you don't know how to allow connections on a specific port. Most firewalls will allow you to select allowed services (like 'HTTP / webserver, port 80-tcp') from a list, but as Quake 3 will usually not be listed there, you'll have to select something like 'costum service' and set the protocol ('UDP') and port (i.e. '27960', see above) or port range (i.e. '27960:27962') manually.

Configuring your home or DSL router isn't very hard either, but it is necessary if you are using one because network packets from quake clients will hit the public IP of your router and thus it needs to know where to send those packets. (Recall that there may be more than one machine in your network and that this is an incoming connection, not an outgoing one where the router knows who asked for the packets.)

Login to the router - this is usually done via http by entering something like 'http://192.168.0.1' in the address bar of your favourite browser and supplying a username and password - and search for a configuration option named 'Port Forwarding' or similar that can usually be found in the NAT (Network Address Translation) settings. Enter your quake 3 server ports (see above) and forward them to the private IP address of your quake server on the local network (something like '192.168.0.x', x > 1 in many cases). Note that your server should be configured to use a static IP in the Operating System.





Appendix D : Links and Sources

Parts of the information given in this tutorial is based on other Sites and Tutorials, here's a few of them:

* Gameadmins.com: Advanced Quake 3 Server Setup

* Holarse-Linuxgaming.de: Quake III Dedicated Server (german)

* zerowing.idsoftware.com: linux stuff by id software

* ftp.idsoftware.com: various usefull software by id











base || coding || networks || linux || contact