Cod2 linux server ubuntu
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 x64 minimal (this tutorial should work an all versions between 12.04 and 20.04 without any modification). 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) (choose your ubuntu version at the top right of that page, defaults to 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/
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 CoD2 prerequisites
CoD2 prerequisites are as easy as doing:
sudo dpkg —add-architecture i386
sudo apt-get update
sudo apt-get -y install libstdc++5:i386
Although I’m not 100% sure that covers ALL the prerequisites. If cod fails to run, try installing the libcod prerequisites (step 4) as well.
Step 3: Installing CoD2
Installing cod2 is as simple as uploading the lnxded file (see another thread here on killtube (http://killtube.org/showthread.php?1719-Latest-cod2-linux-binaries-%281-0-1-2-1-3%29) for the binary files) to, for example, /home/USERNAME/_bin/cod2/cod2_lnxded_1_3 . This needs at least file permissions 500, (read+execute for the owner, assuming you’re gonna run this under your own username) so
chmod 500 cod2_lnxded_1_3
Then you need to upload the corresponding main directory to your server (note: main directories differ between v1.0/1.2/1.3) to, for example, /home/USERNAME/_stock/cod2_1_3/main/
These files need to be readable by the useraccount that will start the server
Step 4 (optional): Installing libcod prerequisites
As copied from the libcod github:
sudo apt-get -y install gcc-multilib
sudo apt-get -y install libmysqlclient-dev:i386
sudo apt-get -y install g++-multilib
I’ve tried installing these all in one command, but that failed for some unknown reasons. So just keep these as separate commands.
Step 5 (optional): compiling libcod from source
In order to compile libcod, you first need to obtain the source code. There are currently multiple libcod versions out there:
Kung foo man’s original version (https://github.com/kungfooman/libcod)
Mitch’s version (https://github.com/M-itch/libcod) which is a bit more experimental and has a few more features than the original version
Php’s version (https://github.com/riicchhaarrd/libcod) has a few nice functions but seems to be out-of-date
voron00’s version (https://github.com/voron00/libcod) which seems to be the best maintained version currently
To obtain the code, either download the source from github and upload, or
sudo apt-get install git
git clone [github url here]
You can then easily compile the stuff with
./doit.sh clean
./doit.sh base
./doit.sh cod2_1_3
For different cod versions, change the last line.
The final product (the actual libcod «executable») is then inside the bin folder as libcod2_1_3.so
Step 6: Starting your CoD2 server
Create a .sh file with the following contents:
sv_maxclients=»32″
fs_game=»your_mod_folder_here»
fs_homepath=»/home/USER_HERE/YOUR_COD_DIR»
cod=»/full/path/to/cod2_1_3_lnxded»
com_hunkMegs=»256″
config=»configfile.cfg»
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\» «\
«+exec $config»
$cod $args +set g_gametype tdm +map mp_toujane
Adjust where required.
Then, start your server with:
./filename.sh
To keep your server running after you leave the ssh session, use screen:
screen -AmdS somename
screen -x somename
./filename.sh
Step 7 (optional): Starting your CoD2 server with libcod
Requires a few small edits to your .sh file:
sv_maxclients=»32″
fs_game=»your_mod_folder_here»
fs_homepath=»/home/USER_HERE/YOUR_COD_DIR»
cod=»/full/path/to/cod2_1_3_lnxded»
com_hunkMegs=»256″
config=»configfile.cfg»
cracked=»1″
net_port=»28960″
args=\
«+set fs_homepath \»$fs_homepath\» «\
«+set sv_cracked $cracked «\
«+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\» «\
«+exec $config»
LD_PRELOAD=»relative/path/to/libcod2_1_3.so» $cod $args +set g_gametype tdm +map mp_toujane
Step 8: Creating your first mod
work in progress
Step 9: Protecting your server
Update: Since a few months a patch has been added to both Mitch’s github repo as wel as voron00’s. The next passage is not applicable to any who use an updated libcod version from the aforementioned sources.
To prevent your server from being used as a ddos amplifier (http://blog.alejandronolla.com/2013/08/05/amplification-ddos-attack-with-quake3-servers-an-analysis-2-slash-2/), you have to apply some iptables rules. As you should have iptables installed from the previous steps already, you can skip right to the protection part. Create a file called anti_ddos in /etc/init.d with the following contents:
# Carry out specific functions when asked to by the system
case «$1» in
start)
iptables -N QUERY-BLOCK
iptables -A QUERY-BLOCK -m recent —set —name blocked-hosts -j DROP
iptables -N QUERY-CHECK
iptables -A QUERY-CHECK -p udp -m string ! —string «getstatus» —algo bm —from 32 —to 41 -j RETURN
iptables -A QUERY-CHECK -p udp —sport 0:1025 -j DROP
iptables -A QUERY-CHECK -p udp —sport 3074 -j DROP
iptables -A QUERY-CHECK -p udp —sport 7777 -j DROP
iptables -A QUERY-CHECK -p udp —sport 8002 -j DROP
iptables -A QUERY-CHECK -p udp —sport 27015:27100 -j DROP
iptables -A QUERY-CHECK -p udp —sport 25200 -j DROP
iptables -A QUERY-CHECK -p udp —sport 25565 -j DROP
iptables -A QUERY-CHECK -m recent —update —name blocked-hosts —seconds 30 —hitcount 1 -j DROP
iptables -A QUERY-CHECK -m hashlimit —hashlimit-mode srcip —hashlimit-name getstatus —hashlimit-above 5/second -j QUERY-BLOCK
iptables -A INPUT -p udp —dport 28960 -j QUERY-CHECK
;;
stop)
exit 0
;;
*)
echo «Usage: /etc/init.d/anti_ddos
exit 1
;;
esac
To protect more than just the default port, edit this line:
iptables -A INPUT -p udp —dport 28960 -j QUERY-CHECK
into something like:
iptables -A INPUT -p udp —dport 28960:28970 -j QUERY-CHECK
This will limit the amount of queries to 5/second per client which should be plenty for normal queries and should temper or block all ddos amplifications.
Save this file, chmod 500 it, and add it to bootup with
sudo update-rc.d anti_ddos defaults
Check if it works by doing:
service anti_ddos start
twice. If you see «chain already exists» you did everything right.
Step 10: Go make something awesome
work in progress
Maybe Im dumb, or I dont know.
I’ve uploaded main files, ive downloaded cod2_lnxded_1_3_cracked.zip
My folder looks like this
home/cod2server/cod2_lnxded_1_3
home/cod2server/main/dedicated.cfg
home/cod2server/main/(here al iw files as normal)
I have paste and verify this command in putty:
iptables -I INPUT -p UDP —sport 20700 -s cod2master.activision.com -j REJECT
of course i’ve installed all packages by this command:
sudo apt-get install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc tmux libstdc++6
and after all this I wanted to finally start cod server by this command:
./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg
and nothing happens — my server is not working :/
here is my cfg:
sets _ADMIN «rogales»
sets _EMAIL «rogaldinho@gmail.com»
sets _IRC «»
sets _WEBSITE «»
sets _LOCATION «Poland»
set sv_hostname «Zjednoczone Chlejtuny Jebane»
set scr_motd «Witaj na serwerze. Wymagamy napierdalania i przeklinania!»
set net_ip «194.182.71.250»
set net_port «28960»
set dedicated «2»
set rconpassword «huj»
set sv_pure «1»
set sv_maxplayers «20»
set sv_minping «0»
set sv_maxping «0»
set sv_maxrate «0»
set sv_voice «0»
set g_password «»
set sv_drawfriend «0»
set scr_friendlyfire «0»
set scr_forcerespawn «1»
set scr_killcam «1»
set g_allowvote «1»
set scr_teambalance «1»
set scr_spectateenemy «0»
set scr_spectatefree «0»
set scr_allow_bar «1»
set scr_allow_bren «1»
set scr_allow_enfield «1»
set scr_allow_enfieldsniper «1»
set scr_allow_g43 «1»
set scr_allow_greasegun «1»
set scr_allow_kar98k «1»
set scr_allow_kar98ksniper «1»
set scr_allow_m1carbine «1»
set scr_allow_m1garand «1»
set scr_allow_mp40 «1»
set scr_allow_mp44 «1»
set scr_allow_nagant «1»
set scr_allow_nagantsniper «1»
set scr_allow_pps42 «1»
set scr_allow_ppsh «1»
set scr_allow_shotgun «1»
set scr_allow_springfield «1»
set scr_allow_sten «1»
set scr_allow_svt40 «1»
set scr_allow_thompson «1»
set scr_allow_fraggrenades «1»
set scr_allow_smokegrenades «1»
set scr_ctf_scorelimit «5»
set scr_ctf_timelimit «30»
set scr_dm_scorelimit «50»
set scr_dm_timelimit «30»
set scr_sd_bombtimer «60»
set scr_sd_graceperiod «15»
set scr_sd_roundlength «4»
set scr_sd_roundlimit «0»
set scr_sd_scorelimit «50»
set scr_sd_timelimit «30»
set scr_tdm_scorelimit «100»
set scr_tdm_timelimit «30»
set scr_hq_scorelimit «450»
set scr_hq_timelimit «30»
set sv_mapRotationCurrent «»
sv_maprotation «gametype dm map mp_breakout gametype dm map mp_brecourt gametype dm map mp_burgundy gametype dm map mp_carentan gametype dm map mp_dawnville gametype dm map mp_decoy gametype dm map mp_downtown gametype dm map mp_farmhouse gametype dm map mp_leningrad gametype dm map mp_matmata gametype dm map mp_railyard gametype dm map mp_toujane gametype dm map mp_trainstation gametype tdm map mp_breakout gametype tdm map mp_brecourt gametype tdm map mp_burgundy gametype tdm map mp_carentan gametype tdm map mp_dawnville gametype tdm map mp_decoy gametype tdm map mp_downtown gametype tdm map mp_farmhouse gametype tdm map mp_leningrad gametype tdm map mp_matmata gametype tdm map mp_railyard gametype tdm map mp_toujane gametype tdm map mp_trainstation gametype sd map mp_breakout gametype sd map mp_brecourt gametype sd map mp_burgundy gametype sd map mp_carentan gametype sd map mp_dawnville gametype sd map mp_decoy gametype sd map mp_downtown gametype sd map mp_farmhouse gametype sd map mp_leningrad gametype sd map mp_matmata gametype sd map mp_railyard gametype sd map mp_toujane gametype sd map mp_trainstation gametype ctf map mp_breakout gametype ctf map mp_brecourt gametype ctf map mp_burgundy gametype ctf map mp_carentan gametype ctf map mp_dawnville gametype ctf map mp_decoy gametype ctf map mp_downtown gametype ctf map mp_farmhouse gametype ctf map mp_leningrad gametype ctf map mp_matmata gametype ctf map mp_railyard gametype ctf map mp_toujane gametype ctf map mp_trainstation gametype hq map mp_breakout gametype hq map mp_brecourt gametype hq map mp_burgundy gametype hq map mp_carentan gametype hq map mp_dawnville gametype hq map mp_decoy gametype hq map mp_downtown gametype hq map mp_farmhouse gametype hq map mp_leningrad gametype hq map mp_matmata gametype hq map mp_railyard gametype hq map mp_toujane gametype hq map mp_trainstation»
map_rotate
What do you see in Putty? Just select everything with mouse to copy the text automatically and post it here in [code]-tag
chmod 500 ./cod2_lnxded_1_3_cracked
chmod +x ./cod2_lnxded_1_3_cracked
Ok.
Now I got this.
root@rgl:/home# cd cod2server
root@rgl:/home/cod2server# chmod 500 ./cod2_lnxded_1_3_cracked
root@rgl:/home/cod2server# chmod +x ./cod2_lnxded_1_3_cracked
root@rgl:/home/cod2server# ./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg
./cod2_lnxded_1_3_cracked: line 1: !DOCTYPE: No such file or directory
./cod2_lnxded_1_3_cracked: line 2: html: No such file or directory
./cod2_lnxded_1_3_cracked: line 3: head: No such file or directory
./cod2_lnxded_1_3_cracked: line 4: title: No such file or directory
./cod2_lnxded_1_3_cracked: line 5: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 6: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 7: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 8: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 9: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 10: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 11: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 12: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 13: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 14: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 15: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 16: meta: No such file or directory
./cod2_lnxded_1_3_cracked: line 17: link: No such file or directory
./cod2_lnxded_1_3_cracked: line 18: $’\r’: command not found
./cod2_lnxded_1_3_cracked: line 19: syntax error near unexpected token `
root@rgl:/home/cod2server#
Ok, I see that with every new post, we’re goin further! 😉
root@rgl:/home/cod2server# ./cod2_lnxded_1_3_cracked +set +exec dedicated.cfg
CoD2 MP 1.3 build linux-i386 Jun 23 2006
USAGE: set
—— FS_Startup ——
Current language: english
Current search path:
/root/.callofduty2/main
/home/cod2server/main/iw_15.iwd (85 files)
/home/cod2server/main/iw_14.iwd (4038 files)
/home/cod2server/main/iw_13.iwd (22624 files)
/home/cod2server/main/iw_12.iwd (1016 files)
/home/cod2server/main/iw_11.iwd (1462 files)
/home/cod2server/main/iw_10.iwd (1936 files)
/home/cod2server/main/iw_09.iwd (2142 files)
/home/cod2server/main/iw_08.iwd (2723 files)
/home/cod2server/main/iw_07.iwd (3384 files)
/home/cod2server/main/iw_06.iwd (990 files)
/home/cod2server/main/iw_05.iwd (928 files)
/home/cod2server/main/iw_04.iwd (698 files)
/home/cod2server/main/iw_03.iwd (26 files)
/home/cod2server/main/iw_02.iwd (40 files)
/home/cod2server/main/iw_01.iwd (16 files)
/home/cod2server/main/iw_00.iwd (102 files)
/home/cod2server/main
/root/.callofduty2/raw
/root/.callofduty2/raw_shared
/root/.callofduty2/devraw
/root/.callofduty2/devraw_shared
/home/cod2server/raw
/home/cod2server/raw_shared
/home/cod2server/devraw
/home/cod2server/devraw_shared
File Handles:
———————-
81633 files in iwd files
execing default_localize_mp.cfg
couldn’t exec language.cfg
couldn’t exec config_mp_server.cfg
USAGE: set
Opening IP socket: localhost:28960
Hostname: rgl
IP: 194.182.71.250
— Common Initialization Complete —
USAGE: set
execing dedicated.cfg
Cbuf_InsertText overflowed
Hitch warning: 1664 msec frame time
and no one cant connect. 🙁
EDIT: If it matters, my iw files are polish not english.
looks like your sv_maprotation is too long, just type in «map mp_carentan» e.g. by hand, and check «status» command. probably just no map loaded
I just cant believe myself what have I done before.
dedicated.cfg was also a html executable.
Now its ok.
but something is still wrong with premission i guess?
81633 files in iwd files
execing default_localize_mp.cfg
couldn’t exec language.cfg
couldn’t exec config_mp_server.cfg
USAGE: set
Opening IP socket: localhost:28960
Hostname: rgl
IP: 194.182.71.250
— Common Initialization Complete —
USAGE: set
execing dedicated.cfg
net_ip is write protected.
net_port is write protected.
dedicated is read only.
Sys_Error: Error during initialization:
Attempted to overrun string in call to va()
Nope, your commandline is wrong. Dont «+set +exec something», just «+exec something».
And as said: your map_rotation is too long. Shorten it to something below 1024 characters (preferably under 1k)
Now I have a litte bit easy problem i guess
set rconpassword «huj» is not working :/
in console im writing /rcon login huj and I cant do nothing after it :/
Next thing is that after I quit putty, the server also shut down. strange :/
Now I have a litte bit easy problem i guess
set rconpassword «huj» is not working :/
in console im writing /rcon login huj and I cant do nothing after it :/
Next thing is that after I quit putty, the server also shut down. strange :/
rcon_password, not rconpassword. There’s also a minimum length for it.
Closing putty effectively closes your cod server, so yes, that will close your game as well. Look into «screen» to run it without having to log in.
Look into «screen» to run it without having to log in.
I dont understand it ? :/
create a new screen session:
screen -AmdS namegoeshere
list all current screen sessions:
screen -ls
attach a running screen session:
screen -x namegoeshere
or
screen -x numbergoeshere (see screen -ls)
detach from a screen session:
press ctrl+a, then ctrl+d
Once you’ve created a new screen session, attach to it, start your server in there instead. Detach (or close the putty window) and it should keep running.
Jesus! How do You know this everything?!
It worked!
Ok guys, I’ve got last question.
In main folder I have saved different (custom) maps. Now. When I connect it automatically it wants to download it, even when the first map is carentan.
Is there any command on cfg file to put an information to download this map when its loaded by server or by rcon?
and. how long will it take, to see my server on master list?
Jesus! How do You know this everything?!
It worked!
Ok guys, I’ve got last question.
In main folder I have saved different (custom) maps. Now. When I connect it automatically it wants to download it, even when the first map is carentan.
Is there any command on cfg file to put an information to download this map when its loaded by server or by rcon?
and. how long will it take, to see my server on master list?
use the MANYMAPS packer, although there is quite a steep learning curve on that.
Master list: use libcod and dont block the stuff in iptables (or cracked executable), should make it show up quite fast.
Ej, huju o nicku rgl12, mуgłbyś przetłumaczyć poniższy cytat?
Dziękuję.
create a new screen session:
screen -AmdS namegoeshere
list all current screen sessions:
screen -ls
attach a running screen session:
screen -x namegoeshere
or
screen -x numbergoeshere (see screen -ls)
detach from a screen session:
press ctrl+a, then ctrl+d
Once you’ve created a new screen session, attach to it, start your server in there instead. Detach (or close the putty window) and it should keep running.
Damn, I was 100% sure that the problems are over.
Today I’ve created a server on my friends server, and something is not right. Can You help me, please?
root@TeamSpeak:/home/cod2server# ./cod2_lnxded_1_3_cracked +exec dedicated.cfg CoD2 MP 1.3 build linux-i386 Jun 23 2006
—— FS_Startup ——
Current language: english
Current search path:
/root/.callofduty2/main
/home/cod2server/main/zzz_nodustmod_bynikolas.iwd (32 files)
/home/cod2server/main/time_toujanenight.iwd (12 files)
/home/cod2server/main/mp_warsaw.iwd (16 files)
/home/cod2server/main/mp_tigertown_lib.iwd (87 files)
/home/cod2server/main/mp_powcamp.iwd (22 files)
/home/cod2server/main/mp_omaha.iwd (19 files)
/home/cod2server/main/mp_nightshift.iwd (1434 files)
/home/cod2server/main/mp_neuville.iwd (72 files)
/home/cod2server/main/mp_bastogne.iwd (36 files)
/home/cod2server/main/iw_15.iwd (85 files)
/home/cod2server/main/iw_14.iwd (4038 files)
/home/cod2server/main/iw_13.iwd (22624 files)
/home/cod2server/main/iw_12.iwd (1016 files)
/home/cod2server/main/iw_11.iwd (1462 files)
/home/cod2server/main/iw_10.iwd (1936 files)
/home/cod2server/main/iw_09.iwd (2142 files)
/home/cod2server/main/iw_08.iwd (2723 files)
/home/cod2server/main/iw_07.iwd (3384 files)
/home/cod2server/main/iw_06.iwd (990 files)
/home/cod2server/main/iw_05.iwd (928 files)
/home/cod2server/main/iw_04.iwd (698 files)
/home/cod2server/main/iw_03.iwd (26 files)
/home/cod2server/main/iw_02.iwd (40 files)
/home/cod2server/main/iw_01.iwd (16 files)
/home/cod2server/main/iw_00.iwd (102 files)
/home/cod2server/main
/root/.callofduty2/raw
/root/.callofduty2/raw_shared
/root/.callofduty2/devraw
/root/.callofduty2/devraw_shared
/home/cod2server/raw
/home/cod2server/raw_shared
/home/cod2server/devraw
/home/cod2server/devraw_shared
File Handles:
———————-
83363 files in iwd files
execing default_localize_mp.cfg
couldn’t exec language.cfg
execing config_mp_server.cfg
Opening IP socket: localhost:28960
Hostname: TeamSpeak
IP: 80.211.219.240
— Common Initialization Complete —
execing dedicated.cfg
net_ip is write protected.
net_port is write protected.
dedicated is read only.
map_rotate.
«sv_mapRotation» is:»gametype dm gametype tdm map mp_toujane map mp_carentan map mp_railyard «
Источник