7/12/12

Montando Servidor COD4 en Linux

Que tal el dia hoy les mostrare una forma sencilla de levantar un server de COD4 en linux para esto se puede ocupar cualquier distro yo en particular usare CentOS 6.3, por que CentOS pues por que planeo realizar varios proyectos en esta distro que poco apoco compartiré con ustedes.


     Bueno empecemos primero que nada tenemos que bajar el server cod4 de linux lo pueden buscar googleando y poniendo lo siguiente cod4-linux-server-06282008.tar.bz2  lo bajan de la pagina que gusten ( pondré un link al final del post por si acaso ) recuerden la versión actual del juego es la 1.7 asi ke ojo cual bajan.

    Lo sigueinte sera abrir una terminal y crear la carpeta donde instalaremos el server para eso tecleamos lo siguiente
#mkdir /cod4sr       esto es para crear la carpetaa

despues copiamos el archivo que bajamos a la carpeta seria de la siguiente forma

#cp cod4-linux-server-xxxx.tar.bz2 /cod4sr

una vez hecho esto ingresamos a la carpeta cod4sr y descomprimimos el archivo del server

#cd /cod4sr
#tar -xvjf cod4-linux-server-xxxx.tar.bz2

esto nos creara una carpeta cod4-linux-server
ahora tenemos que introducir el cd-rom del juego o si lo tenemos en iso abrir el iso y copiar el contenido de
setup/data a la carpeta creada despues de la descompresion

lo hacemos de la siguiente manera
#mount /dev/cdrom /media/cdrom
#cp -R /media/cdrom/Setup/Data/* /cod4sr/cod4-linux-server
esto es si metemos el cd-rom si es iso pues copiamos de la forma tradicional en modo grafico
NOTA: a mi me paso que me tiraba error cuando me keria conectar me decia que algunos archivos eran diferentes, si les pasa esto copian la carpeta ZONE del DVD del juego y reemplazan todo.

lo siguiente es instalar el punkbuster y levantar el servicio yagregamos el cod4 al punkbuster
entramos a la carpeta
#cd /cod4sr/cod4-linux-server/
#./pbsetup.run -e
#./pbsetup.run --add-game=cod4 --add-game-path=/cod4sr/cod4-linux-server/
#./pbsetup.run -u

ojo se tienen que bloquear la salida por los puertos en el firewall del sistema (creo que son 20500,20800,20810 tcp y udp por las dudas), para que el server no chequee las keys contra la base de datos oficial de activision, de lo contrario no podran entrar clientes con key pirata.

y tienen que abrir los puertos 28960 y 28000 al 28100 para que puedan entrar en el server los players

ahora iniciamos el server del cod4 ejecutando lo siguiente
#./cod4_lnxded
cuando aparezca --- Common Initialization Complete --- quiere decir que el servidor se esta ejecutandoo
ahora ya podemos empezar a personalizar nuestro servidor

si quieren pueden utilizar el siguiente archivo de configuracion solo lo copian aun editor de texto y lo guardan en la carpeta main del juego con el nombre server.cfg

//**************************************
//Server Security
//**************************************
//Log Settings
set g_logsync "2" //0=Disabled, 1=Buffered, 2=Continuous, 3=Append
set logfile "1" //0=Disabled, 1= Enabled
set g_log "games_mp.log" //The name of the game log file
set sv_log_damage "1" //0=Disabled, 1=Enabled
//Network Options
set net_ip "XXX.XXX.XXX.XXX" //Your server IP address
set net_port "28960" //Your server port address
set com_hunkMegs "512"
set net_noipx "1" // Allow ONLY tcp/ip protocol, player/server communications
set dedicated "2" // 0=Listen, 1=LAN, 2=Internet
//Passwords
set rcon_password "XXXXXXXXX"
set sv_privatePassword ""
set g_password ""
//**************************************
//Server Info
//**************************************
set sv_hostname "NOMBRE DEL SERVER"
set _Admin "TU NOMBRE"
set _Website "TU WEB"
set _Location "AR"
set _Irc "" //Can not be set by RconMax(MW) at this time
set _Mod "" //Can not be set by RconMax(MW) at this time
set _ModVer "" //Can not be set by RconMax(MW) at this time
set _ModUpdate "" //Can not be set by RconMax(MW) at this time
set _Maps ""
//**************************************
//Other Server Dvars
//**************************************
//Reserved Slots
set sv_privateClients "0"
set g_antilag "1"
set g_compassShowEnemies "0"
//Client Downloads
set sv_allowdownload "1" //Can not be set by RconMax(MW) at this time
set sv_wwwDownload "0" //Can not be set by RconMax(MW) at this time
set sv_wwwBaseURL "" //Can not be set by RconMax(MW) at this time
set sv_wwwDlDisconnected "0" //Can not be set by RconMax(MW) at this time
//Server Packet Rate
set sv_maxRate "5000"
//FPS
set sv_fps "20" //Can not be set by RconMax(MW) at this time
//Limit Laggers and reconnect spammers
set sv_minPing "0"
set sv_maxPing "350"
set sv_floodProtect "1"
set sv_reconnectlimit "3"
//Anti Cheat
set sv_punkbuster "0"
set sv_allowAnonymous "0"
set sv_disableClientConsole "1"
set sv_cheats "0" //Can not be set by RconMax(MW) at this time
set sv_disableClientConsole "0" //Can not be set by RconMax(MW) at this time
set sv_pure "1"
set g_banIPs "" //Can not be set by RconMax(MW) at this time
set g_no_script_spam "1" //Can not be set by RconMax(MW) at this time
//Temp ban duration
set sv_kickBanTime "3600"
//Voting
set g_allowvote "1"
set g_allowVoteMap "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteMapRestart "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteMapRotate "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteTypeMap "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteDrawFriend "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteFriendlyFire "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteKillCam "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteKick "1" //Can not be set by RconMax(MW) at this time
set g_allowVoteTempBanUser "1" //Can not be set by RconMax(MW) at this time
//**************************************
//Gameplay Settings
//**************************************
//General
set scr_game_allowkillcam "1"
set scr_game_onlyheadshots "0"
set scr_game_deathpointloss "0" //Can not be set by RconMax(MW) at this time
set scr_game_suicidepointloss "0" //Can not be set by RconMax(MW) at this time
set scr_team_teamkillpointloss "0" //Can not be set by RconMax(MW) at this time
set scr_game_spectatetype "1" //0=Disabled, 1=Team Only, 2=Free
set scr_game_forceuav "0"
//Hardpoints
set scr_game_hardpoints "0"
set scr_hardpoint_allowartillery "0"
set scr_hardpoint_allowuav "0"
set scr_hardpoint_allowhelicopter "0"
//Teams
set scr_team_fftype "0" //0= Disabled, 1=Enabled, 2=Reflect, 3=Shared
set scr_team_teamkillspawndelay "20" //Can not be set by RconMax(MW) at this time
set scr_team_kickteamkillers "3" //Can not be set by RconMax(MW) at this time
//Player
set scr_player_maxhealth "100" //Can not be set by RconMax(MW) at this time
set scr_player_suicidespawndelay "0" //Can not be set by RconMax(MW) at this time
set scr_player_healthregentime "5" //Can not be set by RconMax(MW) at this time
set scr_player_forcerespawn "1" //Can not be set by RconMax(MW) at this time
set scr_player_sprinttime "5" //Can not be set by RconMax(MW) at this time
set scr_hardcore "0"
set scr_oldschool_mw "0"
set ui_hud_obituaries "1" //Can not be set by RconMax(MW) at this time
set ui_hud_showobjicons "1" //Can not be set by RconMax(MW) at this time
//Voice
set sv_voice "1"
set sv_voiceQuality "1"
//**************************************
//Game Type Settings
//**************************************
//Deathmatch
set scr_dm_scorelimit ""
set scr_dm_timelimit ""
set scr_dm_playerrespawndelay ""
//Domination
set scr_dom_scorelimit ""
set scr_dom_timelimit ""
set scr_dom_playerrespawndelay ""
//Teamdeath Match
set scr_war_scorelimit ""
set scr_war_timelimit ""
set scr_war_playerrespawndelay ""
//Sabotoge
set scr_sab_scorelimit ""
set scr_sab_timelimit ""
set scr_sab_roundswitch ""
set scr_sab_bombtimer ""
set scr_sab_planttime ""
set scr_sab_defusetime ""
set scr_sab_hotpotato ""
set scr_sab_playerrespawndelay ""
//King Of The Hill (HQ)
set scr_koth_scorelimit ""
set scr_koth_timelimit ""
set koth_spawntime ""
set koth_autodestroytime ""
set koth_kothmode "1"
set koth_capturetime ""
set koth_destroytime ""
set koth_delayPlayer ""
set koth_spawnDelay ""
//Search And Destroy
set scr_sd_scorelimit ""
set scr_sd_timelimit ""
set scr_sd_roundswitch ""
set scr_sd_numlives "" // Elimination
set scr_sd_bombtimer ""
set scr_sd_planttime ""
set scr_sd_defusetime ""
set scr_sd_playerrespawndelay ""
set scr_sd_multibomb "0" //Every player on the attacking team has a bomb
//**************************************
//Gameplay Dvars
//**************************************
//Team icons
set scr_drawfriend "1" //Can not be set by RconMax(MW) at this time
set scr_teambalance "0"
//**************************************
//Map rotation
//**************************************
//First gametype to load
//dm = Death Match / Free For All
//dom = Domination
//koth = King Of The Hill / Head Quarters
//sab = Sabotage
//sd = Search And Destroy
//war = Team Death Match / War
set g_gametype "dm"
set sv_mapRotation "gametype dm map mp_convoy gametype dm map mp_backlot gametype dm map mp_bloc gametype dm map mp_bog gametype dm map mp_broadcast gametype dm map mp_carentan gametype dm map mp_countdown gametype dm map mp_crash gametype dm map mp_creek gametype dm map mp_crossfire gametype dm map mp_citystreets gametype dm map mp_farm gametype dm map mp_killhouse gametype dm map mp_overgrown gametype dm map mp_pipeline gametype dm map mp_shipment gametype dm map mp_showdown gametype dm map mp_strike gametype dm map mp_vacant gametype dm map mp_cargoship gametype dm map mp_crash_snow "
set sv_maprotationcurrent ""



Cambien los parametros que estan en mayuscula con sus datos.

ejecutamos de nuevo el server ahora con unos parametros mas
#./cod4_lnxded +set sv_pure 1 +set dedicated 2 + +map_rotate +exec server.cfg

abren su cod4 multiplayer y deberia conectarlos y poder jugar para detener el server colocan ctrl + c

lo siguiente pueden realizarlo es un script para crear un demonio lo pueden llamar cod4



#!/bin/sh
HLDS_HOME=/home/compartida/cod4
IP=XXX.XXX.XXX.XXX
PORT=28960
PASS="XXXXXX"
case "$1" in
start)
# Start daemon
echo -n "Iniciando Servidor Call of Duty 4: "
cd $HLDS_HOME
screen -A -m -d -S cod4 ./cod4_lnxded +set sv_pure 1 +set sv_punkbuster 1 +set dedicated 2 + +map_rotate +exec server.cfg
echo
;;
stop)
# Stop daemon
echo -n "Deteniendo Servidor Call of Duty 4: "
cd $HLDS_HOME
screen -r cod4 -X quit
echo
;;
restart)
$0 stop
$0 start
;;
status)
echo -n "Estado Servidor Call of Duty 4: "
echo
cd $HLDS_HOME
./qstat -P -q3s $IP:$PORT
echo
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0


cambian los parametros que estan en mayuscula por los suyos

Copiar el archivo a /etc/init.d/
# cp cod4 /etc/init.d

usos del script:
# /etc/init.d/cod4 start
# /etc/init.d/cod4 status
# /etc/init.d/cod4 stop
# /etc/init.d/cod4 restart
 
eso es todo espero se diviertan con su server

link del servercod4linux http://au1cdn.ausgamers.com/downloads/1354906867/cod4-linux-server-06282008.tar.bz2

los creditos para ellos =) que tengan un buen dia 

1 comentario:

  1. esto aplica para cualquier otro videojuego por ejemplo esos de los q ya no hay servers oficiales ???...

    ResponderEliminar