You will need the following:
- Computer or VPS that is online 24/7 with a decent connection that has average or above specs (We strongly advise a VPS).
- Strong technical knowledge/background knowledge of computers and Linux Operating Systems.
- An original copy of the game. You can buy it on Steam @ Call of Duty®: Modern Warfare® 2 (2009) on Steam
NOTE TO THE READER
Dear reader,
In the Linux world, when you rent a VPS from a cloud provider, it usually arrives as a “bare” installation lacking most things, including a desktop environment. This means that the initial interaction with your VPS is typically through the terminal via SSH. Before proceeding with this guide, in most cases, you’ll want to install a desktop environment or some other essential programs such as Vim for text editing. Additionally, due to lack of time, I only tested this tutorial on Debian and Ubuntu therefore I will show commands using the apt
package manager. On other Linux distributions or the FreeBSD OS, you might have a different package manager. Refer to the official documentation for your Operating System.
The first attempt may not be easy, especially if you have no prior experience with Linux. Seriously consider hosting on Windows, if you prefer a more familiar environment. if you are going to be using Linux for the first time and you attempt to follow this guide you might encounter issues that are very hard to overcome without good general knowledge of your Linux OS.
The way I usually install a desktop environment on my Linux VPS is with the following commands which I include for reference.
sudo apt-get install xfce4
sudo apt-get install xfce4-goodies
echo xfce4-session >~/.xsession
If you installed UFW on your system make sure to reference the official documentation to allow traffic through the net_port
. If you do not have it, I still recommend you check your IP tables’ rules to make sure they do not conflict with your IW4x servers. Each server needs an open or forwarded port with at least UDP traffic enabled which we refer to as the net_port. TCP traffic is optional and needed in case you want to serve content such as mods or user maps to players through the built web server (Mongoose) or if you want to use the game server status page/API.
You may want to check out this other guide I made which shows how to harden the security of your IW4x server with Fail2Ban.
DOWNLOADING THE GAME:
I recommend using steamcmd
to download the game files from the terminal. The following commands will download the Modern Warfare 2 game files from the Steam CDN; ownership of these games is required.
- Install
steamcmd
with the following commandssudo add-apt-repository multiverse; sudo dpkg --add-architecture i386; sudo apt update sudo apt install steamcmd
- Download the SP game files using this
steamcmd +@sSteamCmdForcePlatformType windows +login <STEAMUSERNAME> +force_install_dir ~/server +app_update 10180 validate +quit
- Download MP (Unknown if it is required) files using this (this command may only download a few megabytes)
steamcmd +@sSteamCmdForcePlatformType windows +login <STEAMUSERNAME> +force_install_dir ~/server +app_update 10190 validate +quit
By using the commands displayed above you will download the “game files” to a folder called “server”, the folder can be referenced as your game folder throughout this tutorial.
INSTALLING WINE
Wine (originally an acronym for “Wine Is Not an Emulator”) is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, macOS, & BSD.
You can install wine on Debian/Ubuntu with apt-get install wine
(After the installation, you may need to also run in the terminal winecfg
command to tweak some wine settings). If you are using another operating system or a Linux distro without the apt package manager I suggest you do some Googling to find out how you can install and configure Wine. For IW4x, I recommend also exporting WINEARCH
to win32
although I encountered no issue when this environment variable was left untouched or I just set it to win64
. IW4x should work either way, but if it does not make sure to do this step.
## Add Variables to the environment at the end of ~/.bashrc
echo -e 'export WINEPREFIX=~/.wine\nexport WINEDEBUG=fixme-all\nexport WINEARCH=win32' >> ~/.bashrc
## Update our session
source ~/.bashrc
## Configure our wine environment
winecfg
SERVER SETUP
-
Install the IW4x client distributed by the launcher. Download it and place it in your game folder. Note: If you’re on a Debian-based distro, you can skip this step by visiting [Linux: Debian/Ubuntu AMD64/ARM64] Install the AlterWare Launcher Using Our APT Repository to install the alterware-launcher via our self-hosted APT repository.
cd /tmp wget -q https://github.com/mxve/alterware-launcher/releases/latest/download/alterware-launcher-x86_64-unknown-linux-gnu.tar.gz tar -xf alterware-launcher-x86_64-unknown-linux-gnu.tar.gz -C ~/server rm alterware-launcher-x86_64-unknown-linux-gnu.tar.gz chmod +x ~/server/alterware-launcher
Then run the launcher from your game folder to automatically download the client files. Pro tip: use the terminal to run the launcher with the --update
command line argument for updates.
-
Download the server configurations from our Git, and place the files in the game folder.
cd /tmp wget -q https://git.alterware.dev/alterware/IW4ServerConfigsLinux/archive/main.zip unzip main.zip mv iw4serverconfigslinux/* ~/server/ rmdir iw4serverconfigslinux rm main.zip rm ~/server/LICENSE rm ~/server/README.md
- Carefully review and edit the configuration settings file to your liking. Give it a hostname, gametype, and remove or add the maps you want, etc. Remember to save the file after you have edited it. If you use the GNU nano text editor you can consult the manual page to see all the key binds to efficiently use the program.
- Forward the
net_port
(default value: 28960) which is defined in the “start” shell scripts. If you changed the default port or are adding another server, you may need to open the following additional ports. This step is not required on a dedicated server or VPS. If you enabled the firewall make sure to open thenet_port
for both UDP and TCP traffic. Consult the documentation for IP Tables or UFW
- Run the “start” shell script file for the type of server you want and it shall open. You will probably need to give the shell script executable permissions before you run it with
chmod +x <file name>