Battlefield Bad Company 2 Server Setup Guide (Linux)

This guide will help you set up a Battlefield Bad Company 2 server on Ubuntu 22.04 or later using Wine and WineTricks.

HINT: this guide is unfinished and unpolished. Come back later for a better version :)

This guide shows you how to host a Battlefield Bad Company 2 server on Linux (Ubuntu). Why you should host on Linux instead of Windows you may ask? Most server plans do provide virtual servers for 5$ per month or less. Windows licenses tend to be expensive, so mostly there is no Windows virtual server below 10$/month. Security issues are less a concern on Linux as well, if done correctly. Windows uses more resources on it's own. A fully fledged GUI needs more resources than a command line remote connection.

This guide is not meant as an absolute beginners guide! Please get yourself somewhat familar with Ubuntu Linux somewhere else.

what server should it be?

Depending on the server provider and the given performance for each virtual server this is the bare minimum:

  • 2 vCPU (dedicated CPU is better, if not available, use a provider which does not over provision the server systems that much)
  • 2 GB RAM (4 would be better)
  • 10 GB disk space (dedicated server files ~500MB)

preparation

  • Buy / install a virtual server with Ubuntu Linux 22.04 or newer -- connect to the server via SSH as root or use sudo to get root access (recommended via Private/Public Key instead of a password)
  • install winetricks (see https://github.com/Winetricks/winetricks for more information) -- sudo apt install winetricks
  • install the latest Wine via the official Wine repository (see https://wiki.winehq.org/Ubuntu for more information) -- check which Wine version you have installed (should be at least 9.0) -- wine --version
  • install XFVB, this is a frame buffer, some sort of virtual display because Windows apps want to draw something ;) -- sudo apt install xvfb
  • create a new unpriviledged user -- adduser --disabled-password bfbc2
  • go into the users home folder -- cd /home/bfbc2/
  • change to the user -- su bfbc2
  • create the Wine environment - the WINE_PREFIX is important. Each game server instance will later need it's own environment. -- WINEPREFIX="/home/bfbc2/.wine_1" winetricks /q dinput8 -- WINEPREFIX="/home/bfbc2/.wine_1" winetricks /q vcrun2005 -- WINEPREFIX="/home/bfbc2/.wine_1" winetricks /q vcrun2008 -- WINEPREFIX="/home/bfbc2/.wine_1" winetricks /q vcrun2010

Now you need to upload the dedicated server files. These files can be found all over the internet. Copy these files into the directory "serverfiles" inside the user folder: /home/bfbc2/serverfiles/ - the main executable should be inside this folder: Frost.Game.Main_Win32_Final.exe.

To upload the dedicated server files you can use Filezilla - this tool is available for all major operating systems and is able to connect to the server via SFTP with the same credentials you have entered for the initial connection.

Make sure that after the upload the permissions of the files is correct by running the following command as root user:

sudo chown bfbc2:bfbc2 /home/bfbc2/ -R

creating instances

The prepared server files can be used for virtually unlimited servers. Each instance needs resources, so make sure your virtual server, or even better, dedicated server has enough CPUs and RAM depending on the amount of servers.

To create a new instance simply create a new folder (name it like you want) inside the /home/bfbc2/serverfiles/ directory. For this example, we use "instance1".

Inside this folder should be the following files:

  • serverid.dat (can be downloaded via the internet)
  • ServerOptions.ini (overall server settings)

And a folder named "AdminScripts" with the following file:

  • Startup.txt (detailed server settings for the gamemode, maps, etc)

running server

TODO