Check out our New Forums!
Donated: $1
Posts: 5 - KR:
Weping
Seen: 4 months ago
http://i.imgur.com/G9m9y2o.png

http://i.imgur.com/F24938l.pngIntroduction
This guide will cover installing, and configuring a dedicated Battlefield 2 server on GNU/Linux. You can do this in localhost or, as in my case, using a VPS; the only restriction is on the OS, which must be based on Unix. You don’t need excellent technical knowledge, but for a complex configuration of the server, I suggest you to pay attention and learn some Unix base before proceeding.

http://i.imgur.com/YubTsH4.pngServer requirements
According to EA, these are the minimum requirements for a Linux dedicated server:
Quote:
CPU: 1 Ghz
RAM: 256 Mb

Recommended Specification, based on playing a 64 player game:
Quote:
CPU: 3 Ghz. For AMD Athlon 64 CPU: 3500+ (2.2 Ghz)
RAM: 2 Gb

It is reported that a full 64player server requires 8Mb/s of bandwidth.

http://i.imgur.com/qqsW2jp.pngWhy use a VPS?
A VPS is a compromise between a localhost solution and an expensive online pre-configured dedicated server. With a Virtual Private Server, you can have: big bandwidth, 24/7 uptime, no hardware maintenance, power saving… all for a small monthly charge. Here is a list of some of the Cloud Computing provider I've tried and they deserve to be tried.

- A2 Hosting
- Amazon EC2
- AtlanticNet
- Bandwagon Host
- BudgetVM
- DigitalOcean
- Dreamhost
- Google Compute Engine
- Linode
- Microsoft Azure
- OVH
- Ramnode
- Scaleway
- StableHost
- VpsNet
- Vpsdime
- Vultr

For this guide I have chosen the famous DigitalOcean services for their distributed datacenter and for affordable costs, but to be honest I think that Scaleway is the best choice for a game server. For ONLY 3€/m (3.4 $/m) you could have 4 Cores, 2 Gb RAM and 200Mbit/s Internet bandwidth, 1Gbit/s Internal bandwidth. They are the first to provide bare metal services in the cloud computing sector with dedicated servers backed by SSD on ARM architecture.

http://i.imgur.com/2tA48QQ.pngSSH connection

http://i.imgur.com/z6QR8ZA.png

Once you have chosen the service to use you just have to start your virtual machine and access it through SSH. You can use Putty as a client and PuTTYgen for SSH key management. You can download these software from the official site (it's no installation required):

http://www.putty.org/

http://i.imgur.com/SKhOJup.pngInstallation

Once connected to the server, we can finally start our installation.

http://i.imgur.com/Kdc3v2m.png

As you can see I used Ubuntu 14.04.4 LTS (Trusty Tahr) x64, but you can choose any other distribution.

1) Create a new user under which the game server will run.
It is highly recommended not to run the server as root!

http://i.imgur.com/ysbwMTS.pngadduser bf2

Note: In some distributions you must create the new user's home using:

http://i.imgur.com/ysbwMTS.pngmkdir /home/bf2

If you enter the wrong password or want to change it:

http://i.imgur.com/ysbwMTS.pngpasswd bf2

2) Set the new user as owner of the home dir:

http://i.imgur.com/ysbwMTS.pngchown -R bf2 /home/bf2

3) Login new user:

http://i.imgur.com/ysbwMTS.pnglogout

Note: Once authenticated we will be in /home/bf2, if not:

http://i.imgur.com/ysbwMTS.pngcd /home/bf2

4) Get the server files:

http://i.imgur.com/ysbwMTS.pngwget http://download.bf2.us/servers/bf2.linux.server.tar.gz

5) Extract downloaded file:

http://i.imgur.com/ysbwMTS.pngtar -xvzf bf2.linux.server.tar.gz

Note: For more info about tar type:

http://i.imgur.com/ysbwMTS.pngtar man

6) Make the launcher executable:

http://i.imgur.com/ysbwMTS.pngchmod u+x server/bf2/start.sh

7) Now you have everything you need to start a new server, but before navigate to the dir:

http://i.imgur.com/ysbwMTS.pngcd server/bf2

See the content:

http://i.imgur.com/ysbwMTS.pngls

And start the configuration!

http://i.imgur.com/609wKRX.pngConfiguration

1) Change into your BF2 installation directory and edit the server config file:

http://i.imgur.com/ysbwMTS.pngnano -w mods/bf2/settings/serversettings.con

Note: These are the most important settings

Quote:
#serversettings.con
sv.serverName "BF2 Server" // Name of your BF2-Server
sv.welcomeMessage "text line 1 | text line 2 | [...]" // Server welcome message
// Use '|' for a linebreak
sv.password "" // Password needed for players to join the server
sv.internet 0 // 0 = LAN server, 1 = internet server
sv.serverIP "192.168.1.1" // IP of your server
sv.serverPort 16567 // Port of your server
sv.punkBuster 1 // 0 = disable Punkbuster, 1 = enable Punkbuster
sv.maxPlayers 32 // Maximum number of allowed players (16, 32, 64)
sv.numPlayersNeededToStart 10 // For ranked servers, this needs to be:
// 6 for maxPlayers 16, 10 for 32, 10 for 64
sv.roundsPerMap 2 // How often each map will be replayed
sv.friendlyFire 100 // For ranked servers: FF on and at 100% damage
sv.friendlyFireWithMines 1 // Same as above
sv.tkPunishEnabled 1 // For ranked servers, you need FF-punish on
sv.interfaceIP "192.168.1.1" // IP of your server


2) Edit your maplist to contain the maps you want to have in your map cycle:

http://i.imgur.com/ysbwMTS.pngnano -w mods/bf2/settings/maplist.con

Note: Here's an example:

Quote:
#maplist.con
mapList.append dalian_plant gpm_cq 32
mapList.append daqing_oilfields gpm_cq 32
mapList.append dragon_valley gpm_cq 32
mapList.append fushe_pass gpm_cq 32
mapList.append gulf_of_oman gpm_cq 32
mapList.append kubra_dam gpm_cq 32
mapList.append mashtuur_city gpm_cq 32
mapList.append operation_clean_sweep gpm_cq 32
mapList.append sharqi_peninsula gpm_cq 32
mapList.append songhua_stalemate gpm_cq 32
mapList.append strike_at_karkand gpm_cq 32
mapList.append zatar_wetlands gpm_cq 32


3) Enable rcon editing default.py in admin:

http://i.imgur.com/ysbwMTS.pngnano –w admin/default.py

Note: Be sure to save your password somewhere:

Quote:
'port': '4711',
'password': 'mypassword',


4) For manage unlocks (ex. weapons) navigate to /server/bf2/python/bf2/stats and:

http://i.imgur.com/ysbwMTS.pngnano –w unlock.py

Note: Edit 0 value to 1 to unlock.

http://i.imgur.com/1Dp0E5M.pngRunning the server

1) I highly recommend not starting the server as root,
so logout and login as we already seen before with bf2 user.

2) Navigate to server folder:

http://i.imgur.com/ysbwMTS.pngcd server/bf2/

3) To view the different starting parameters:

http://i.imgur.com/ysbwMTS.png./start.sh +help

4) Starting the server:

http://i.imgur.com/ysbwMTS.png./start.sh +dedicated +lowPriority

Note: It is a good idea to start the game using screen, because the server keeps a command line open.

5) If you are not using rcon, you can directly input your admin command via command line.
Search on Google for a complete list of command.

Note: For kill the server process use Ctrl+c as usual.

http://i.imgur.com/222Ae6C.pngReferences

Port Information
http://bf2tech.org/index.php/Port_Usage

http://tutorials.section6.net/home/how-to-set-up-a-dedicated-battlefield2-server
Posts: 1856 - KR:
Spencer
Seen: 4 days ago
Nice guide :) Well put together... I'm going to sticky it if you don't mind!

What's the benefit of using +lowPriority?
Posts: 2253 - KR:
<<R2>>Mrs
Seen: 5 days ago
+lowPriority can be used to make sure the server runs smooth even if bf2 causes heavy load
Donated: $1
Posts: 5 - KR:
Weping
Seen: 4 months ago
Spencer You can use +lowPriority to make sure the server runs smooth even if bf2 causes heavy load... I used it in the guide because my server is not very performant :(
Posts: 17 - KR:
Dnamyt
Seen: 3 weeks ago
Thanks for tutorial. i tried to run a bf2 server with p4f mod on Debian 64bits OVH vps, but don't start with the error :

Quote:
PlayerManager created ObjectManager created GameLogic created ServerSettings created
No maps in maplist. Please add atleast one map, or use +loadLevel command.


i tried this maplist.con :

Quote:
mapList.append gulf_of_oman_p4f gpm_cq 32
mapList.append strike_at_karkand_p4f gpm_cq 32
mapList.append basra_p4f gpm_cq 32
mapList.append sharqi_p4f gpm_cq 32
mapList.append mashtuur_city_p4f gpm_cq 32
mapList.append dragon_valley_p4f gpm_cq 32
mapList.append dalian_plant_p4f gpm_cq 32
mapList.append trail_p4f gpm_cq 32


i also tried to start the server with classic bf2 mod with the maplist.con:

Quote:
mapList.append strike_at_karkand gpm_cq 32


but same result.. i specify that these two maplist.con and serversettings.con works great to my windows local server.. so i tried many starting commands:

Quote:
./start.sh

Quote:
./start.sh +dedicated

Quote:
./start.sh +dedicated +lowPriority

Quote:
./start.sh +dedicated +modPath mods/p4f (and mods/bf2)

Quote:
./start.sh +dedicated +modPath mods/p4f +mapList mods/p4f/settings/maplist.con

Quote:
./start.sh +dedicated +modPath mods/p4f +mapList mods/p4f/settings/maplist.con +config mods/p4f/settings/serversettings.con

Quote:
./start.sh +dedicated +modPath mods/p4f +mapList mods/p4f/settings/maplist.con +config mods/p4f/settings/serversettings.con +lowPriority +loadLevel mods/p4f/levels/strike_at_karkand_p4f


also these commands without +dedicated ..

i search on several forums and website but don't find a solution for now.. any idea please ?
Posts: 1 - KR:
zabes
Seen: 1 year ago
firewall exceptions ?
Posts: 17 - KR:
Dnamyt
Seen: 3 weeks ago
you think Iptables can prevent maplist.con ? i haven't changed iptables and all is open (input, forward,output) by default for now.. so i think there is no exception needed ? ;)

edit: problem solved : if it helps others the BF2 Linux server will read lower-case filenames ONLY. All file names encountered at runtime are lower-cased before a filesystem access is attempted. The only exception is Python-scripts. You should therefore make sure all files are lower-case when installing third-party modifications and maps.

To aid you with this there is an included python script called lowercaseDir.py (server/bf2/ path) which recursively changes the case of files and directories from the directory where it's run.

Usage:
Quote:
lowercaseDir.py [--pretend] [--verbose]


You can simulate the actions of the script with these options:
Quote:
$ ./lowercaseDir.py mods/yourMod --pretend


When you're certain it looks good run the conversion:
Quote:
$ ./lowercaseDir.py mods/yourMod --verbose


and your server start..
Posts: 4 - KR:
marley12
Seen: 8 months ago
Hello,


I have a problem with installation, I am stuck at:

"6) Make the launcher executable:
http://i.imgur.com/ysbwMTS.pngchmod u+x server/bf2/start.sh "

I get :
"chmod: cannot access `server/bf2/start.sh': No such file or directory"


Could you help me ?
Ubuntu 12.04 64Bit
Vps https://my.iniz.com/

Edit :


I created a "bf2" folder in the "server" folder.

I have copied all the files from the "server" folder to the "server / bf2 /" folder

The command "chmod" works but I can not start the server:

[email protected]:~/server/bf2$ ./start.sh +dedicated +lowPriority
ln: failed to create symbolic link `pb': File exists
./start.sh: 27: exec: /home/bf2/server/bf2/bin/amd-64/bf2: Permission denied

Could you help me ?
Sorry for my bad English
Donated: $1
Posts: 5 - KR:
Weping
Seen: 4 months ago
marley12
Quote:
I created a "bf2" folder in the "server" folder.

I have copied all the files from the "server" folder to the "server / bf2 /" folder

The command "chmod" works but I can not start the server:

[email protected]:~/server/bf2$ ./start.sh +dedicated +lowPriority
ln: failed to create symbolic link `pb': File exists
./start.sh: 27: exec: /home/bf2/server/bf2/bin/amd-64/bf2: Permission denied

Could you help me ?
Sorry for my bad English


You should check if the symbolic link 'pb' exists. If it does, you could unlink it:
Quote:
sudo unlink pb

then redo the sh command:
Quote:
sudo sh start.sh +dedicated +lowPriority
Posts: 866 - KR:
mDaWg
Seen: 1 month ago
Hey guys,

Maybe this image will help, or be a bit easier for some... This is currently only guaranteed to work on Vultr at the moment, as I do not have accounts with other providers for any testing at the moment. So far Vultr VPSes have been the best performing out of the several different providers we tested months ago. They do not over-provision their resources anywhere near as poorly as other providers have done to us in the past. When we tried DigitalOcean and Linode, their networks were -okay- however the CPUs could not handle our full 64 man servers at all. Vultr was and still is able to run these servers without major CPU lag. They also have dedicated instances available but we've never needed to use them.

Right now they are also running a pretty sweet deal for any new sign ups where they will match your contribution on prepaid credit up to $100. Smaller severs can easily get away with a $5/month instance for a small 16 player game, so if you were to deposit $15 you'd basically get a server for 6 months. You can always upgrade your instance at anytime for more resources if necessary.

Below is a link that you can use for a Vultr VPS to basically have an instant BF2 server. If you sign up and login to your panel, then head to the "snapshots" tab, you'll see an option to upload a snapshot. Simply copy/paste the following URL into the "Remote URL" box and it will begin to download to your account.

Signup for Vultr: https://www.vultr.com/?ref=6917426-3B

Download the Snapshot Image: http://images.revive.network/bf2.image

https://4st.me/xMf9Q.png

This may take some time to completely download to your account. Get up and go grab a coffee or something, maybe play a round while you wait :) Once completed, use the giant + button at the top right from any page to create a new instance.

https://4st.me/GvW1J.png

Under Step 2 (Server Type), select the Snapshot tab. You will see your new bf2.image snapshot available for deployment.

https://4st.me/yezAU.png


This server has BF2 as well as the xpack installed. BF2CCD is also setup and running out of the box with mono.

Once deployed, the default credentials for the instance are as follows

=====================
SSH Default
=====================
Username: root
Password: battlelog-image

=====================
BF2CCD default
=====================
Username: admin
Password: admin

The following ports are already open for use with BF2

=====================
Firewall ports open
=====================
SSH - 22
BF2 Game - UDP 16567
BF2 Query - UDP 29900
BF2 Voip - UDP 55128
BF2 RCON - TCP 4711
BF2CC Port - TCP 4712

I HIGHLY recommend you login and change the passwords immediately. You can use the passwd command once logged in via ssh to change the root password to something a bit more secure and the BF2CC password can be changed via the BF2CC client. MAKE SURE you have .net 1.1 and .net 1.1 SP1 installed, otherwise you WILL end up causing issues with the server.

Once the snapshot is on your account, you can re-deploy or restore the snapshot to the existing server at any time for a fresh installation of BF2.
Posts: 4 - KR:
marley12
Seen: 8 months ago
Hello mDaWg


I get an error,

http://i.imgur.com/TCWsnZN.jpg
Posts: 4 - KR:
marley12
Seen: 8 months ago

It's okay, after a second attempt it works
Posts: 5 - KR:
begemoc
Seen: 2 months ago
Hi, I got this error on ubuntu linux:
[email protected]:~/server/bf2$ ./start.sh +dedicated +lowPriority
ln: failed to create symbolic link `pb': File exists
./start.sh: 27: exec: /home/bf2/server/bf2/bin/amd-64/bf2: Permission denied

I tried above mentioned solutions but still no luck, anyone know how to solve this problem?
previous123 next

Quick Reply

You must be logged in to post. Not a member yet? Register!
This web site is not endorsed by or affiliated with Electronic Arts Inc. or DICE. All trademarks and copyrights belong to their respective owners.
For more information, please visit the official website at battlefield.com.