NS2 on Debian Squeeze

TermFragsTermFrags Tampa, FLMembers, NS2 Playtester Join Date: 2012-08-30 Member: 156877Posts: 13 Fully active user
edited September 2012 in Server Discussion
NS2 server running successfully on Linux
Hello everyone! Long time NS player here, just wanted to drop in and post a small tutorial on how to install an NS2 server on deb-like linux distros. I just accomplished it and am currently testing to ensure of it's stability. I'm using the latest build of NS2 (218) and the server runs O.K., so far so good. Well, perhaps with much higher CPU usage than I would like, but either way it works and people can join. My distro is Debian 6 and yes, to accomplish this feat, you MUST use wine. The servers hardware is pretty decent, it's an i7 Sandybridge 3930K with 8GB of DDR3. I don't know if hardware limitations will have a significant drop off, since I have only attempted on this machine. But so far it seems that you're going to need quite a bit of CPU, although memory usage is reasonable.

This is also in the hopes that UWE will make Linux binaries at or even before release for NS2. I am hoping for this to be a temporary fix rather than a go-to solution for those that want to host an NS2 server on Linux. Because it is not perfect, nowhere near. It runs stable, but nobody in their right mind hosts on Windows.

Features that WILL NOT work when hosting NS2 on Linux with Wine:
- ServerAdmins.json works perfectly, the server reads from the file. But admin commands cannot be executed at all from the game console or server console, so ServerAdmins.json is almost pointless.
- Server Addons. Admin mods, NS2Stats, and other game modifications will not work at all.
- IP assignment that is not your eth0:0 IP. If you have multiple IP's at your disposal, you must use your eth0:0 IP if you wish for the server to appear on the master list, else it will not show up at all. It is still joinable, but again, it will not show up on the server list.

Requirements:
- Decent hardware
- Window System (For Wine)
- Desktop Interface (For Wine)
- VNC Server (If you are not physically at the server, to start the NS2 Server....=\)
- Wine

Okay, this first part is only required if you're using SSH or terminal without a window manager of some sort. If you have all of this such as gnome, xfce with X Windows or any combination, skip ahead to setting up the server. I had to do this step because my server is in a datacenter and I simply did not have any of this installed to begin with since I went for a bare minimum of Debian. Wine MUST have a window manager and desktop interface to work correctly it seems. I've tried it without any of this but wine will not start the server without one.




Alright, just follow along in order and we'll get this going.

1.) sudo apt-get update

X Windows is a great system to use. Very fast and lightweight. Highly recommended.
2.) sudo apt-get install xorg

XFCE is far more efficient and faster than GNOME. I would highly recommend this over GNOME. It certainly doesn't look as pretty, but it's much more efficient at accomplishing the same thing with extremely low memory usage.
3.) sudo apt-get install xfce4

The final step is the VNC Server. I recommend tightvncserver for it's very conservative use of server resources.
4.) sudo apt-get install tightvncserver

Okay, after all of this has been installed, you'll need to start the VNC Server so you can remote in to view the desktop interface (another =\ for me).
5.) tightvncserver :1
It will ask you to set up a password. You can ignore the view password part, just hit enter.

Your VNC Server is now listening on port 5901 only to localhost. TightVNC, along with being very efficient is also very secure. You will have to set up a tunnel through SSH to connect. Here is how in putty. The equivalent can be done with MOST SSH programs for Windows.
6.) Source Port: 5901 - Destination Port: 127.0.0.1:5901

Download VNC viewer to your local machine. RealVNC should do the trick.
7.) http://www.realvnc.com/

Now that you have your SSH tunnel set up to port 5901 with a loopback (127.0.0.1) you can connect to your VNC server JUST to start the NS2 Server. There is no other purpose of having this. Smh, Windows, what a pain in the ass.

8.) In RealVNC, you should be connecting to localhost:5901. Enter your password.




If you skipped that last part because you already had all of that, or you're physically in front of this computer, kudos to you.

Now, we need to install the NS2 server. Go back to your SSH program or Terminal, and make a new directory in your Home directory. This is where you'll download SteamCMD for Linux and soon, install NS2.

9.) mkdir name_of_your_directory

10.) cd name_of_your_directory

11.) wget http://blog.counter-strike.net/wp-content/...steamcmd.tar.gz
tar -zxvf steamcmd.tar.gz

12.) chmod a+x steam.sh

13.) ./steam.sh

You must login to your steam account. Do this like so:
14.) login <username> <password>

If it's your first time using steam on this computer, it will say failed because you need to enter the Steam Verification Code they send to your email. Go to your email, get the code, then login once again like this:
15.) login <username> <password> <verification code>

Then, set a nonexistent directory to download NS2 to.
16.) force_install_dir ./ns2/

Then, start the download of the Windows binaries.
17.) app_update 4920 validate

After that, you have everything.
18.) cd ns2

Create a new .sh file with the text editor of your choice. This will allow us to start our server instantly and will also let us view it in a screen so we do not have to use the window interface or VNC in (awful).
19.) nano start.sh

20.) Copy and paste this into it:
CODE
#!/bin/bash
echo "NS2 Server Starting...."
sleep 1
screen -A -m -d -S ns2 wine Server.exe -name "<name of your server>" -map <map to start on> -ip <your eth0:0 IP> -port 27015 -limit <number of players> -lan false


You MUST use your eth0:0 IP if you have multiple IP's. This is a problem with wine it seems. It will not show up on the master list unless you do so.

Save and exit your text editor and do the following:
21.) chmod a+x start.sh

You're almost done. Open a window in your home directory or go to your VNC and do the same. Browse to your created directory and then to NS2.
Right click your start.sh and click "Execute"

It will not spawn a window for the server because of how we executed it. The worst part of it all is that the entire GUI you had to install is only to do THAT. If you do not execute it in a GUI environment, it simply will not work. How awful.

Anyway, your NS2 server should have started. To check, go back to your SSH program or Terminal and do the following:
22.) screen -x ns2

It should display the console output for your NS2 server. If all was successful, it should say your startup map loaded successfully. To exit the screen:
23.) CTRL + A + D




For the admins and mapcycle, it's also very simple. Admin commands do not appear to work, but the map cycle does. I'll have to look more into the admin issue to see what can be done.

You need to have ran your NS2 server at least once to get the Natural Selection 2 directory in Application Data to start.

Go to your home directory
24.) cd ~

Now that you're here, you can skip a whole bunch of directory navigation by doing the following:
25.) cd .wine/drive_c/windows/profiles

List the directory structure and then cd to your username
26.) cd <your username>

27.) cd 'Application Data'/'Natural Selection 2'

28.) mkdir config / cd config

You can now follow the details for creating a map cycle here:
http://www.unknownworlds.com/ns2/wiki/inde...er#Map_Rotation

Admin file here:
http://www.unknownworlds.com/ns2/wiki/inde...erverAdmin.json

Banned players file here:
http://www.unknownworlds.com/ns2/wiki/inde...nedPlayers.json

Let me know if you have any questions! :)
Post edited by Unknown User on
gH0sTySquishpokePOOPFACE
«13

Comments

  • endarendar Members, Squad Five Blue Join Date: 2010-07-27 Member: 73256Posts: 620 Fully active user
    What clockspeed are you running at? Also what CPU are you running? The only intel 5462 is an old Xeon, not an i7.
  • TermFragsTermFrags Tampa, FLMembers, NS2 Playtester Join Date: 2012-08-30 Member: 156877Posts: 13 Fully active user
    edited August 2012
    Sorry about that, I meant 3930K. I was thinking of a different server while typing the entire thing. Clock speed is 3.2 GHz.

    Tutorial goes up tonight! Was very busy yesterday. Because people joined the server as well, I got a lot of testing done too.

    Runs pretty decent. Cannot change maps (doesn't want to read the mapcycle either) and wont read the admin list or banned players at all. Server is very limited with admining. Attempting to change the map via my screen did nothing but cause the server to freeze. Looked like a crash but it came back to life about two minutes after my attempt. Everything else seems to work. Ran pretty stable using one core with about a constant 80% usage with 20 people on.
  • endarendar Members, Squad Five Blue Join Date: 2010-07-27 Member: 73256Posts: 620 Fully active user
    Sounds good, I'd love to see someone do a comparison of windows vs linux on the same hardware. I know it used to run in wine quite some builds ago, but then something broke it.
  • TwiggehTwiggeh Members Join Date: 2010-09-24 Member: 74165Posts: 508
    QUOTE (endar @ Sep 1 2012, 10:31 AM) »
    Sounds good, I'd love to see someone do a comparison of windows vs linux on the same hardware. I know it used to run in wine quite some builds ago, but then something broke it.


    This.

    I really want to know how much less effective it is to host through an emu (yeah yeah, Wine is not an emulator bla bla) than native Windows..
    image
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    I am very interested in this tutorial. I have attempted to get it running on ubuntu server 12.04 however am having a terrible time. I did not have any xwindows installed so i setup ubuntu-desktop on it. I am attempting to run steamcmd.exe with wine but I get an error everytime:

    QUOTE
    ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".
    [ 0%] Checking for available update...
    fixme:winhttp:WinHttpDetectAutoProxyConfigUrl discovery via DHCP not supported
    SteamUpdater: Error: Download failed: http error 0
    [ 0%] Download Complete.
    Verifying installation...
    [ 0%] Downloading Update...
    [ 0%] Checking for available update...
    fixme:winhttp:WinHttpDetectAutoProxyConfigUrl discovery via DHCP not supported
    SteamUpdater: Error: Download failed: http error 0
    [ 0%] Download Complete.
    SteamUpdater: Error: Steam needs to be online to update. Please confirm your network connection and try again.
    [ 0%] !!! Fatal Error: Steam needs to be online to update. Please confirm your network connection and try again.


    Not sure what I am doing wrong. Also any progress on being able to change maps? If I cannot have admins/change map on the server then this is pointless for me to do it on linux.

    Thanks for the help!
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    Anybody got a link to the tutorial?

    I am currently trying out ubuntu 12.04.
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    QUOTE (joshmmo @ Sep 3 2012, 03:43 PM) »
    I am very interested in this tutorial. I have attempted to get it running on ubuntu server 12.04 however am having a terrible time. I did not have any xwindows installed so i setup ubuntu-desktop on it. I am attempting to run steamcmd.exe with wine but I get an error everytime:



    Not sure what I am doing wrong. Also any progress on being able to change maps? If I cannot have admins/change map on the server then this is pointless for me to do it on linux.

    Thanks for the help!


    The solution to your problem is to install SteamCMD for linux.
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    I will have to try that out when I get home. Thank you.
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    edited September 2012
    Its ok I got it working, this is on Ubuntu 12.04.1 on a 64bit machine with a GTX 9800 with wine 1.4.

    Here is what I did:

    1. Install the linux version of steamcmd here.
    2. Download server like it says in ns2 server wiki
    3. open up a terminal and run 'export WINEARCH=win32'
    Note: This assumes that you have not run wine on this system before
    4. run 'winecfg' to setup wine
    5. rename the ~/.wine/drive_c/windows/winsxs/manifests/x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4053_none_deadbeef.manifest file to something else so it wont b17ch
    4. then run your server 'wine Server.exe'
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    edited September 2012
    I have a problem with this.

    First off when run:
    export WINEARCH=win32
    and then winecfg I get the following error:
    wine: WINEARCH set to win32 but '/home/joshmmo/.wine' is a 64-bit installation.

    EDIT: Ok I fixed this problem by deleting the .wine folder in my home directory and re-ran steps 3&4 on Hook's steps.
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    edited September 2012
    So its running and I can join the server on the network, but as soon as I try and join externally I can't connect. Any ideas on ubuntu? I put my machine in the dmz to test it even. No luck

    I see my server on the list but it says (LAN). I am using -lan false....maybe this question has been asked 1000 times, can someone point me to a forum post with this issue?

    EDIT: I also notice the map does not start on the map I pick via command line...

    I do not see a server.xml file to try and edit to change values in there. I am at a loss on this one. Any help is much appreciated
    Post edited by Unknown User on
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    QUOTE
    So its running and I can join the server on the network, but as soon as I try and join externally I can't connect. Any ideas on ubuntu? I put my machine in the dmz to test it even. No luck


    Have you setup the port forwarding?

    I have not figured out the server.xml either. My hunch is that it is somewhere in ~/.wine/drives_c/user/<your username here>/App Data/Natural Selection 2/ but I have not seen it. I tried overriding it using the -file flag but it complained about it not existing. Maybe the -adminpath
  • endarendar Members, Squad Five Blue Join Date: 2010-07-27 Member: 73256Posts: 620 Fully active user
    If i'm reading correctly, you are looking for the server.xml file? It has to be created manually by YOU, if you would like to use it.
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    Ok, is there any documentation for the format of the server.xml?
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    QUOTE (MPG|RED HOOK @ Sep 6 2012, 05:12 PM) »
    Have you setup the port forwarding?

    I have not figured out the server.xml either. My hunch is that it is somewhere in ~/.wine/drives_c/user/<your username here>/App Data/Natural Selection 2/ but I have not seen it. I tried overriding it using the -file flag but it complained about it not existing. Maybe the -adminpath


    Yes I have set up port forwarding. Were you able to join your server outside your network? Or have someone else join it outside your network?

    Also is your admin file getting read correctly?
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    Another question I have if you are setting up a linux server do you need PhysX Redist and DirectX Redist? The server is running...just not accessible outside the network.

    I noticed if I started the server with steam running it would load the correct map. If I did not have steam running it would load a different map then the one I choose via command line parameters.
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    QUOTE (joshmmo @ Sep 6 2012, 06:36 PM) »
    Another question I have if you are setting up a linux server do you need PhysX Redist and DirectX Redist? The server is running...just not accessible outside the network.

    I noticed if I started the server with steam running it would load the correct map. If I did not have steam running it would load a different map then the one I choose via command line parameters.


    Not sure. I have a Nvidia card so I installed the nvidia drivers which have the PhysX runtime libraries in them. DirectX is a windows thing so I did not install it and everything seems to work.
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    QUOTE (joshmmo @ Sep 6 2012, 06:22 PM) »
    Yes I have set up port forwarding. Were you able to join your server outside your network? Or have someone else join it outside your network?

    Also is your admin file getting read correctly?


    Ya last night some of my friends joined. Its called -MPG- Linux|Ivy Bridge|i7|3.6GHz
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    edited September 2012
    Damn I wonder what I am doing wrong. Can you tell me exactly what you are typing to start the server? Did you end up using your server.xml file?

    Also did you set the -ip option as your internal IP or external? Is steam running when you run your server?
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    edited September 2012
    Do you also mind if you post what gets printed to console when you start your server to see if its the same as mine:

    QUOTE
    $ wine Server.exe -name MooreNS2 -map ns2_tram -limit 16 -lan false
    fixme:actctx:parse_assembly_elem wrong version for assembly manifest: 8.0.50608.0 / 8.0.50727.6195
    fixme:actctx:parse_manifest_buffer failed to parse manifest L"Z:\\home\\joshmmo\\ns2\\steam\\Microsoft.VC80.CRT.manifest"
    fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.VC80.CRT" (8.0.50608.0)
    fixme:dbghelp:validate_addr64 Unsupported address fffffffff7360000
    Invalid command line (Unrecognized switch/option name 'lan')
    Changing setting 'mapName' to: 'ns2_tram'...
    Changing setting 'serverName' to: 'MooreNS2'...
    Changing setting 'playerLimit' to: '16'...
    Press Tab to open the console window
    Press Ctrl-C to exit


    fixme:keyboard:X11DRV_LoadKeyboardLayout L"00000409", 0080: stub!
    fixme:win:RegisterRawInputDevices (pRawInputDevices=0x32d2f0, uiNumDevices=1, cbSize=12) stub!
    Build 218
    Starting Natural Selection 2
    p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: cannot open shared object file: No such file or directory
    fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
    fixme:toolhelp:Heap32ListFirst : stub
    Failed to load Steam Service
    ServiceStart: failed to start
    ServiceStart: failed to start
    Setting breakpad minidump AppID = 4920
    Connected to Steam servers
    Loading user://config/mapcycle.txt
    Loading user://config/ServerAdmin.json
    Loading user://config/BannedPlayers.json
    Loading 'maps/ns2_tram.level'
    Error: Couldn't open file 'models/props/refinery/refinery_fan128_blades.animation_graph'
    Error: Couldn't open file 'models/effects/halo_blue.model'
    Error: Couldn't open file 'models/effects/halo_rounded_blue.model'
    Error: Couldn't open file 'models/props/refinery/refinery_shipping_hologram_animated.animation_graph'
    Error: Couldn't open file ''
    Finished loading 'maps/ns2_tram.level'
  • falcfalc Members Join Date: 2011-03-18 Member: 87128Posts: 133
    QUOTE (joshmmo @ Sep 7 2012, 05:06 AM) »
    Invalid command line (Unrecognized switch/option name 'lan')


    Looks like this command line switch is wrong and the fallback probably is to use LAN true.
    FRAGFEST.de | Steam Group | Twitter
    A german website and blog about games and stuff.
    NS2 Servers (i7 @ 3.8 GHz)
    Server #1 - 176.9.107.253:27015
    Server #2 - 176.9.107.253:27025
  • MPG|RED HOOKMPG|RED HOOK Members Join Date: 2012-09-03 Member: 157598Posts: 33
    Here is my start script:
    CODE
    #!/bin/bash
    wine Server.exe -webadmin true -webdir ~/webadmin -map ns2_tram -name "-MPG- Linux|Ivy Bridge|i7|3.6GHz"


    Make sure you have ports 27015 and 27016 forwarded to the ip address of you server in your LAN.

    You do not need to have steam running to run the server. In fact I did not even install steam on my linux box, all you need is steamcmd.
  • joshmmojoshmmo Members Join Date: 2010-04-10 Member: 71293Posts: 13
    I forwarded the ports, then tried putting the machine in the dmz with no luck. I decided to restart my router and boom it worked. I was so pissed.

    Thanks for the help. Now I just need to set admins and map cycle.
  • TermFragsTermFrags Tampa, FLMembers, NS2 Playtester Join Date: 2012-08-30 Member: 156877Posts: 13 Fully active user
    edited September 2012
    Bump for full post :)

    QUOTE (joshmmo @ Sep 8 2012, 02:37 AM) »
    I forwarded the ports, then tried putting the machine in the dmz with no luck. I decided to restart my router and boom it worked. I was so pissed.

    Thanks for the help. Now I just need to set admins and map cycle.


    I also addressed that all the way at the bottom of the post. Can be done with Wine's directory structure.
  • PneumaticCrabPneumaticCrab Members Join Date: 2002-11-28 Member: 10133Posts: 132
    you can use xvfb to skip the x/vnc steps. well, bye.
  • TermFragsTermFrags Tampa, FLMembers, NS2 Playtester Join Date: 2012-08-30 Member: 156877Posts: 13 Fully active user
    Fantastic news, UWE has confirmed they are working on a Linux Server!! I'll rewrite this whenever the time comes.

    I'm stoked!!!
  • ZaggyZaggy NullPointerException The NetherlandsForum Moderators, NS2 Playtester, Reinforced - Onos, Subnautica Playtester Join Date: 2003-12-10 Member: 24214Posts: 3,654 mod
    Stupid question time: Do I need a copy of NS2 on the Steam account I use to install the NS2 dedicated server?

    If I follow your tutorial I end up at:

    Steam>app_update 4920 validate
    ERROR! Failed to install app '4920' (No subscription)
    imageProud Dutchman image
    Join the Natural Selection IRC channel: #naturalselection on irc.gamesurge.net!
  • WhosatWhosat SingaporeMembers, Reinforced - Shadow Join Date: 2006-11-03 Member: 58301Posts: 470 Fully active user
    Try 4940 instead of 4920
    "Games are what gives people the spark of fun, coders are what turn the spark into a fire." - SilentSkulk/Cheeserm
    NS2 Server Setup Wiki | @NS2SG | AlliedModders
  • ZaggyZaggy NullPointerException The NetherlandsForum Moderators, NS2 Playtester, Reinforced - Onos, Subnautica Playtester Join Date: 2003-12-10 Member: 24214Posts: 3,654 mod
    QUOTE (Whosat @ Oct 23 2012, 04:33 PM) »
    Try 4940 instead of 4920


    Thanks!

    Results:
    Steam>app_update 4940 validate
    App state (0x10102) reconfiguring, progress: -nan (0 / 0)
    Error! App '4940' is 0x1 after update job.

    *pressed enter*

    Steam> Checking for available updates...
    [ 0%] Download complete.

    *pressed enter**

    Steam>
    Steam>

    Not much happening it seems.
    imageProud Dutchman image
    Join the Natural Selection IRC channel: #naturalselection on irc.gamesurge.net!
  • WhosatWhosat SingaporeMembers, Reinforced - Shadow Join Date: 2006-11-03 Member: 58301Posts: 470 Fully active user
    Hmm you're sure you have permissions to write in that directory you chose yeah? And try removing "validate". (actually the command I use is "verify", not sure if that will make any difference)
    "Games are what gives people the spark of fun, coders are what turn the spark into a fire." - SilentSkulk/Cheeserm
    NS2 Server Setup Wiki | @NS2SG | AlliedModders
Sign In or Register to comment.