Newbie Hlds/ns Linux Server Guide

24

Comments

  • Say_TenSay_Ten Join Date: 2002-11-10 Member: 8003Members
    Yes you need it. You can get an application called "unzip" for linux. I use FreeBSD so I installed it from the ports so I don't know it's official site.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    Next question;

    Since most of the links on the download page go directly to ns_install_v1.exe where can I find the 1.03 patch? A sticky with links would help <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    edited November 2002
    <!--QuoteBegin--[F.o.R]Slappy+Nov 15 2002, 03:29 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> ([F.o.R]Slappy @ Nov 15 2002, 03:29 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Let me add to this another problem we've been seeing a lot of.

    If you get the "LoadLibrary failed on ***/hlds_l/ns/dlls/ns_i386.so: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory" error, look for a file named libstdc++-libc6.1-2.so.3 in your lib directory. If you find that make a symlink to it, i.e. ln -sf libstdc++-libc6.1-2.so.3 libstdc++-libc6.1-1.so.2.

    -Slappy<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    I am getting this error


    LoadLibrary failed on /home/chaos/halflife/hlds_l/ns/dlls/ns_i386.so: libstdc++-
    libc6.1-1.so.2: cannot open shared object file: No such file or directory
    Host_Error: Couldn't get DLL API from /home/chaos/halflife/hlds_l/ns/dlls/ns_i38
    6.so!
    FATAL ERROR (shutting down): Host_Error: Couldn't get DLL API from /home/chaos/h
    alflife/hlds_l/ns/dlls/ns_i386.so!


    How exactly do I do what you are talking about? I am a Linux newbie

    update I dont have those lib files..
    only these

    libc-2.2.5.so
    libc.so.6
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    The 1.03 server files can be found on the front page of the Natural-Selection (http://www.natural-selection.org) website. I believe this also takes care of the issue having to do with the library incompatibilities.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    nope I installed the patch before I got this error
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    Go here: <a href='http://at.rpmfind.net/opsys/linux/RPM/libstdc++-libc6.1-1.so.2.html' target='_blank'>http://at.rpmfind.net/opsys/linux/RPM/libs...6.1-1.so.2.html</a>

    Click on your linux distribution. On the top there should be a BIG link with the RPM file you need. Install that as root and it should fix your problem.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    edited November 2002
    Debian install...I dont believe I can use rpm packages. I use apt-get install blah blah

    happen to know the name for blah blah?

    Ive installed gcc and this is my lib dir

    (see attached)
    <a href='http://65.102.159.169/lib.html' target='_blank'>Lib Files</a>
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    well that was a flop here i will attach it
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    See this post:

    <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=7950&hl=debian' target='_blank'>http://www.unknownworlds.com/forums/in...=7950&hl=debian</a>

    If that doesn't work I don't know what to tell you. Maybe someone else will be able to help you because I run RedHat not Debian.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    That worked

    thankyou thankyou thankyou
  • SkWyReLSkWyReL Join Date: 2002-11-19 Member: 9360Members
    is there a way to make HLDS start w/ linux just like httpd or xinetd or the other services?

    .:SkWyReL:.
  • BrutusBrutus Join Date: 2002-10-20 Member: 1555Members
    What do you mean make it start? I use a script file that starts it so I don't have to do the long command line each time.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    I thinks he wants to know how to set up those script files so when his machine restarts it will start the server.In fact I could use that knowledge too since I may have to reboot someday <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    This is what I do to make sure my server stays up and running, even after the power goes out. Keep in mind I'm doing this from a RedHat 7.3 perspective but it should work on most Linux based servers. some of the stuff I have in my files is a carry over from old times that I haven't bothered to clean up. I say if it works, don't dork with it. You will have to modify my examples below to fit your particular setup.

    First up is an autoexec.cfg file which is stored in my ns folder. In it I have the following:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    //
    // autoexec.cfg
    //   Server setup configuration file. This file is automatically executed once,
    //   when the server is started.
    //

    //Location of the log files
    logsdir logs

    // Set up master servers to report to
    setmaster add master0.gamespy.com 28900
    setmaster add half-life.east.won.net 27010
    setmaster add half-life.west.won.net 27010
    setmaster add half-life.central.won.net 27010

    // maxplayers <number>
    //   Default: 6
    //   Sets how many players are allowed on the server at one time. The maximum is
    //   32 players. The more players you allow, the greater the upstream bandwidth
    //   you will require.
    maxplayers 13

    // log <on|off>
    //   Default: off
    //   Use this command to enable logging on the server. See also the Logging
    //   Settings in 'server.cfg'.
    log on

    // logaddress <ip> <port>
    //   Default: (none)
    //   If logging is enabled, this command allows log data to be sent to a remote
    //   address. The log data is transmitted as UDP data packets, which can be
    //   parsed by third-party applications. You can also set the logaddress to the
    //   IP and port of your Half-Life client and the log data will be displayed in
    //   the client console.
    //logaddress 127.0.0.1 27500

    // servercfgfile <filename>
    //   Default: "server.cfg"
    //   Sets the name of the configuration file which is executed at each map
    //   change.
    servercfgfile "server.cfg"

    //
    // Load Initial Map
    //   Here we load the first map that the server will run. Nobody can connect to
    //   the server until a map is loaded.
    //
    map ns_eclipse
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Next I set up a shell script called "ns" that I store in my home directory. To create this file I do the following command:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    touch ns
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Then I make it executable by changing the mode:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    chmod 755 ns
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Then I "vi ns" to edit it and put in the following (modify as needed):

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    #!/bin/sh
    cd /home/nshlds/hlds_l
    export LD_LIBRARY_PATH=/home/nshlds/hlds_l:$LD_LIBRARY_PATH

    screen -A -m -d -S ns ./hlds_run -game ns -pingboost 1 +ip xxx.xxx.xxx.xxx
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Now you need a script to automatically check to see if your server is running and if not, restart it. You will need to "touch" this file and make it executable like described above. I call this file "hldsrestart.sh" In this file I have the following (modify as needed for your setup):

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    #!/bin/sh

    if [ $( ps -aux | grep -v grep | grep -c "./hlds -game ns") = 0 ];

    then

    cd /home/nshlds/
    ./ns

    fi
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Basically what it does is run the process list command, removes any lines containg "grep" and then counts the number of occurances of "./hlds -game ns" that it finds. Then if that number is equal to "0" run the ns script. Hopefully that makes sense.

    Now, you probably want to run this script every so often just to make sure your server is still alive. To do this you'll use a tool called "crontab". Crontab is a schedualling tool and it is very powerful. It's sorta like task schedualer in Windows with the exception that it actually works <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo--> To edit your crontab you would do the following:

    At the command prompt (you are logged in as your user not as root, right?) you would type:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    crontab -e
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    You will then have a screen that looks an awful lot like "vi". Hit your "i" key to turn on insertion mode and then type in (remember to modify the paths to where your files actually are):

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    */5 * * * * /home/nshlds/hldsrestart.sh
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Once you have that in there, do a shift ZZ to save and close the file. It will say something like "Installing new crontab" breifly before giving your prompt back. What this does is every 5 minutes it runs the file called hldsrestart.sh. hldsrestart.sh then goes through the check to make sure that the server is up, if it isn't it calls the "ns" script to restart the server using screen.

    Vadakill
  • GrimAdminGrimAdmin Join Date: 2002-12-11 Member: 10565Members
    Well, using a crontab entry like that is a cheap kludgy hack to keep the server running.

    The real way to do it is to edit your init scripts to launch hlds_run.

    To do so varies highly depending on your distribution. Assuming you are running SysV init, (which I'm not, and it's been a while science I was messing with init...):
    1) look in /etc and find the folders for your various runlevels (/etc/rc[0-9].d) or for debian if my memory is right). This will be full of symlinks with names like S09[name].
    2) determine your current/default runlevel. your default runlevel is set in /etc/inittab
    3) add the correct symlink to the correct runlevel's directory to run the script that will start the seve
    4) restart init and the sever should start.

    If you run KDE, there is a GUI to help edit your init scripts.

    I suggest checking man pages for init on your system before messing around with this.
  • ChAoSChAoS Join Date: 2002-11-10 Member: 8140Members
    edited December 2002
    Doesnt the server restart itself in the event of a crash when running on Linux? Or is that just CS?
  • GrimAdminGrimAdmin Join Date: 2002-12-11 Member: 10565Members
    In the Linux hlds install, there is an execuatable binary called "hdls" which is the server itself. there is also a file "hlds_run" that is a small Bourne shell script that will starts the server and restarts it when it dies.
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    GrimAdmin, could you please do a small write up on how to edit the initab to launch a NS server? The more examples of code, both command line and file editing, you put in the better. This would give begining admins a chance to learn something useful for other applications. I know kludgy scripting admins like myself would appreciate it!
  • GrimAdminGrimAdmin Join Date: 2002-12-11 Member: 10565Members
    I'll try and get around to it...

    it will be a while, finals are next week, and I don't currently have a debain or RH box running...
  • PhalckPhalck Join Date: 2002-06-03 Member: 722Members
    edited December 2002
    This post is a comment on Vadakills excellent previous post (on page 3) on how to get ns to restart when it crashes.

    This line to be exact:
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->At the command prompt (you are logged in as your user not as root, right?) you would type:

    [CODE]  

    crontab -e

    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    [/CODE]

    I TOTALLY agree with Vadakill and would really NOT suggest to run hlds as root. I know that there has not been any exploits for hlds for a while now, but who knows what will in the future. Especially since you run this service on your linux box all the time, and the fact that hlds is very common. This means that there's plenty of knowledge about hlds and theres plenty of servers to experiment on for anyone that wishes to find/use an exploit.

    If your system is compromised and the service used to compromise the system is running as root the individual will totally own your box. If on the other hand the service is running as another user you stand a much better chance of not having a complete system compromise.

    To run a hlds server as another user is very easy to accomplish (even after you installed everything as root and have run hlds as root for a while). Do this:

    As root create a user that you wish to run the process. I have a user called hlds that I use for all file handling, uploading and stuff. You create a new user with the 'adduser' or 'useradd' command. Write 'man adduser' to learn more on how the command works. (Cant remember the exact usage now, sorry).

    Then as root use the command: chown hlds.users /halflife
    where you change the command to reflect your folder name where hlds is installed and the group that the user hlds belongs to. I use the default Redhat Group 'users' as a group but you might want to set your system up differently. For example create a group called hlds and then a user called cstrike and a user called ns for the different game-servers respectively.

    Then login as the user hlds and run your startscript to start the server. You will see that when running the command 'ps -aux' the hlds process is now running as the user hlds, not as root. Also edit the crontab while logged in as this user to be sure that the server is restarted as the user hlds and not as root (As described by Vadakill).

    I myself use the metamod plugin halfd to make sure my hlds-server always is up and running. You can find halfd <a href='http://www.halfd.org' target='_blank'>here</a>.

    I have had my system compromised once (through an exploit in the Open SSH 1.0 protocol, be sure to disable that in the config for open SSH if you use SSH!!), so I am a little paranoid. That left me with a total reinstallation of my Linux server = Not Fun! After that I became more careful of all the services that I run on my system.
  • cracker_jackmaccracker_jackmac Join Date: 2002-11-04 Member: 6891Members, Constellation, Reinforced - Shadow
    #!/bin/sh
    #ns init file
    # a converted startup script i didn't really do much do it. so if i've got something wrong
    # change it plz! I'm not claiming this will even work.

    # Source function library.
    if [ -f /etc/init.d/functions ] ; then
    . /etc/init.d/functions
    elif [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
    else
    exit 0
    fi

    # Avoid using root's TMPDIR
    unset TMPDIR

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0

    # Check that ns is intact exists.
    [ -f $HLDSDIR/ns/server.cfg ] || exit 0

    # Check that we can write to it... so non-root users stop here
    #[ -w $HLDSDIR/ns/server.cfg ] || exit 0
    # you might want to do this instead though
    #[ -w $HLDSDIR/ns/server.cfg ] { exit 0}
    #because you really don't want write access to the files.
    #The halfDOPTIONS need to be declared with your args
    # i.e. "-g ns -e 27015" and such

    RETVAL=0


    start() {
    KIND="HLDS"
    echo -n $"Starting $KIND services: "
    daemon halfd $halfDOPTIONS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hlds || \
    RETVAL=1
    return $RETVAL
    }

    stop() {
    KIND="HLDS"
    echo -n $"Shutting down $KIND services: "
    killproc halfd $halfDOPTIONS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hlds
    echo ""
    return $RETVAL
    }

    restart() {
    stop
    start
    }

    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    restart
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1
    esac

    exit $?
  • cracker_jackmaccracker_jackmac Join Date: 2002-11-04 Member: 6891Members, Constellation, Reinforced - Shadow
    put that file in your /etc/rc.d/init.d (same as /etc/init.d if its symlinked)

    chmod 755 rc.ns (whatever!)
    chmod +x rc.ns
    then in rc.0 - rc.6 "ln -s ../init.d/rc.ns <i>S or K##halfD</i>

    that last part probably doesn't make much sense. but i don't feel liek typing...Just make sure it has a high # and corrisponds with the files in that directory (aka if they are S60ssh you'd type S70halfD or seomthign)
  • cracker_jackmaccracker_jackmac Join Date: 2002-11-04 Member: 6891Members, Constellation, Reinforced - Shadow
    also found this script

    <a href='http://www.halfd.org/cgi/ikonboard/ikonboard.cgi?s=3df99c2471a7ffff;act=ST;f=1;t=540' target='_blank'>http://www.halfd.org/cgi/ikonboard/ikonboa...ct=ST;f=1;t=540</a>
  • FunkaFunka Join Date: 2002-11-03 Member: 5718Members
    for Linux server operators who are NOT getting the "debug.log" file created after a server crash...

    Please <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=17032' target='_blank'>see this thread</a> for explanation and possible fix.

    -f!
  • NupiNupi Join Date: 2002-12-16 Member: 10898Members
    edited January 2003
    I got some probably tweaks for Windows admins but i have to say i'm not sure if they give a huge performance increase maybe not, but worth to try.

    sv_voiceenable 0 ;

    Some people abuse the voice system anyway, i like to turn it off because it gives me littlebit of bandwith back. maybe even enough for 2 more players. Turning it off, was well taken, not a single complaint <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->.

    This next tip is unverified & untested but its basically having a HL pingbooster without installing it, i guess PingBooster changes a variable called sys_ticrate (server fps). So if you write "sys_ticrate 120" it should give a better performance maybe even lower pings.

    sys_ticrate from 0 to 1000 ;
    "sys_ticrate 100" is the recommended value. (default value).
  • rain1rain1 Join Date: 2003-01-09 Member: 12089Members
    LoadLibrary failed on /home/ns/hlds_l/ns/dlls/ns_i386.so: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
    Host_Error: Couldn't get DLL API from /home/ns/hlds_l/ns/dlls/ns_i386.so!
    FATAL ERROR (shutting down): Host_Error: Couldn't get DLL API from /home/ns/hlds_l/ns/dlls/ns_i386.so!

    I change the Lib path, still i get this problem. advice pls.. <!--emo&???--><img src='http://www.unknownworlds.com/forums/html/emoticons/confused.gif' border='0' valign='absmiddle' alt='confused.gif'><!--endemo-->
    OS: Rh8.0
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    See <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=7542&hl=libstdc' target='_blank'>THIS THREAD</a>

    Vadakill
  • LuxLux Join Date: 2002-11-17 Member: 9078Members
    um i am trying to convert my linux decitated 20 person server to ns, i cant even find this file
    ns_v1_linux_dedicated_server.tar.gz
    lol am i missing a page or something? can some one plz give me the link, i looked on downloads page and can only see the client side pacth + 1.04 + ns_v1_linux_dedicated_server[1].tar

    plz help me ;p

    <!--emo&::asrifle::--><img src='http://www.unknownworlds.com/forums/html/emoticons/asrifle.gif' border='0' style='vertical-align:middle' alt='asrifle.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo-->
  • VadakillVadakill The Almighty BSO Join Date: 2002-04-02 Member: 373Members, NS1 Playtester
    Click the Downloads link on the main page and scroll down to the bottom. There are dedicated server files for win32 and Linux.
  • LuxLux Join Date: 2002-11-17 Member: 9078Members
    opps the file i CANT get is
    hlds_l_3110_full.tar.gz

    I have
    ns_v1_linux_dedicated_server.tar.gz (85mb)
    ns_103.zip

    Plz tell me where :o
Sign In or Register to comment.