Table of Contents
Left 4 Dead 2 server quick start
Note: if using modern Ubuntu or Debian 32-bit, first do: sudo apt-get install lib32gcc1
Auto-install script
wget -c http://storefront.steampowered.com/download/hldsupdatetool.bin || exit chmod +x hldsupdatetool.bin || exit ./hldsupdatetool.bin || exit test -e go || cat <<EOL > go export RDTSC_FREQUENCY=2500.000000 cd left4dead2 ./srcds_run l4d -autoupdate +hostport 27015 +ip 0.0.0.0 +exec server.cfg EOL chmod +x go mkdir -p left4dead2/left4dead2/cfg ln -s left4dead2/left4dead2/cfg/server.cfg . ln -s left4dead2/left4dead2/motd.txt . ln -s left4dead2/left4dead2/host.txt . cat <<EOL > server.cfg hostname "ZOMBONI 9003" rcon_password "XXXXX" z_difficulty "advanced" sv_region 0 sv_gametypes "coop, versus, survival, scavenge" sv_allow_lobby_connect_only 0 EOL echo './steam -command update -game left4dead2 -dir .' > update chmod +x update ./update ; ./update
Manual install and config
Get steam:
wget http://storefront.steampowered.com/download/hldsupdatetool.bin chmod +x hldsupdatetool.bin ./hldsupdatetool.bin
Install:
./steam -command update -game left4dead2 -dir .
Three useful files:
left4dead2/left4dead2/cfg/server.cfg -- Server config (doesn't exist by default) left4dead2/left4dead2/motd.txt -- Message of the day (either text, or a URL to a page) left4dead2/left4dead2/host.txt -- Banner for the server (a URL to HTML that fills banner-like dimensions)
Launch script:
export RDTSC_FREQUENCY=2500.000000 cd left4dead2 ./srcds_run l4d -autoupdate +hostport 28015 +ip 0.0.0.0 +exec server.cfg
Sample server.cfg (locks the server down to so it can only be requested directly (see below)):
hostname "ZOMBONI 9003" rcon_password "XXXXX" z_difficulty "advanced" sv_region 0 sv_gametypes "coop, versus, survival, scavenge" sv_allow_lobby_connect_only 0
Private server
By default, the server will be open to all comers. The "sv_allow_lobby_connect_only 0" in the server config above prevents this. To allow YOU to use it, use the "mm_dedicated_force_servers" console command before hitting "go" in the game lobby. This command supports IP addresses only (no hostnames). Example:
mm_dedicated_force_servers 100.102.104.106:27015
To avoid having to type this, you can add a key bind to your game to set it. Edit "steamapps\common\left 4 dead 2\left4dead2\cfg\config.cfg
" and add the line:
bind "F12" "mm_dedicated_force_servers 100.102.104.106:27015"
Then, in game, just hit F12 any time to make the game use your server.
Addons
Script to update the addons list when new addons are introduced ("remake-addonlist.pl"):
#!/usr/bin/perl use strict; my $addonlist = "left4dead2/left4dead2/addonlist.txt"; my $addondir = "left4dead2/left4dead2/addons"; rename($addonlist,"$addonlist.old"); open FP, "> $addonlist" or die "$addonlist: $!\n"; print FP <<EOL; "AddonList" { EOL my $n=0; print "Writing addon list...\n"; for (glob("$addondir/*.vpk")) { s#.*/##; print FP qq( "$_" "1"\n); print "- $_\n"; $n++; } print FP "}\n"; close FP; print "Wrote $n addons.\n";