Let The Games Begin.
  
Main Menu
Home
Flash Games
Weblinks
Contact Us

Game Modding

Battlefield 1942
· README FIRST
· Ai.con editing pt1
· Ai.con editing pt2
· Ai.con editing pt3

· Pathmapping pt1
· Pathmapping pt2
 
Installing a Linux Debian BF2 server

The biggest pain I have seen setting up a server is the Battlefield 2 Linux server.
It is not difficult, but the howto's on getting everything set up are scattered
all over the place so I decided to write this how to. Part of it will be my own
and other parts will be from other howto's in which I will give full credit for
the parts not written by me. The how to will be based on my server configuration
with web and game server on 2 different machines which is as follows.
Linux Debian
Webmin
MYSQL 4
PHP 4
Apache
BF2Statistics
BF2CC
If you do not have a web server running, you can go to Montana
Freelance Technology
and follow the guide for Debian written by JLKolpin.

1. Setting up BF2Statistics on the web server



A. Download http://bf2statistics.com/e107_files/public/1155866589_1586_FT0_bf2statistics_1.3_rc1.rar
and http://bf2statistics.com/e107_files/public/1156250073_1586_FT2618_bf2statistics_1.3rc1_patch4.rar

B. Extract the first one you downloaded to a folder called bf2statistics
then extract the contents of the patch4 archive to the ASP folder in the bf2statistics
folder.

C. To your web servers main document root dir (/home/usernameyoucreatedonthewebserver/public_html)
upload the ASP directory and the bf2statistics.sql file.

D. In Webmin go to servers>apache>edit config files. Near the
bottom of the config file above where it says "### Section 3: Virtual
Hosts" add
<Directory /home/usernamethatisdocumentroot/public_html/ASP>
AllowOverride All
</Directory>
Click save then in the upper right corner click on apply changes.

E. In Webmin click servers>mysql>create database. Lets name
the database bf2statistics.
If you don't have a database user click user permissions>create new user.
Give the user a name and a password. Move the check over to the textbox for
hosts and type localhost then hold the left mouse button and drag it down
through all the options in the permissions box to give that user all permissions
then click save. After that is done go to servers>mysql>database permissions>create
new database permissions.
Selects bf2statistics from the database list and make sure the check is next
to it. Move the check over for username and type the db username you just
created. Move the hosts check over and type in localhost and left click and
drag like you just did to give the user all permissions in the database and
click save.

F. Click servers>mysql>bf2statics>execute sql. Hit the browse
button (…) next to the local file area and browse for the bf2statistics.sql
and hit execute.

G. In the ASP directory edit the config.php as follows.
$dbname = 'bf2statistics'; // database name
$dbuser = 'dbusernameyoujustcreated'; // database user name
$dbpass = 'dbpasswordyoujustcreated'; // database user password
$authhosts = array( //Add list of Authorised Game Servers here
'127.0.0.1',
'192.168.1.0/24',
'add ip of gameserver box'
$authadmin = array( //Add list of Authorised Admin Clients here
'127.0.0.1',
'192.168.1.0/24',
'add ip of gameserver here'
Save the file.

H. The ASP directory wants to be writ able by the web server so in
Webmin click others>file manager. On the left browse to /home/username/public_html.
In the window on the right highlight the ASP directory and choose info. Change
owner and group to www-data and on the bottom select "this directory
and all its subdirs" then click save.

I. Download and install the leader board script you intend to use
to display your stats on your website.

2. Installing the game server, mono and BF2CC
The following Linux + BF2CC guide is found at http://www.infinity-gamehosting.net/upload/Battlefield_2_and_BF2CC_Linux_installation_guide_v1.4.pdf
and was written by Robert Jonker
I added a couple things for Debian to the guide

BF2CC Daemon Linux Installation Guide

Table of contents
1. Introduction
2. Opening ports in your firewall
3. Creating a new user account
4. Downloading and installing the server binaries for Linux
5. Downloading and installing BF2CC
5.1 Extracting the admin scripts
5.2 Downloading and installing the Mono files
5.3 Starting the BF2CC Daemon
6. Troubleshooting

1. Introduction
This guide covers the installation of a Battlefield 2
server and Battlefield 2 Command and Control Daemon (BF2CCD) on Linux. BF2CC
is a set of remote admin tools for Battlefield 2. It is designed for game server
Administrators who want to simplify the process of managing their Battlefield
2 server(s). BF2CC consists of two parts:

1. BF2CC Daemon - A daemon that runs alongside the BF2 server and maintains
a permanent connection to the Battlefield 2 server.

2. BF2CC Client - A GUI client that connects to the daemon. The
BF2CC client has the following features:
?Easy to use, intuitive and customizable
GUI ?Manage Players through warns, kicks and bans. ?Manage Server Settings
?Manage Maps and Map Lists ?Manage Ban List ?Manage VOIP settings ?View in
game chat ?Many more Advanced Features... The BF2CC Daemon features:
?Allows easy setup and management of the BF2 dedicated server application
for both Windows and Linux (via the Mono Project) ?Setup User Accounts with
role based security ?Log actions of all users/admins ?Store and track extra
information such as extended Ban list information, warns and kicks. ?Perform
automatic administration tasks Current versions as of October 5, 2006 Battlefield
2 server: 1.1.2963-795 BF2CC Daemon: 1.4.2446 BF2CC Client: 1.4.2452
If
you have any questions or comments on this guide please send an e-mail
to the author of this guide
: Robert Jonker


2. Opening ports in your firewall
Before you start installing your Battlefield 2 server, it's strongly recommended
to open
the correct ports in your firewall. This may save you some time when things
don't seem
to work afterwards. The Battlefield 2 server and the BF2CC daemon use the
following
ports by default:
SERVICE PORT(S) PROTOCOL
Battlefield 2 server 16567 UDP
GameSpy 29900 UDP
Voice over IP 55123-55125 UDP
BF2CC rcon 4711 TCP
BF2CC daemon 4712 TCP
Note: if your server is behind a (NAT) router you need to forward the ports
on
your router to the machine your Battlefield 2 server is running on. Refer
to
your manufacturer's documentation to find out how to do so.
In order to open these ports you need to refer to your distro's firewall instructions.
Most
Linux distributions use IPTables. You can see if IPTables is enabled on your
machine by
typing (as root):
[root@infinity-shell root]# iptables -V
iptables v1.2.9
Note: If you get an error message (or a command can not be found or
something similar), IPTables is probably not configured on your machine. Most
probably you will need to recompile your kernel with firewall (IPTables)
support if you want to use a firewall on your system. Refer to your distro's
documentation if you want to enable firewall support. If you dont have a
firewall available at this moment, it means that all your ports are open.
This
may be a security issue, but you can still proceed with the installation of
the
Battlefield 2 server. You can skip the rest of this chapter and continue with
'Creating a new user account'.
This is a very basic firewall script for IPTables to work with a Battlefield
2 server:
#! /bin/bash
$MyIP = "192.168.2.100"
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 16567 -m state --state NEW
-j
ACCEPT
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 29900 -m state --state NEW
-j
ACCEPT
/sbin/iptables -A INPUT -p tcp -d $MyIP --dport 4711 -m state --state NEW
-j
ACCEPT
/sbin/iptables -A INPUT -p tcp -d $MyIP --dport 4712 -m state --state NEW
-j
ACCEPT
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 55123-55125 -m state --state
NEW -
j ACCEPT

You can add these lines to your current firewall boot script or create a new
file that gets
executed once your system boots. To check if your firewall rules are loaded
type (as
root):
[root@infinity-shell root]# iptables -L
This will output the currently loaded firewall rules. If the rules for Battlefield
2 are there,
you can proceed to the next chapter.


3. Creating a new user account
Once we are sure that the correct ports are opened in the firewall, we can
continue by
creating a new user account. Most often, you don't want a service to run as
root. Since
the Battlefield 2 server and the BF2CC daemon don't need root privileges to
run, we
create a normal user account. We will use the newly created user account to
do (most of)
the steps in this manual.
[root@infinity-shell root]# useradd bf2server
[root@infinity-shell root]# passwd bf2server
Changing password for user bf2server.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Note: Don't forget to password the account once it is created!
Now that we have a normal user account, we will use this in the next chapters.
Logout of
your server and re-login with the account you just created.

4. Downloading and installing the server binaries for Linux
First, make sure you are logged in as the user you created in the previous
chapter.
The Linux server binaries are available from many different locations and
mirrors. You
should find a mirror close to you to download them. You can download the server
installer from EA:
http://largedownloads.ea.com/pub/patches/
Make sure that you download the latest version (see the introduction of this
document to
see what version that is). Download the files to your system. If the server
files are zipped
you need to unzip them first. Also, make sure that the unzipped file is executable:
[bf2server@infinity-shell bf2server]$ cd ~
[bf2server@infinity-shell bf2server]$ wget
http://largedownloads.ea.com/pub/patches/BF2/1.4/bf2-linuxded-1.1.2963-795-
installer.sh.gz
[bf2server@infinity-shell bf2server]$ gunzip bf2-linuxded-1.1.2963-795-
installer.sh.gz
[bf2server@infinity-shell bf2server]$ chmod +x bf2-linuxded-1.1.2963-795-
installer.sh.gz
[bf2server@infinity-shell bf2server]$ ./bf2-linuxded-1.1.2963-795-installer.sh.gz
Now, you will be shown the EULA for the BF2 dedicated Linux server and Punk
Buster.
Accept them both by typing 'accept' and 'yes' respectively. When the install
script asks
you to enter a target installation directory, type the home directory of the
user you just
created (/home/bf2server).
After just a couple of seconds, you will see a message 'Installation complete'.
Your
Battlefield 2 server is now installed in /home/bf2server/bf2.


5. Downloading and installing BF2CC
This chapter covers the installation of the BF2CC Daemon. This chapter assumes
that you
have a virgin Battlefield 2 server installation. If you have not, please read
the previous
chapters to find out how to get a virgin installation.
First, make sure that you are in the root directory of your Battlefield 2
server installation.
If you used the variables in this manual that will be /home/bf2server/bf2.
Download the latest version of the BF2CC Daemon for Linux. See the introduction
of this
guide to find out what the latest version is. Unzip the downloaded archive.
[bf2server@infinity-shell bf2]$ wget
http://www.bf2cc.com/downloads/BF2CCD_1.4.2446.zip
[bf2server@infinity-shell bf2]$ unzip BF2CCD_1.4.2446.zip -d /home/bf2server/bf2

5.1 Extracting the admin scripts
When you have unzipped the whole thing, you can extract the admin scripts
to the
/admin folder. If it asks your permission to overwrite files, say 'yes'.
[bf2server@infinity-shell bf2]$ cd /home/bf2server/bf2
[bf2server@infinity-shell bf2]$ unzip modmanager-v1.4.zip
5.2 Downloading and installing the Mono files
Now, to make the BF2CC Daemon able to run, we need to install the Mono files.
Make
sure you are in the root directory of your Battlefield 2 server. If you
used the variables in
this manual that will be /home/bf2server/bf2.
To download the files, visit http://www.mono-project.com/Downloads.
You will need to
download the files for your distribution.
For the mono that works with Debian type "wget http://go-mono.com/sources/mono-1.1/mono-1.1.12.1.tar.gz".

When its done downloading type "tar xvfz mono-1.1.12.1.tar.gz"
then "cd mono-1.1.12.1" then "./configure --prefix=/home/bf2server"
then "make" then "make install".
If you are running Red Hat, Fedora Core or SuSe,
you can install the Mono files using these commands:
[bf2server@infinity-shell bf2]$ wget http://www.gomono.
com/archive/1.1.12.1/linux-installer/0/mono-1.1.12.1_0-installer.bin
[bf2server@infinity-shell bf2]$ chmod +x mono-1.1.12.1_0-installer.bin
[bf2server@infinity-shell bf2]$ ./mono-1.1.12.1_0-installer.bin
Just accept the license agreement. Mono will install itself on your server.
For other distributions the above might work but I haven't had a chance
to test it. If it
doesn't work, just visit the Mono website and get the correct files for
your distribution
and install them.
Note: Be sure to use Mono version 1.1.12. Version 1.1.13 or higher will
NOT
work!

To check your Mono installation use the following command:
[bf2server@infinity-shell bf2]$ mono -V
If it outputs a version number, everything should be all right.
5.3 Starting the BF2CC Daemon
Now that we have installed everything, we are ready to start the BF2CC Daemon.
Make
sure that you are in the root directory of your Battlefield 2 server installation.
If you used
the variables in this manual that will be /home/bf2server/bf2.
You can now start the server:
[bf2server@infinity-shell bf2]$ mono bf2ccd.exe
When this command is executed for the first time, the Daemon will ask
you some
questions.
Root Game Folder:

The root directory of your Battlefield 2 server installation. If you used
the variables
from this guide that will be /home/bf2server/bf2,
Game executable:
The file to be executed to start the server. Leave this to default (start.sh)
Game executable arguments:
Arguments to the start.sh executable. Probably you can leave this blank.
Daemon listen IP:
IP number you want the Daemon to listen for incoming BF2CC client connections
on.
Daemon listen port:
Port number you want the Daemon to listen for incoming client connections
from the
BF2CC client on. Default port is 4712
Admin Password:
The admin password for the Daemon.
Your BF2CC Daemon is now started. You can now use your BF2CC Client to connect
to
your server and manage it.
If everything works you probably want to run the Daemon in the background.
Use this
command to do so:
[bf2server@infinity-shell bf2]$ mono bf2ccd.exe >/dev/null 2>&1
&
Congratulations, you now have a working Battlefield 2 server with BF2CC
installed.

6. Troubleshooting
If you have, after reading this guide, questions or comments on this software
please visit
the BF2CC forums:


7. Installing screen. (Optional)
The above command to start Bf2CCD always gave me fits for some reason so I
added this section showing what I do in case others have the same problem.
Type "apt-get install screen" then "apt-get build-dep screen".
To fire up the server with screen log into a shell as a user that is not root.
Type "cd /home/bf2server/bf2". Type "screen" and some
text will come up and say hit returns at the bottom, just hit enter and the
shell will have a cursor at the top. In that screen window type "mono
bf2ccd.exe -showlog". Now you should be able to log in with the client.
To detach from that screen hit cntrl+a cntrl+d. you should now be detached
from the screen and able to log out of the shell without the server shutting
down. To get back into the screen session type "screen -r". Once
back in the screen session if you wish to kill the server hit cntrl+z then
type "ps ax | grep bf2ccd". A list will come up starting with numbers.
That number is the process id so you type, "kill -9 procedssidnumber"
then type "exit" which will close screen. The clear the screen cache
type "screen -wipe".

3. Installing Bf2Statistics server side

Upload the python directory to your BF2 directory on the game server.
Edit /home/games/bf2/python/bf2
Change http_backend_addr = 'ip or domain name of your web server'
Update line 139 of miniclient.py to read: self.sock.sendall(line + CRLF)

You should now be able to fire up your server with private ranks and stats.

For BF2CC related questions visit the forums at
http://bf2cc.com/.

For BF2Statistics related questions, visit
http://bf2statistics.com/




Live Free and Ride With The Angels My Friend.

 All material Copyright 2004 NetSimZ.com

Except for user input, that is copyright the respective submitter.
 

Brought to you by New York Freelance Technology and Montana Freelance Technology