All HowTo's Linux Ubuntu, Mint & Debian Linux

Install CoD 4 Modern Warfare as a Dedicated Server on Linux

This is a HowTo describing the download and installation process for a dedicated Call Of Duty 4 Modern Warfare Linux server. You will need a copy of the game data to do this. Here’s the note on this matter in the Readme that comes with the CoD4 Linux application:

Copy the contents of disc one’s “Setup/Data” directory to wherever you
want to install the Call of Duty 4(tm) Linux server. There should be a
“localization.txt” file in the root of this directory, and a “main”
Subdirectory. Each additional disc should be opened and the contents of
each “Data” folder should be copied over to the existing Main folder.

On the server.

Create the user on the server. It’s best to not run these things as the ‘root’ user. Either set the password for this new user (so we can rsync to it later) or use a key or some other way to get the files there:

useradd cod4
passwd cod4
cd /home/cod4

On the workstation where the CoD4 game is installed.

Next we need to copy the game data from our local machine or wherever you have the game installed. In this example i am copying from my local MacOS. Note that this will copy about 7GB from your local system to the server:

rsync -avz /Volumes/Macintosh HD/Applications/Call of Duty 4.app/Contents\Call\ of\ Duty\ 4\ Data [email protected]:/home/cod4/

… Where “cod4.example.com” is my game server.

On the server.

On the server, correct the directory name that you just copied from the local computer to the server. After this, the directory where everything is will be “/home/cod4/cod4_content”:

cd /home/cod4/
mv Call\ of\ Duty\ 4\ Data/ cod4_content

Another look at the Readme file.

Unpack this archive in the root of the newly-copied tree, so
“cod4_lnxded” is in the same directory as “localization.txt”.

cd /home/cod4
wget http://treefort.icculus.org/cod/cod4-linux-server-06282008.tar.bz2
tar -xvjf cod4-linux-server-06282008.tar.bz2
cp -rp /home/cod4/cod4-linux-server/* /home/cod4/cod4_content/

At this point we need to patch CoD4 to bring it up to the latest version (1.7):

cd /tmp
wget http://www.shrapnet.com/downloads/cod4-linux-server-06282008.tar.bz2
bunzip2 cod4-linux-server-06282008.tar.bz2
tar -xf cod4-linux-server-06282008.tar
cp -rv /tmp/cod4-linux-server/* /home/cod4/cod4_content/

Following is the config file that you should place is “general.cfg”. This config file goes in the “/home/cod4/cod4/cod4_content/main” directory on the server:

Change the first few settings to be whatever you like. Then go through the remainder and see if anything needs changing. The last line in the config file is defining the game type. Spend some time there.

sets sv_hostname "AGIX CoD4 Server"
sets _Admin "Andrew G"
sets _Email "[email protected]"
sets _Location "Adelaide, South Australia"
sets _Irc "your IRC-Channel"
sets _Maps "CoD4 Standard Maps"
set rcon_password "MyPassword"
set g_password ""
set sv_maxRate "20000"
set sv_fps "20"
set sv_punkbuster "1"
set sv_pure "1"
set sv_maxclients "16"
set sv_privateClients "0"
set sv_minPing "0"
set sv_maxPing "300"
set sv_allowAnonymous "0"
set g_antilag "1"
set sv_kickBanTime "300"
set logfile "1"
set g_log "modded_mp.log"
set g_allowvote "1"
set g_oldVoting "1"
set sv_allowDownload "1"
set g_deadChat "1"
set voice_deadChat "0"
set g_gravity "800"
set sv_disableClientConsole "0"
set sv_floodProtect "1"
set g_no_script_spam "1"
set sv_reconnectlimit "3"
set sv_timeout "240"
set sv_connectTimeout "240"
set g_inactivity "0"
set sv_zombietime "2"
set scr_teambalance "1"
set scr_team_fftype "0"
set scr_drawfriend "1"
set scr_enable_scoretext "1"
set scr_game_allowkillcam "1"
set scr_game_spectatetype "2"
set scr_game_matchstarttime "0"
set scr_game_playerwaittime "0"
set scr_game_deathpointloss "0"
set scr_game_suicidepointloss "0"
set scr_player_forcerespawn "0"
set scr_player_healthregentime "5"
set scr_player_maxhealth "100"
set scr_player_sprinttime "4"
set scr_player_suicidespawndelay "0"
set scr_game_onlyheadshots "0"
set scr_team_kickteamkillers "0"
set scr_teamKillPunishCount "3"
set scr_team_teamkillspawndelay "20"
set scr_team_teamkillpointloss "1"
set sv_voice "0"
set sv_voiceQuality "3"
set class_assault_limit "99"
set class_specops_limit "99"
set class_heavygunner_limit "99"
set class_demolitions_limit "99"
set class_sniper_limit "99"
set class_assault_allowdrop "1"
set class_specops_allowdrop "1"
set class_heavygunner_allowdrop "1"
set class_demolitions_allowdrop "1"
set class_sniper_allowdrop "1"
set weap_allow_m16 "1"
set weap_allow_ak47 "1"
set weap_allow_m4 "1"
set weap_allow_g3 "1"
set weap_allow_g36c "1"
set weap_allow_m14 "1"
set weap_allow_mp44 "1"
set attach_allow_assault_none "1"
set attach_allow_assault_gl "1"
set attach_allow_assault_reflex "1"
set attach_allow_assault_silencer "1"
set attach_allow_assault_acog "1"
set weap_allow_mp5 "1"
set weap_allow_skorpion "1"
set weap_allow_uzi "1"
set weap_allow_ak74u "1"
set weap_allow_p90 "1"
set attach_allow_smg_none "1"
set attach_allow_smg_reflex "1"
set attach_allow_smg_silencer "1"
set attach_allow_smg_acog "1"
set weap_allow_m1014 "1"
set weap_allow_winchester1200 "1"
set attach_allow_shotgun_none "1"
set attach_allow_shotgun_reflex "1"
set attach_allow_shotgun_grip "1"
set weap_allow_saw "1"
set weap_allow_rpd "1"
set weap_allow_m60e4 "1"
set attach_allow_lmg_none "1"
set attach_allow_lmg_reflex "1"
set attach_allow_lmg_grip "1"
set attach_allow_lmg_acog "1"
set weap_allow_dragunov "1"
set weap_allow_m40a3 "1"
set weap_allow_barrett "1"
set weap_allow_remington700 "1"
set weap_allow_m21 "1"
set attach_allow_sniper_none "1"
set attach_allow_sniper_acog "1"
set weap_allow_beretta "1"
set weap_allow_colt45 "1"
set weap_allow_usp "1"
set weap_allow_deserteagle "1"
set weap_allow_deserteaglegold "1"
set attach_allow_pistol_none "1"
set attach_allow_pistol_silencer "1"
set weap_allow_frag_grenade "1"
set weap_allow_concussion_grenade "1"
set weap_allow_flash_grenade "1"
set weap_allow_smoke_grenade "1"
set perk_allow_specialty_parabolic "1"
set perk_allow_specialty_gpsjammer "1"
set perk_allow_specialty_holdbreath "1"
set perk_allow_specialty_quieter "1"
set perk_allow_specialty_longersprint "1"
set perk_allow_specialty_detectexplosive "1"
set perk_allow_specialty_explosivedamage "1"
set perk_allow_specialty_pistoldeath "1"
set perk_allow_specialty_grenadepulldeath "1"
set perk_allow_specialty_bulletdamage "1"
set perk_allow_specialty_bulletpenetration "1"
set perk_allow_specialty_bulletaccuracy "1"
set perk_allow_specialty_rof "1"
set perk_allow_specialty_fastreload "1"
set perk_allow_specialty_extraammo "1"
set perk_allow_specialty_armorvest "1"
set perk_allow_specialty_fraggrenade "1"
set perk_allow_specialty_specialgrenade "1"
set perk_allow_c4_mp "1"
set perk_allow_claymore_mp "1"
set perk_allow_rpg_mp "1"
set class_assault_primary "m16"
set class_assault_primary_attachment "gl"
set class_assault_secondary "beretta"
set class_assault_secondary_attachment "none"
set class_assault_perk1 "specialty_null"
set class_assault_perk2 "specialty_bulletdamage"
set class_assault_perk3 "specialty_longersprint"
set class_assault_grenade "concussion_grenade"
set class_assault_camo "camo_none"
set class_assault_frags "1"
set class_assault_special "1"
set class_specops_primary "mp5"
set class_specops_primary_attachment "none"
set class_specops_secondary "usp"
set class_specops_secondary_attachment "silencer"
set class_specops_perk1 "c4_mp"
set class_specops_perk2 "specialty_explosivedamage"
set class_specops_perk3 "specialty_bulletaccuracy"
set class_specops_grenade "flash_grenade"
set class_specops_camo "camo_none"
set class_specops_frags "1"
set class_specops_special "1"
set class_heavygunner_primary "saw"
set class_heavygunner_primary_attachment "none"
set class_heavygunner_secondary "usp"
set class_heavygunner_secondary_attachment "none"
set class_heavygunner_perk1 "specialty_specialgrenade"
set class_heavygunner_perk2 "specialty_armorvest"
set class_heavygunner_perk3 "specialty_bulletpenetration"
set class_heavygunner_grenade "concussion_grenade"
set class_heavygunner_camo "camo_none"
set class_heavygunner_frags "1"
set class_heavygunner_special "1"
set class_demolitions_primary "winchester1200"
set class_demolitions_primary_attachment "none"
set class_demolitions_secondary "beretta"
set class_demolitions_secondary_attachment "none"
set class_demolitions_perk1 "rpg_mp"
set class_demolitions_perk2 "specialty_explosivedamage"
set class_demolitions_perk3 "specialty_longersprint"
set class_demolitions_grenade "smoke_grenade"
set class_demolitions_camo "camo_none"
set class_demolitions_frags "1"
set class_demolitions_special "1"
set class_sniper_primary "m40a3"
set class_sniper_primary_attachment "none"
set class_sniper_secondary "beretta"
set class_sniper_secondary_attachment "silencer"
set class_sniper_perk1 "specialty_specialgrenade"
set class_sniper_perk2 "specialty_bulletdamage"
set class_sniper_perk3 "specialty_bulletpenetration"
set class_sniper_grenade "flash_grenade"
set class_sniper_camo "camo_none"
set class_sniper_frags "1"
set class_sniper_special "1"
set class_assault_movespeed "0.95"
set class_specops_movespeed "1.00"
set class_heavygunner_movespeed "0.875"
set class_demolitions_movespeed "1.00"
set class_sniper_movespeed "1.00"
set scr_enable_nightvision "1"
set scr_enable_music "1"
set scr_enable_hiticon "1"
set scr_hardcore "0"
set scr_oldschool "0"
set scr_oldschool_mw "0"
set scr_game_hardpoints "1"
set scr_hardpoint_allowartillery "1"
set scr_hardpoint_allowhelicopter "1"
set scr_hardpoint_allowsupply "1"
set scr_hardpoint_allowuav "1"
set scr_dm_scorelimit "1000"
set scr_dm_timelimit "15"
set scr_dm_roundlimit "1"
set scr_dm_numlives "0"
set scr_dm_playerrespawndelay "0"
set scr_dm_waverespawndelay "0"
set scr_war_scorelimit "750"
set scr_war_timelimit "10"
set scr_war_roundlimit "1"
set scr_war_numlives "0"
set scr_war_playerrespawndelay "0"
set scr_war_waverespawndelay "0"
set scr_dom_scorelimit "200"
set scr_dom_timelimit "0"
set scr_dom_numlives "0"
set scr_dom_playerrespawndelay "0"
set scr_dom_roundlimit "1"
set scr_dom_waverespawndelay "0"
set scr_koth_scorelimit "250"
set scr_koth_timelimit "15"
set koth_kothmode "0"
set koth_capturetime "20"
set koth_spawntime "0"
set scr_koth_numlives "0"
set scr_koth_playerrespawndelay "0"
set scr_koth_roundlimit "1"
set scr_koth_roundswitch "1"
set scr_koth_waverespawndelay "0"
set koth_autodestroytime "60"
set koth_delayPlayer "0"
set koth_destroytime "10"
set koth_spawnDelay "60"
set scr_sab_scorelimit "1"
set scr_sab_timelimit "20"
set scr_sab_roundswitch "1"
set scr_sab_bombtimer "30"
set scr_sab_planttime "2.5"
set scr_sab_defusetime "5"
set scr_sab_hotpotato "0"
set scr_sab_numlives "0"
set scr_sab_playerrespawndelay "7.5"
set scr_sab_roundlimit "0"
set scr_sab_waverespawndelay "0"
set scr_sd_scorelimit "4"
set scr_sd_timelimit "2.5"
set scr_sd_roundswitch "3"
set scr_sd_bombtimer "45"
set scr_sd_planttime "5"
set scr_sd_defusetime "5"
set scr_sd_multibomb "0"
set scr_sd_numlives "1"
set scr_sd_playerrespawndelay "0"
set scr_sd_roundlimit "0"
set scr_sd_waverespawndelay "0"
set g_gametype "war"
set sv_mapRotation "gametype war map mp_backlot gametype war map mp_bloc gametype war map mp_bog gametype war map mp_citystreets gametype war map mp_convoy gametype war map mp_countdown gametype war map mp_crash gametype war map mp_crossfire gametype war map mp_farm gametype war map mp_overgrown gametype war map mp_pipeline gametype war map mp_shipment gametype war map mp_showdown gametype war map mp_strike gametype war map mp_vacant"

Create your startup script in the file “cod4.sh”:

#!/bin/bash
cd /home/cod4
sudo -H -u cod4 ./cod4_lnxded +set sv_authorizemode "-1" +exec general.cfg +map_rotate

Set the startup script to be executable:

chmod +x /home/cod4/cod4.sh

Finally the firewall. Open the following ports:

Destination UDP/TCP 28960
Source UDP/TCP 28960

Destination UDP/TCP 20800
Source UDP/TCP 20800

Destination UDP/TCP 20810
Source UDP/TCP 20810

Tip: This is what my rules look like:

# CoD4
-A INPUT -m state --state NEW -m tcp -p tcp --dport 28960
-A INPUT -m state --state NEW -m tcp -p tcp --dport 20800
-A INPUT -m state --state NEW -m tcp -p tcp --dport 20810
-A INPUT -m state --state NEW -m tcp -p tcp --sport 28960
-A INPUT -m state --state NEW -m tcp -p tcp --sport 20800
-A INPUT -m state --state NEW -m tcp -p tcp --sport 20810

-A INPUT -p udp --dport 28960
-A INPUT -p udp --dport 20800
-A INPUT -p udp --dport 20810
-A INPUT -p udp --sport 28960
-A INPUT -p udp --sport 20800
-A INPUT -p udp --sport 20810

Start the Cod server with:

/home/cod4/cod4.sh

References:

https://www.vultr.com/docs/setup-a-call-of-duty-4-server-on-debian-7-x64

One comment

Leave a Reply to Grega Rednak Cancel reply

Your email address will not be published. Required fields are marked *