NS2 on Debian Squeeze
TermFrags
Tampa, FL Join Date: 2012-08-30 Member: 156877Members, NS2 Playtester
<div class="IPBDescription">NS2 server running successfully on Linux</div>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.
<b>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. <u>It runs stable, but nobody in their right mind hosts on Windows.</u></b>
<u><b>Features that WILL NOT work when hosting NS2 on Linux with Wine:</b></u>
- 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
<b>Okay, this first part is only required if you're using SSH or terminal without a window manager of some sort.</b> If you have all of this such as gnome, xfce with X Windows or any combination, <b>skip ahead to setting up the server.</b> 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.) <a href="http://www.realvnc.com/" target="_blank">http://www.realvnc.com/</a>
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 <a href="http://blog.counter-strike.net/wp-content/uploads//2012/04/steamcmd.tar.gz" target="_blank">http://blog.counter-strike.net/wp-content/...steamcmd.tar.gz</a>
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:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>#!/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</div>
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:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#Map_Rotation" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...er#Map_Rotation</a>
Admin file here:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#ServerAdmin.json" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...erverAdmin.json</a>
Banned players file here:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#BannedPlayers.json" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...nedPlayers.json</a>
Let me know if you have any questions! :)
<b>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. <u>It runs stable, but nobody in their right mind hosts on Windows.</u></b>
<u><b>Features that WILL NOT work when hosting NS2 on Linux with Wine:</b></u>
- 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
<b>Okay, this first part is only required if you're using SSH or terminal without a window manager of some sort.</b> If you have all of this such as gnome, xfce with X Windows or any combination, <b>skip ahead to setting up the server.</b> 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.) <a href="http://www.realvnc.com/" target="_blank">http://www.realvnc.com/</a>
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 <a href="http://blog.counter-strike.net/wp-content/uploads//2012/04/steamcmd.tar.gz" target="_blank">http://blog.counter-strike.net/wp-content/...steamcmd.tar.gz</a>
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:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>#!/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</div>
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:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#Map_Rotation" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...er#Map_Rotation</a>
Admin file here:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#ServerAdmin.json" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...erverAdmin.json</a>
Banned players file here:
<a href="http://www.unknownworlds.com/ns2/wiki/index.php/Dedicated_Server#BannedPlayers.json" target="_blank">http://www.unknownworlds.com/ns2/wiki/inde...nedPlayers.json</a>
Let me know if you have any questions! :)
Comments
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.
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..
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->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.<!--QuoteEnd--></div><!--QuoteEEnd-->
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!
I am currently trying out ubuntu 12.04.
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!<!--QuoteEnd--></div><!--QuoteEEnd-->
The solution to your problem is to <a href="https://developer.valvesoftware.com/wiki/SteamCMD" target="_blank">install SteamCMD for linux</a>.
Here is what I did:
1. Install the linux version of steamcmd <a href="https://developer.valvesoftware.com/wiki/SteamCMD" target="_blank">here</a>.
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'
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.
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
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
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<!--QuoteEnd--></div><!--QuoteEEnd-->
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?
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.
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.<!--QuoteEnd--></div><!--QuoteEEnd-->
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.
Also is your admin file getting read correctly?<!--QuoteEnd--></div><!--QuoteEEnd-->
Ya last night some of my friends joined. Its called -MPG- Linux|Ivy Bridge|i7|3.6GHz
Also did you set the -ip option as your internal IP or external? Is steam running when you run your server?
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->$ 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'<!--QuoteEnd--></div><!--QuoteEEnd-->
Looks like this command line switch is wrong and the fallback probably is to use LAN true.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#!/bin/bash
wine Server.exe -webadmin true -webdir ~/webadmin -map ns2_tram -name "-MPG- Linux|Ivy Bridge|i7|3.6GHz"<!--c2--></div><!--ec2-->
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.
Thanks for the help. Now I just need to set admins and map cycle.
<!--quoteo(post=1973908:date=Sep 8 2012, 02:37 AM:name=joshmmo)--><div class='quotetop'>QUOTE (joshmmo @ Sep 8 2012, 02:37 AM) <a href="index.php?act=findpost&pid=1973908"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->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.<!--QuoteEnd--></div><!--QuoteEEnd-->
I also addressed that all the way at the bottom of the post. Can be done with Wine's directory structure.
I'm stoked!!!
If I follow your tutorial I end up at:
Steam>app_update 4920 validate
ERROR! Failed to install app '4920' (No subscription)
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.