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=serveruserwhile 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-upcase "$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 :)
