Results 1 to 1 of 1

Thread: Complete Linux Server Setup Guide

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.567
    Blog Entries
    12
    Rep Power
    10

    Default Complete Linux Server Setup Guide

    Creating a Counter-Strike: Source/Half-Life 2: Deathmatch Server
    Linux Setup Guide
    - By Plasma

    Step 1
    Create a folder called srcds_l (Thats a lower case L for linux!), usually done in your home directory, where you want to base your server installation and have all content stored.

    Step 2
    Grab hldsupdatetool and put it in your srcds_l directory you just created.

    Code:
    Step 3
    Make the hldsupdatetool executable via chmod.

    Code:
    Code:
    chmod +x hldsupdatetool.bin
    Step 4
    Run hldsupdatetool - This just extracts our steam client.

    Code:
    Code:
     
    ./hldsupdatetool.bin
    Say YES to agree to the following license prompt and your done.

    Step 5
    Now we will run the Steam client to download the game content.

    Two game types are available:

    For CS: Source, its: "Counter-Strike Source"
    For HL2: Deathmatch, its: "hl2mp" (HL2 Multiplayer, not HL2DM).

    To download CS: Source data files for a CS: Source server, type:

    Code:
    Code:
     
    ./steam -command update -game "Counter-Strike Source" -dir .
    Hit ENTER and you should begin downloading the Counter-Strike Source data files in this directory (~/srcds_l).

    This may take a while.

    Note: Contrary to what typing ./steam on its own indicates, you DO NOT need to specify OR create a Steam account to download/update your servers.
    This was originally a requirement but Valve have since removed it, and the help information has just not been removed from the Linux Steam client.

    Once its finished, you will be able to then launch your dedicated server, this will create our initial config file and test everything is ok.

    Step 6
    Launching a dedicated server. We will launch a server with no determined config to see if everything was successful, and to create an initial config file in cstrike/cfg/server.cfg

    Using our example from Step 5, to launch a CS: Source server you type:

    Code:
    Code:
     
    ./srcds_run -console -game cstrike -port 27015 +ip 123.123.123.123 +map de_dust +maxplayers 14
    Replace 'cstrike' in the above launch command with 'hl2mp' (MP! Not DM) to launch a HL2 Deathmatch server.

    Be sure to replace 123.123.123.123 with the EXTERNAL IP you want your server to bind to, not the servers Internal/LAN IP.

    Congradulations, your server should now be running!

    Step 7
    Edit your server configuration to your liking in cstrike/cfg/server.cfg
    If it does not exist, create it.

    Note: Read the following post in this thread if you would like to know how to setup multiple servers on the same host.

    Additionally, you may want to launch your server as follows:

    Code:
    Code:
     
    screen -S css ./srcds_run -console -game cstrike -port 27015 +ip 123.123.123.123 +map de_dust +maxplayers 14
    To place the server in a screen session you may detach from once its launched, or place the line in start_server.sh and exeucte it from the command line.

    Step 8
    Once your all set, in the event a Steam/game update has been released, you will need to update your hlds installation.
    To do this, simply run the command we used in Step 5 to initially download our content:

    Code:
    Code:
     
    ./steam -command update -game "Counter-Strike Source" -dir .
    This will update all files if needed in your installation directory to their latest versions.

    Adding a cronjob for this command may be wise so you do not have to constantly remember to update your servers, and that they would be up to date within 24 hours of an update if scheduled to run daily.


    ---------------------------------------------------------------------------------------------------------------------

    * Multiple Server Setup Guide *






    If you would like to support multiple servers/configs running on the same host, there are a few things you need to do:
    1. Launch each server on a separate port, this should be done 20 ports higher than the previous server.
      So if we have server 1 on port 27015, the next one should use port 27035.
    2. Have our server use separate configuration files (This includes server config and mapcycle/motd files, if desired).
    Introduction
    We are going to create in this example two servers. Server one will be called 'Example #1 - Dust Only' which will only run the popular Dust map, and server 2, 'Example #2 - All Maps', which will run every map in our rotation.
    Each of these two servers will have a different map rotation and configuration file, and both will be running CS: Source.
    To have this guide work for hl2 deathmatch servers, simply replace references to 'cstrike' with 'hl2mp'.

    Important: You must either DELETE cstrike/cfg/server.cfg from your servers game directory in order for this setup to work correctly, OR, have the files contents only contain:


    Code:
    Code:
     
    exec banned_ip.fgexec_banned_user.cfg
    Or any other generic commands that would be executed on all servers.

    This is because server.cfg is executed on every map change by srcds, and you cannot tell srcds NOT to execute the file, so to prevent settings in this file overwriting our multiple server config files, we either delete the file itself, or just leave the banned commands in (so the banlists are executed on map change).

    It is best to just erase the file and leave:


    Code:
    Code:
    exec banned_user.cfgexec banned_ip.cfg
    In the file, so any changes to the banfile contents will be re-read on map change if the contents are changed.

    It is also safe to simply delete this file, but you will not have the benefit of the banned list files being re-read on each map change.

    Step 1
    If not already done, delete cstrike/cfg/server.cfg

    Step 2
    Now we create server 1's configuration file. Create a new file called server1.cfg in cstrike/cfg (So its accessable in cstrike/cfg/server1.cfg).

    Heres what it looks like in our example:
    Items in bold you should take note of, as you should change these values in each config file you make for multiple servers.


    Code:
    Code:
    // server name
    hostname "Example #1 - Dust Only"
     
    // server admin (rcon) passsword
    rcon_password "adminpass"
     
    // server join password
    sv_password ""
     
    // Advanced RCON
    sv_rcon_banpenalty 15
    sv_rcon_maxfailures 5
    sv_rcon_minfailures 5
    sv_rcon_minfailuretime 30
     
    // server cvars
    mp_footsteps 1
     
    // only allow 1 player difference between teams
    mp_limitteams 1
    mp_autoteambalance 1
     
    mp_autokick 0
    mp_flashlight 1
    mp_tkpunish 1
    mp_forcecamera 0
    sv_alltalk 0
    sv_pausable 0
    sv_cheats 0
    sv_consistency 1
    sv_allowupload 1
    sv_allowdownload 1
    sv_maxspeed 320
    mp_limitteams 2
    mp_hostagepenalty 5
    sv_voiceenable 1
    mp_allowspectators 1
    mp_chattime 10
    sv_timeout 65
     
    // round specific cvars
    mp_freezetime 4
    mp_timelimit "25"
     
    mp_roundtime "3"
    mp_maxrounds "20"
    mp_startmoney "800"
    mp_c4timer "45"
    mp_fraglimit 0
    mp_maxrounds 20
    mp_winlimit "10"
    mp_playerid 0
    mp_spawnprotectiontime 5
    mp_friendlyfire "0"
     
    // bandwidth rates/settings
    sv_minrate 3000
    sv_maxrate 20000
    decalfrequency 60
    sv_maxupdaterate 100
    sv_minupdaterate 30
     
    // server logging
    sv_logbans 1
    sv_logecho 1
    sv_logfile 1
    sv_log_onefile 0
     
    //Specify that we want this specific servers logs placed in a folder called logs/server1
    //to separate them from another servers logs
    sv_logsdir "logs/server1"
    log 1
     
    // operation
    sv_lan 0
    // region the server should appear in under the steam browser
    sv_region 0
    sv_contact "www.example.com"
     
     
    // map cycle for this server
    mapcyclefile "mapcycleserver1.cfg"
     
    // motd file for this server
    // Note: You could simply have this as motd.txt in all config files, so that all servers share the same config file
    // This is just an example so you know how to specify individual ones if necessary
    motdfile "motdserver1.txt"
     
     
    // execute our banned suer files
    exec banned_user.cfg
    exec banned_ip.cfg
     
     
    // launch our starting map, in this case, de_dust
    map de_dust







    To review our first servers config file, we have set it up as to have:
    1. A hostname of "Example #1 - Dust Only" Place all log files for this server in the folder logs/server1 (If this directory does not exist at runtime, it will be created by srcds) Use the map cycle listed in cstrike/mapcycleserver1.cfg
      Note: Its cstrike/ not cstrike/cfg/ for map cycles and motd files)[/b] Use a MOTD (Message of the Day, the welcome screen you get when joining your server) in cstrike/motdserver1.txt (Once again, cstrike/ not cstrike/cfg/ for this file)
    2. And launch our starting map, cs_office
    Next, we create this servers map cycle and message of the day screen.

    Create cstrike/mapcycleserver1.cfg (As per our config file we just made) and in it we would have:

    Code:
    Code:
    de_dust
    Just one map name to cycle through, since this is our dust only server.

    Next, create our MOTD file in cstrike/motdserver1.txt

    Code:
    Code:
    Welcome to my 24/7 Dust only server!
    You can use simple text based MOTDs as above, or use HTML code to create web based MOTDs.

    Code:
    Code:
    <html><b>Welcome to my 24/7 Dust only server!</b></html>
    Obviously you would use something more creative here and easier on the eye, you can include all forms of html formatting tags (tables, divs, background colours etc).

    Alternativly, you can specify a URL in the MOTD file on its own line as follows:


    Code:
    And CS: Source/HL2: DM will actually load the file from that address given and display it to the user, so you can update your MOTD externally from your servers.

    Step 3
    Time to launch our newly created server.

    To confirm the directory and file structure, you should have:
    ~/srcds_l/srcds_run
    ~/srcds_l/steam
    ~/srcds_l/cstrike/motdserver1.txt
    ~/srcds_l/cstrike/mapcycleserver1.cfg
    ~/srcds_l/cstrike/cfg/server1.cfg

    Notice how only the server configuration file is in the /cfg folder, the other two files reside in the /cstrike folder.

    To launch our server, now type from ~/srcds_l:

    Code:
    Code:
    ./srcds_run -console -game cstrike -port 27015 +ip 123.123.123.123 +map de_dust +maxplayers 14 +exec server1.cfg
    Our command line has the following parameters:

    Code:
    Code:
    -console
    --> Enable console mode/view
    
    -game cstrike
    --> Which game we are making a server for (cstrike or hl2mp)
    
    -port 27015
    --> Which port this server should be accessable on. We are using the default of 27015 for our first server.
    
    +ip 123.123.123.123
    --> Bind IP Address of this server. This should be your external IP Address, not LAN address.
    --> Having this set incorrectly could cause people not being able to join your server, or have 'RCON Not working' via HLSW or ingame console (Connection refused errors).
    
    +map de_dust
    --> Which map to start the server on, we already have this defined in our config file, but we do it again in the command line for good measure.
    
    +maxplayers 14
    --> How many players may join this server.
    
    +exec server1.cfg
    --> The almighty configuration file for this server, we tell srcds to execute this file on startup and load the servers settings.
    Your dedicated server should now be operational.

    To create our second server, we would repeat the above steps, but instead of creating motdserver1.txt, mapcycleserver1.cfg and server1.cfg, we would call the files motdserver2.txt, mapcycleserver2.cfg and server2.cfg

    Then, we would launch the server like so:

    Code:
    Code:
    ./srcds_run -console -game cstrike -port 27035 +ip 123.123.123.123 +map de_dust +maxplayers 14 +exec server2.cfg
    There are two important changes in this command line for our second server.
    The -port command now has a parameter of 27035 (thats 20 ports higher than our first server, 27015).
    You cannot simply have the next server one port higher, as srcds uses several ports higher for other services than its game port. 20 ports is a safe number to use.

    Secondly, we now have +exec server2.cfg, telling the server to execute server2's configuration file, loading a different set of preferences and settings, map rotation and motd file.

    To setup the second server, our configuration file would be the same as server1's except we would change the hostname, sv_logsdir, mapcyclefile and motdfile variables to accomodate a different set of settings.

    In our mapcycle file for server 2, instead of listing just de_dust (which was our mapcycle for server #1's 'Dust only' server), we would list all of the maps on a new line such as:

    Code:
    Code:
    de_dustde_portcs_office...etc
    Once the server reaches the end of the rotation, it starts from the top again.

    Thats all!
    I hope this guide has been helpful.
    Last edited by siosios; 03-15-2009 at 06:52 PM. Reason: Automerged Doublepost
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Similar Threads

  1. How-to detect a possible intruder ¿? (Linux Server)
    By siosios in forum Server Tech Talk
    Replies: 0
    Last Post: 12-08-2008, 06:27 PM
  2. Replies: 0
    Last Post: 12-08-2008, 06:16 PM
  3. COD4 dedicated server setup (notes for siosios)
    By siosios in forum Server Tech Talk
    Replies: 0
    Last Post: 12-08-2008, 06:02 PM
  4. How-to detect a possible intruder ¿? (Linux Server)
    By siosios in forum Server Tech Talk
    Replies: 1
    Last Post: 11-16-2008, 04:46 PM
  5. Replies: 0
    Last Post: 09-01-2008, 10:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •