PDA

View Full Version : [CoD4] Setup CoD4(x) on your ubuntu 14.04 server



IzNoGoD
30th April 2017, 19:35
First off, I'd like to thank any and all sources I've used over the years to gather all this information. I cannot name them individually, however, if you feel special enough that you think you require a listing, send me a PM and I'll put you in my list of special people.


So, first off, you'd need a server with ubuntu 14.04 x64 minimal. Any other linux installation might also work (debian is closesly related to ubuntu, so the steps listed here will probably work on a debian install as well) (CentOS is not that closely related so most steps will require changing). Aquiring such a server is a thing you have to figure out for yourself. You can buy one of the many VPS's (virtual private servers) or run linux locally (on your own server/inside a VM/on your main pc) and go from there.


Step 1: Securing your server

The first steps you should always take when running any internet-facing server is securing the server. The most common attack vector for internet facing servers is ssh root password bruteforcing (clicky (https://blog.sucuri.net/2013/07/ssh-brute-force-the-10-year-old-attack-that-still-persists.html)), so moving away from both password usage for ssh logon as well as root login is a valid first step. Basically, it involves you following this guide: guide is here (https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04). If you're really paranoid about security you might want to generate your public/private key file on your local pc instead of on your server, use puttygen (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).

The next step in securing your ssh login is putting it on a different port. By default ssh listens on port 22, on ANY ssh installation. This means that portscans/brute force attacks will try port 22 first. Changing your ssh port basically boils down to editting /etc/ssh/sshd_config and changing the Port 22 line to some other port, preferably above 1024, but it must be below 65536 (I'm using a port between 30000 and 40000). Hereafter you have to restart your ssh deamon (ubuntu: service ssh restart) and reconnect your client on the new port.

After this, you should configure a firewall (example here (https://www.digitalocean.com/community/tutorials/additional-recommended-steps-for-new-ubuntu-14-04-servers)). Keep in mind that changing your ssh port requires you to actually read the stuff at that link or you might lock yourself out of your server.

Step 2: Installing CoD4x prerequisites
CoD4x prerequisites are as easy as doing:


dpkg --add-architecture i386
apt-get update
apt-get install build-essential nasm bc git libstdc++6:i386 g++-multilib


Step 3: Installing CoD4
Installing cod4 is as simple as uploading the iwd files from an existing cod4 install main directory and the .ff files from the zone/english directory to, for example, /home/USERNAME/_stock/cod4/main/ and /home/USERNAME/_stock/cod4/zone/english
These files need to be readable by the useraccount that will start the server.

Furthermore, you'll need the stock cod4_lnxded file, which in the case of cod4x is read from a .iwd file in your main directory. So, upload this file: 1327 to your main dir before proceeding.

Step 4: Compiling CoD4x
First off, clone this git repo:


git clone https://github.com/Zinglish/CoD4X17a-WonderlandX

If the git ever goes offline, use this: 1328

Then, edit a file to fix default jump_slowdownenabled behaviour:


Open Cod$X17a-WonderlandX/src/g_sv_movement.c, go to line 189 and change

if(ps->var_03 & 64 && ps->pm_time <= 1800 ){

to

if(ps->pm_flags & 0x4000 && ps->pm_time <= 1800 ){



Now, compile CoD4x with


./build_cod4x17a_elf.sh


Step 5: Starting your CoD4x server
Create a .sh file with the following contents:



#!/bin/bash

sv_maxclients="32"
fs_game="mods/your_mod_folder_here"
fs_homepath="/home/USER_HERE/YOUR_COD_DIR"
cod="/full/path/to/CoD4X17a-WonderlandX/bin/cod4x17a_dedrun"
com_hunkMegs="256"
config="configfile.cfg"
authorizemode="0" #0=cracked, 1=original
net_port="28960"


args=\
"+set fs_homepath \"$fs_homepath\" "\
"+set fs_game $fs_game "\
"+set net_port $net_port "\
"+set com_hunkMegs $com_hunkMegs "\
"+set sv_maxclients $sv_maxclients "\
"+set fs_basepath \"$fs_homepath\" "\
"+set sv_authorizemode $authorizemode "\
"+exec $config"

$cod $args +set g_gametype war +map mp_crash
Adjust where required.

Step 6: Creating your first mod
work in progress

Step 7: Go make something awesome
work in progress

IzNoGoD
30th April 2017, 19:35
reserved

IzNoGoD
30th April 2017, 19:35
Reserved too