In this guide, I'll explain how to install and configure a L4D server on CentOS 7.
Before we get started, we have to make sure that the system is up-to-date and secure. We'll also need to create a new user for the server. When prompted, specify a strong, secure password for this user.
yum update yum upgrade -y adduser l4d passwd l4d
The necessary firewall ports required by Left 4 Dead have to be opened, so let us do that before we move on.
firewall-cmd --zone=public --add-port=27015/tcp --permanent firewall-cmd --zone=public --add-port=27015/udp --permanent firewall-cmd --reload
The required system libraries needed to run SteamCMD have to be installed.
yum install glibc.i686 libstdc++.i686 -y
Switch to the user account that we created earlier.
su l4d cd ~
Download the SteamCMD software.
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz tar xf steamcmd_linux.tar.gz
Up next, we have to use SteamCMD to install the game server files.
./steamcmd.sh +login anonymous +force_install_dir ./l4d +app_update 222840 validate +quit
When the screen reads
Success! App '222840' fully installed., the server has been installed.
Server customization is done by editing the
server.cfg with the following text. Be sure to change
RconPassword to your desired server name and rcon password (server admin).
hostname "ServerName" rcon_password RconPassword
Create the file
update_l4d.txt in the users home directory.
Populate that file with the following contents.
login anonymous force_install_dir ./l4d app_update 222840 quit
Update your server any time by running the following command.
cd ~ && ./steamcmd.sh +runscript update_l4d.txt
To start your server, run the following commands.
cd /home/l4d/l4d/ screen -dmS l4d ./srcds_run -console -game left4dead -port 27015 +map l4d_farm04_barn +maxplayers 4 +exec server.cfg
The server is now running in a background
To shut down the server, run the following command.
screen -S l4d -X quit
Enjoy your new Left 4 Dead server!