Call of Duty 4 Linux Server
Posted 11:59:17 AM on Wed, 23rd April 2008 by Dj-ZoRt!
This is a very quick howto on installing Call of Duty 4 (COD4) dedicated server for Linux. This uses the native linux port. It should also work fine for FreeBSD (as cod4 works perfectly in freebsd's linux emulation)
Note
I have also stripped out unneeded files to minimize size (by default its over 6gig). I am not using punkbuster, infact im also removing it completely. You can use punkbuster, but you will need to work that out for yourself (doing so will may mean you cant trim the install to bare essentials).
You will need...
- cod4 server binaries tar archive
- cod4 discs (cd or dvd, these instructions are for dvd)
The cds/dvd are available from wherever they are being sold. Find the link for cod4 linux binaries on your most convenient mirror
Prepare the game data files
Mount the cd/dvd to a convenient location, i will use
/mnt/
Go to the directory you want to install in (keep in mind you will need about 7 gigs of space initially). Perhaps
/opt/games/ or
/usr/local/games/. FreeBSD users may be inclined to have the files live inside
/emul/linux/ with the rest of the linux environment.
Create the COD4 server directory, and copy the game files then make them writable by the owner. You will need to repeat the copying line for each CD.
mkdir cod4-linux-server
cd $_
cp -R /mnt/Setup/Data/ ./
chmod -R g+w *
Remove Junk we dont need
Now remove the junk we dont need and save over 1gig of space (this isnt in the README file, but we dont need windows files unless we want to use punkbuster)
rm *bmp *exe *dll *ico
rm -rf main/video/
cd ..
You may also be able to remove the
Mods and
Miles directories, but they are under 1meg so its not all the worthwhile.
Install the Linuxy bits
Now install the COD4 binaries (do this last so that updated files in the package override the cd files) and remove the punk buster installer.
wget
tar jxvf
cd cod4-linux-server
rm pbsetup.run
Look how small it is!
dean@optimus:~/cod4-linux-server$ du -h
2.8G ./main
456K ./miles
696K ./Mods/ModWarfare
696K ./Mods
2.3G ./zone/english
2.3G ./zone
5.1G .
Configuration Files
Look elsewhere for this step.
Run your server!
Now do all the configuration files and then run the binary (you might want to run this in
screen).
./cod4_lnxded
Caveats
1. I have read that COD4 needs its game files and subdirectories in lower case. If there are just a few, you can rename them yourself with the
mv command. Otherwise you can use a fancy script such as this one, which will rename everything in and under the current directory to lowercase.
#!/usr/bin/perl
@files = `find .`;
shift @files;
foreach $file (@files) {
$file =~ s/\n//;
system('mv',$file,lc($file)) if ($file =~ /[A-Z]/g);
}
2. COD4 will fail to run if
~/.callofduty4/pb doesnt exist, even if punkbuster isnt used. This may cause problems with a very restricted user. You can probably fake cod4 by running it with
$HOME overridden. Ie
HOME=/opt/games/cod4-linux-server ./cod4_lnxded
You shouldn't use
export HOME=/blah/blah as this will wreck up your session.