Call of Duty 2 Dedicated Linux Server on a modern Debian Server

In Computers, Gaming
Scroll this

Hey there and welcome to my walk-through for installing the Call of Duty 2 dedicated linux server. In the year 2014. What fun! But it really is simple, as this guide will demonstrate. You will learn where to copy supporting files, how to make things executable, create a start script, run the game in a background process, and have it start automatically on boot. Optionally, you may want to remove the GUI for efficiency after everything is finished.

I decided to write a guide after spending hours googling for the right information needed for a basic, vanilla install situation. A lot of results are, of course, nearly a decade old. These dusty remnants are cluttering up the interwebs with vacated servers, cleansed or renewed forums and spam-filled blogs. So much for longevity of information on the internet!

So here I am preserving this information for other amateur linux enthusiasts. This does not cover a hosted server scenario; there’s plenty of guides for that around. This is for a roll-your-own, DIY server that you probably built using an old computer found in the closet, with the most recent downloaded ISO of Debian (I recommend 32-bit version, see below for why).

So let’s get started! Below is a quick navigation index to jump to specific parts of the guide. Also, this is one of the rare pages on my blog that have comments opened, but you will need to acknowledge your email.

Contents

  1. Compatibility
  2. Prerequisites 
  3. Create User
  4. Installing the Game Server
  5. Configuring the Server
  6. Making the start file
  7. Auto Starting the Server at Boot
  8. Optional Linux Settings
  9. References

Compatability

  • This guide was written using Debian Linux 7 32-Bit
  • Call of Duty 2 is a 32-Bit program.
    • 64-Bit distributions of Debian require 32-Bit x86 C libraries

Note: I tried getting this and other versions of Call of Duty to work in 64-Bit linux with no success. I simply could not find the exact, correct x86 libraries needed to run the executable. My Linux knowledge is limited, and all the guides and googling could not help me with this. I highly recommend that if you are going to run an old-school server with games like the Call of Duty franchise, Unreal Tournament and Counterstrike that you use a 32-Bit distribution instead. You won’t have this layer of additional bullshit to deal with.

 Prerequisites

  • TMUX is used for launching the server.
    • You can use Screen, however TMUX is a much better, modern alternative.
  • If you are running a 64-bit distribution, you will need to install the 32-Bit C libraries. Good luck with that. 🙂
  • Call of Duty Linux Server 1.3
  • A copy of Call of Duty 2 CD or Steam Download

Optional

A Note on MOD’s

The linux server will load all the mods it finds in the main sub directory, as well as being a known issue it is a very bad thing. It causes conflicts in the server, usually prohibiting your chosen mod from running. Do not simply upload the entire contents of your existing main folder from the client you play the game on to main on your server. You will only want the specific .PK3 (and other necessary files) for the one mod you wish to run.

 Create User

Start the create user processess: adduser cod2server
Follow the prompts using whatever password you want. You can now choose to log in with this user, or sudo to this user to perform the remaining actions. Do not create, copy or modify any files with the root user. Doing so will cause permissions issues since the files are owned by root which has special permissions. The server may not be able to read files owned by root. To switch to your new user account, enter: su - cod2server

 Making the Start File

The start file uses TMUX to launch the server into a background processes that can be called up at any time. This allows you to also back-scroll to view the server output. There is a great tutorial on TMUX: TMUX The Terminal Multiplexer
I created a simple script to run COD2 with its parameters, and named it start. This command line starts a TMUX session with the name cod2server and executes cod2_lnxded with command line options. If you want to run your own mod, simply replace +set fs_game zzz_allweapons_v1.4 with the mod you want, or just remove this altogether for no mod.
nano start
The contents of start, note the ./ at the beginning of the command line options:
tmux new-session -d -s cod2server "./cod2_lnxded +set net_port 28961 +map_rotate +sv_punkbuster 0 +set dedicated 2 +set fs_game zzz_allweapons_v1.4 +exec server.cfg +map_rotate"
To run, simply type:./start
If you log in to your server, you can bring up the TMUX session with:
tmux attach -t cod2server

 Auto Starting the Linux Server on Boot

I found an excellent article on how to create a script to execute on boot-up.
Using the template found on that site, I went to the folder: cd /etc/init.d/ and created the file: nano cod4server with the following contents:

### BEGIN INIT INFO
# Provides: cod2server
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: cod2server
# Description: Inits Call of Duty 2 Server under TMUX
### END INIT INFO

su --login cod2server --command "/home/cod2server/start"

Then, I made it executable with chmod 755 /etc/init.d/cod2server
Finally, it needs to be recognized as part of the boot. Do this by typing update-rc.d cod2server defaults

 Optional Linux Settings

Booting without a GUI to a command line

To disable booting into Gnome 3, you need to edit the grub loader like this:
cd /etc/default
nano grub

Find the value GRUB_CMDLINE_LINUX_DEFAULT early in the file and replace its value with text
GRUB_CMDLINE_LINUX_DEFAULT="text"

Your Debian system will now boot to command-line only.