Topic: Dedicated Server Step-by-step Howto Linux

With this little howto I'm trying to give new Linux administrators a better chance to successfully run a FirstStrike Dedicated Server.
I assume that you don't have a BF2142 Server installed yet.
I also assume that you don't have physical access to the machine and therefore use PuTTY or a similar  program to access the terminal.

So here we go:


0) SSH into your machine with your root account. If you don't have root access use the next best account and do all the stuff below in your home directory instead of the root file system.

1) Create a new directory in /opt called gameserver and change directory into it using this command:
mkdir /opt/gameserver && cd /opt/gameserver

2) Get the BF2142 dedicated server package from EA using this command:
wget http://largedownloads.ea.com/pub/patche … ler.sh.zip
This will download the required BF2142 dedicated server version 1.25 and will take long, grab a coffee, beer or other liquid in your vicinity.

3) Once the download has finished, type:
unzip bf2142-linuxded-1.08.21.0-installer.sh.zip
to unzip the file.

4) Type
sh bf2142-linuxded-1.08.21.0-installer.sh
wait for it to verify and press return, scroll down the license agreement, type accept, return, scroll-down, type yes, return.
Once it prompts you for the installation directory, type /opt/gameserver

5) Get the FirstStrike R1 dedicated server package:
wget http://88.198.54.112/pub/fs_pub/firstst … server.zip

6) Unzip the FS dedicated server to /opt/gameserver/bf2142/mods
unzip firststrike_r1_dedicatedserver.zip -d /opt/gameserver/bf2142/mods

7) Using your favorite editor, edit the serversettings.con:
mcedit bf2142/mods/firststrike/settings/serversettings.con
Note: You can also use joe, emacs, vi(m) or nano instead of mcedit. Any editor you feel comfortable with.

8) Edit serversettings.con to match your needs.
It's very important that you change sv.internet to 1, sv.serverIP to your server's IP and sv.interfaceIP to your server's IP as well or it will not be visible online.

9) Save serversettings.con and close the editor.

10) Try out the server! :D
cd into bf2142 and type
./start.sh +modPath mods/firststrike +maplist mods/firststrike/settings/maplist.con +gameMode gpm_cq +maxPlayers 32

If everything runs fine you can do some advanced stuff, for example make up a script that automatically restarts the server on crash and put the server into a screen so that it doesn't get closed if you close the PuTTY session and run the server on boot.


Also, I recommend that you do not run the server as root, instead create a user for running the gameserver like so:
useradd --home /opt/gameserver serveruser
You have to change the ownership of all the extracted server files afterwards so that they belong to the new user:
chown -R serveruser:serveruser /opt/gameserver


For autorestarting the server on crash create a new file in /opt/gameserver using
mcedit /opt/gameserver/bf2142_fs.sh
Note: Again, you can use any editor you like.

And copy this script:

#!/bin/bash
# Change the variable below to your bf2142 directory
GAMEPATH=/opt/gameserver/bf2142
USER=serveruser

while true
do
cd $GAMEPATH
sudo -u $USER ./start.sh +modPath mods/firststrike +maplist mods/firststrike/settings/maplist.con +gameMode gpm_cq +maxPlayers 32
echo "Server crashed on " >> $GAMEPATH/mods/firststrike/logs/crash.log
echo `date +%d.%m.%Y_%H:%M` >> $GAMEPATH/mods/firststrike/logs/crash.log
done

For making the server start on each boot up you can add a short script in /etc/init.d
called _gameserver.sh which puts your server in an accessible screen session on each boot.
You can then view your server session using screen -r bf2142_fs but you have to install the screen utility first.
Anyway, let's add the start-up script.
mcedit /etc/init.d/_gameserver.sh
with these contents:

#!/bin/sh
# Start gameservers on boot-up

case "$1" in
'start')
    screen -dmS bf2142_fs /opt/gameserver/bf2142_fs.sh
    ;;
'stop')
    ;;
*)
    echo "Usage: $0 { start | stop }"
    ;;
esac
exit 0

Note: This is for Debian-based Distros only! I don't know where other distros have their start-up scripts.


Hope this makes it a bit easier for you.

If you find any mistakes or have a question please just ask here :)

http://weeklygeekshow.com/images/seriousheads.gif

Re: Dedicated Server Step-by-step Howto Linux

How do you make the server switch players to the opposite side after a round? It seems to be a default setting in general, but for some reason our Linux run server has you remain on the same side when you play a second round on the same map. Both the server admin and myself have done quite a bit of research on this and come up with nothing. Any ideas?

http://img.photobucket.com/albums/v600/TALON_TAW/TALONSIGNEWB-1.jpg
http://stats.fsmod.com/fssig.php?player=Talon-UK
http://stats.fsmod.com/sig/pilot.Talon-UK.png

Re: Dedicated Server Step-by-step Howto Linux

Can you copy and paste the “serversettings.con” from your server?

"Something something something Dark Side.. Something something something Complete!"
http://img399.imageshack.us/img399/1046/athlonsig04fc5.jpg

4 (edited by FSDev| TALON 2008-03-25 14:52:23)

Re: Dedicated Server Step-by-step Howto Linux

Aye, I can get it. It seems there is no script to control the team swap after a round. It does this automatically on Windows OS run Dedicated Servers, and from within the game as if it is a default setting, but with Linux there is no line of code for it and by default it just leaves everyone on the same side when it rolls over to a second round on the same map. A tad annoying eh?

Had a look through the serversettings.con file from the standard remote server control panel and couldn't find a script to control it there either.

http://img.photobucket.com/albums/v600/TALON_TAW/TALONSIGNEWB-1.jpg
http://stats.fsmod.com/fssig.php?player=Talon-UK
http://stats.fsmod.com/sig/pilot.Talon-UK.png

Re: Dedicated Server Step-by-step Howto Linux

This is controlled by a custom python script.  Most windows servers do it because it is included with 2142cc, however it is not a default feature of 2142.  If you look around I'm sure there is a python script that is not modmanager dependent that you can use on your linux server.

http://www.dsgaming.net/imperial/fssig.jpg
http://miniprofile.xfire.com/bg/co/type/2/dsimperial.png
http://stats.fsmod.com/sig/trooper.Imperial.png

Re: Dedicated Server Step-by-step Howto Linux

Cheers, Imperial, that is helpful, we are looking into BF2142cc now actually, so maybe we'll find something useful there like you say.

http://img.photobucket.com/albums/v600/TALON_TAW/TALONSIGNEWB-1.jpg
http://stats.fsmod.com/fssig.php?player=Talon-UK
http://stats.fsmod.com/sig/pilot.Talon-UK.png

Re: Dedicated Server Step-by-step Howto Linux

Could do with a post 1.4 update for this as FS 1.4 is problematic at best for Linux based servers.

http://img.photobucket.com/albums/v600/TALON_TAW/TALONSIGNEWB-1.jpg
http://stats.fsmod.com/fssig.php?player=Talon-UK
http://stats.fsmod.com/sig/pilot.Talon-UK.png