Natural Selection 2

Natural Selection 2

Not enough ratings
NS2 Server Setup on Ubuntu 16.04 LTS
By ᵡᴳḽᴰ::Vertex
This guide will explain how to setup a Natural Selection 2 server on Ubuntu 16.04 LTS. Post any questions or feedback in the comment section for a responce. This Linux OS was picked becuase it's fast, stable and supported until April 2021.
Prerequisites for Server Setup
From your terminal or headless window, escalate to root and enter your password.
su root
You'll be typing a lot of commands in that require this, so stay escalated until said otherwise.

Make sure your operating system is updated. Fast and stable is good for servers.
apt-get update apt-get upgrade

Create User Name
Create a new user for running SteamCMD and your Natural Selection 2 server. DO NOT run as root. Replace all instances of changeme in this guide, with your own username.
useradd -m -d /home/changeme changeme
Initalize the user by creating a password for it. Type the following then enter the password after.
passwd changeme

Make Folders and Set Owners
These will be required for later. Make folders then set your new username as the owner.

Create a folder for steamcmd and set owner to your user.
mkdir /home/steamcmd chown changeme /home/steamcmd

Create a folder for the ns2 server and set owner to your user.
mkdir /home/ns2 chown changeme /home/ns2

Install Prerequisites and Deescalate Root
Install the requirements for this guide and running an NS2 server.
apt-get install lib32gcc1 speex:i386 libgtk2.0-0:i386 curl screen nano
Now is the time to descale root and change to your new username.
su changeme
Install SteamCMD
Date Written: 17th Day of June 2017. Reference here if anything changes in the future.

Change directory to your steamcmd folder. DO NOT leave this folder until said otherwise.
cd /home/steamcmd
Download and extract steamcmd inside your folder.
Run SteamCMD. Let it install and update your version. If you need to: chmod 744
Exit when done. This guide will explain the usage of scripts for an important reason.

Create Install Script and Install Server
Game developers decided it was a good idea not to support anonymous logins for steamcmd. Copy this script somewhere becuase you'll need to replace steam_user with your steam username.
#!/bin/sh echo "Installing NS2! - to access type: screen -x iNS2" sleep 1 screen -A -m -d -S iNS2 ./ +login steam_user +force_install_dir /home/ns2 +app_update 4940 validate

Now create a new file with the nano editor. (installed two sections ago)

Copy the script from your text file (or whatever used) and right click to paste the script into the nano editor. Press ctrl + x to exit. Type y then enter to save file.

Make sure the sh file created has executable permissions. The numbers 744 mean only the owner of the file get's write and executable permissions. But, others can read still the file. (if required)
chmod 744

Run the file which will install your Natural Selection server.

The script said to open the screen. (installed two sections ago)
screen -x iNS2

When SteamCMD asks for the password to your steam account, enter it. Be ready to enter the steam gaurd code afterwards. Games that do not support anonymous logins require this hassle.

KIll the screen when the server is done installing. Press ctrl + c.
Create Startup Script and Run Server
Change directory to your Natural Selection 2 server folder.
cd /home/ns2

Create file with the script that will start up your server.

Copy then right click to paste. Press ctrl + x to exit. Then type Y and press enter to save.
#!/bin/sh echo "Starting NS2! - to access type: screen -x ns2_server" sleep 1 /usr/bin/screen -A -m -d -S ns2_server ./server_linux32 -file "/home/ns2/config/server.txt"

Run your server and access your screen before it starts up. (to watch for errors)
./; sleep 0.1; screen -x ns2_server

Press q to exit the server, it's time to setup it up now.
Setting your up NS2 Server
If you're using Ubuntu Server (without a desktop), use FileZilla; otherwise use desktop interface to navigate to /home/ns2. Make sure there's a folder called "config" created. Enter the config folder.

Create a new file and call it server.txt. When the server is started, it will read from this.

Open the text file. Add each of these options on a new line.
Click here[] for more options.

Specify which map to use, when the server starts up.
-map ns2_veil
Specify the ip address of your server.
-ip ""
Specify the port of your server. Pick non-conflicting ones like 27015, 27025, 27030 etc.
-port "27015"
Specify the player count limit on your server. (after reserved and spectator slots are counted)
-limit 24
Specify the name of your Natural Selection 2 server.
-name "My NS2 Server"
Specify which mods to install. Seperate new ones with a space. 706d242 is shine. (a must have)
-mods "706d242"
Specify the folders to put your config, mod and log files in. These ones support this guide.
-config_path "/home/ns2/config" -logdir "/home/ns2/config/logs" -modstorage "/home/ns2/config/mods"

Setting up the Web Panel (Optional)
Change these to suit your needs.
-webadmin -webdomain "" -webport 8080 -webuser admin -webpassword password
Open the web panel by visting:
Frequently Asked Questions
Setting up Server Mods
  • Shine is your best friend for NS2. Setup /home/config/MapCycle.json the way mentioned here.

  • All new mod ids need put in your server.txt file AND in the mapcycle.json file.

  • Mods can etheir be mounted all the time or when the map changes
    • Mount ns2_nexus when played: { "map": "ns2_nexus", "mods": ["17b0e28c"], "min": 8 }
    • Use the dedicated "mods": [ "706d242" ] section to run mods all the time.

Setting up Server Admins
< >
Dalekfodder Jun 27 @ 12:43am 
10/10 spoon feeding guide, time well wasted! (not kidding)
ᵡᴳḽᴰ::Vertex  [author] Jun 25 @ 8:34am 
In your server configuration folder, there's a file called ServerConfig.json. You can change the number of bots in there. You should forward UDP ports 27005-27030. SteamCMD is supported on Windows. See link for more information.
Picarica Jun 25 @ 1:57am 
wanted to ask if its possible to create server on through steamCMD on windows and how can i add bots and do i need port forwarding ?