Dedicated Servers Installation

## Finding Help

Please also note that there is a discussion board on Steam for Out of Reach Dedicated Servers which can be found here.

Windows installation notes: The most easy way to install Windows server is to use Steam Tools. Refer to: Windows Server Installation from Steam Tools

## Prerequisites

### **Operating system**

**Out of Reach** dedicated server supports Linux (tested on Ubuntu server 14.04) and Windows (tested on Windows 8.1).

### **Hardware**

 Memory
 HDD

### **Download SteamCMD**

SteamCMD is used for download and installation of **Out of Reach** dedicated server. Please refer to SteamCMD page for detailed instruction on its installation and usage.

### **Install database regarding to operating system**

The dedicated server requires PostgreSQL 9.3 database to operate.

##### Installation on Linux

1. Installation of PostgreSQL with use of **apt-get**

```
sudo apt-get install postgresql-9.3

```

If the installation was successful, you should see the process on port 5432 by default (don't copy the prompt character '$'):

```
$ cat /etc/services | grep postgresql

postgresql      5432/tcp        postgres        # PostgreSQL Database
postgresql      5432/udp        postgres

```

2. Next, you'll need to create a database for the game to use. The database will need:

* a database name (e.g. **oor\_server**)
* a user name (e.g. **some\_user**)
* a password (e.g. **some\_password**).

Note: In the PostgreSQL command below, PostgreSQL is expecting not the password itself but rather the text `md5` followed by the md5 hash of the actual password concatenated with the username. Please refer to this page for PostgreSQL password encryption details or use the commands below to generate the hash for you. Also note that your user / password is currently passed as plaintext via a java command line parameter so you probably don't want to go crazy on special characters (see further notes below or search for java) and you'll want avoid reusing passwords from other accounts.

```
DB_NAME="oor_server";
DB_USER="some_user";
DB_PWD="some_password";

PWD_HASH=$(echo -n md5; echo -n $DB_PWD$DB_USER | md5sum | cut -d' ' -f1);
echo PWD_HASH is $PWD_HASH

echo "CREATE ROLE $DB_USER LOGIN ENCRYPTED PASSWORD '$PWD_HASH' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION; CREATE DATABASE $DB_NAME WITH ENCODING='UTF8' OWNER=$DB_USER CONNECTION LIMIT=-1; ALTER ROLE $DB_USER SET search_path = $DB_NAME;" | sudo -u postgres psql

```

You can then verify that login works from the terminal (don't copy the prompt character '$' and make sure to end SQL commands with a semi-colon):

```
$ which psql
/usr/bin/psql

$ psql -U some_user -h 127.0.0.1 -d oor_server
Password for user some_user: <enter your password and press ENTER>

oor_server=>
SELECT count(*) FROM pg_catalog.pg_tables WHERE schemaname not in('pg_catalog','information_schema');

## count
     0
(1 row)

<Press Ctrl+Z to close>

```

*Note: The count will be 0 initially because we haven't done the setup stuff yet; Nothing to be worried about.*

#### Installation on Windows

Important note: Currently you don't have to use PostgresSQL to run Out Of Reach on Windows system. You can just skip this step and follow Windows Installation instruction. However if you want to have standalone machine (server) running with Out Of Reach PostgreSQL seems to be a better solution. Anyway as first installation I recommend to start with internal database which is already installed with Dedicated server from Steam tools.

1. Download PostgreSQL 9.3 Windows installer, i.e. from here

2. Start installer to install database

3. When installation is done, start Windows console and paste there following command:

```
echo CREATE ROLE some_user LOGIN ENCRYPTED PASSWORD 'md59e2e8a8fce0afe2d60bd8207455192cd' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION; CREATE DATABASE oor_server WITH ENCODING='UTF8' OWNER=some_user CONNECTION LIMIT=-1; ALTER ROLE some_user SET search_path = oor_server; | "C:\Program Files\PostgreSQL\9.3\bin\psql.exe" -U postgres

```

Those are default values (user, password and database name) used by the server. You can change them (as well as database host), to do so please refer to Server launch parameters section.

Database is also by default installed at **C:\Programme\PostgreSQL\9.3** directory. If you have installed it in some other location, please change it accordingly.

Password is encrypted for **some\_user** database user! If you would like to use different user and password please refer to this page for PostgreSQL password encryption details.

No additional SQLs are needed, database migration is executed each time (if needed) at server startup.

### **Network**

By default **Out of Reach** server binds to *0.0.0.0* network interface **which in most cases is fine and there is no need to change it**

But if you would like to change it to different address, two steps are required:

1. Set IP address as **oor.server.ip.address** server launch parameter (or environment variable)
2. Change Smartfox Server configuration in *<install\_dir>/SFS2X/config/server.xml* file. Change *addresses* in *socketAddress* section:

```
<socketAddresses>
    <socket address="0.0.0.0" port="27016" type="TCP"/>
    <socket address="0.0.0.0" port="27016" type="UDP"/>
</socketAddresses>

```

**Out of Reach** dedicated server listens for incoming connections on the ports listed below. Ensure your network configuration allows incoming connections to these ports and directs them to the host that will be running your dedicated server.

 Steam's Server browser query port
 Web console port

\*Those are default port numbers, they can be overwritten in server launch parameters (or environment variables). Please refer to Server launch parameters section.

In Linux, you can create exceptions for the local software firewall by running the commands below. Note that this is ***in addition*** to setting up port forwarding on your router. The following commands assume ufw (Uncomplicated Firewall) is being used as that is the default for Ubuntu and Linux Mint.

```
# UDP
sudo ufw allow 27016/udp;
sudo ufw allow 27010/udp;

# TCP
sudo ufw allow 27010/tcp;
sudo ufw allow 27016/tcp;
sudo ufw allow 19933/tcp;

```

### Time zone

**UTC** (Universal Time Coordinated) time zone is preferred as it's 'immune' to **DST** (Daylight Saving Time) change. After each change of server's system time, **Out of Reach** dedicated server needs to be restarted.

## Server installation from STEAM

1. Create server folder (referred as **<install\_dir>**)

2. Launch SteamCMDand download server

```
Steam> login anonymous
Steam> force_install_dir <install_dir>
Steam> app_update 406800 validate
Steam> exit

```

or alternately one can run the above as a single command (don't forget to replace <install\_dir> with an actual path first):

```
steamcmd +login anonymous +force_install_dir <install_dir> +app_update 406800 validate +quit

```

### Windows specific

1. Make sure you have installed Microsoft Visual C++ 2015 Redistributable (x64). You can download from here.

### Linux specific

1. Install required .so libraries

```
INSTALL_DIR="<install_dir_absolute_path>";
sudo cp $INSTALL_DIR/steamclient.so /usr/lib/
echo "$INSTALL_DIR/SFS2X/lib/linux64" | sudo tee /etc/ld.so.conf.d/oor.conf
sudo ldconfig

```

## Launching Linux server

### Linux

To launch **Out of Reach** dedicated server use the following command:

```
<install_dir>/SFS2X/sfs2x-service start

```

To stop a server use the following command:

```
<install_dir>/SFS2X/sfs2x-service stop

```

Consider adding **<install\_dir>/SFS2X/** path to you PATH environment variable

After the server has started, you can check if it is still running using the following commands. Please be aware that this currently shows your database password in plaintext so make sure to edit this if you are pasting online.

```
TMP_FILE="/tmp/oor-cleanup-ps-output.txt";
LIST_OF_SERVER_PIDS=`pgrep -f "sfs2x-service"`;
echo $LIST_OF_SERVER_PIDS | xargs ps -o pid,comm,start,etime,pcpu,pmem,size,args -p > "${TMP_FILE}";
cat $TMP_FILE | perl -p -e "s/\-classpath[ ]+[^ ]+//g";

# Assuming all dependencies are installed, the above commands should give output similar to this:
  PID COMMAND          STARTED     ELAPSED %CPU %MEM  SIZE COMMAND
14511 java            13:41:00       49:14  0.9  2.9 2723044 /path/to/oor-install/jre/bin/java -server -Dinstall4j.jvmDir=/path/to/oor-install/jre -Dexe4j.moduleName=/path/to/oor-install/SFS2X/sfs2x-service -Dfile.encoding=UTF-8 -Dinstall4j.launcherId=23 -Dinstall4j.swt=false -Dfile.encoding=UTF-8 -Xms2048M -Xmx2048M -Djava.library.path=lib/linux64 -Door.database.host=localhost:5432 -Door.database.user=**`some_user`** -Door.database.password=**`some_password`** -Door.database.name=**`oor_server`** -Door.max.players.count=75 -Door.send.heartbeat.to.legacy.master=false -Di4j.vpt=true com.install4j.runtime.launcher.Launcher start com.smartfoxserver.v2.Main false false   true true false sfs-splash.png true true 0 0  20 20 Arial 0,0,0 8 500 version 2.9.0 20 40 Arial 0,0,0 8 500 -1

```

## Launching Windows server

To launch **Out of Reach** dedicated server use:

```
<install_dir>/SFS/sfs2x-standalone.exe

```

## Windows Server Installation from Steam Tools (internal database, no PostgresSQL needed)

There is an easy way to install dedicated server on Windows.

1) Open Steam's Library

2) Open Tools

3) Find '"Dedicated Server Out Of Reach''

4) After intallation it should be available in your games library

5) Start server and wait about 1-2 minutes

6) Configuration: Web console is available at http://localhost:19933/web-console. Web console user is: admin and password is: pass

Remember to change the password after first login!

You need to chose region and provide name of server (in other case server won't be visible on list of servers in game)

IMPORTANT!

You need to have fixed IP if you want your server to be visible by other people. If you have router with fixed IP then you need to redirect proper ports: 27010, 27016 both for UDP and TCP protocols to your local machine.

## **Server Parameters (important if you changed credentials, IP address etc)**

You need to override server parameters if you have generated custom credentials to database or you have custom IP address.

*IMPORTANT!!! Server launch parameters can be specified in **<install\_dir>/SFS2X/sfs2x-service.vmoptions** file in Java Virtual Machine style:*

```
-D[parameter.name]=[parameter.value]

```

i.e.

```
-Door.database.name=oor_server

```

Here you can find the list of all supported parameters:

## Web console

By default web console is available at **http://[host]:19933/web-console** URL (port number can be changed, please check Network section for more details). Web console user is: **admin** and password is: **pass**

Remember to change the password after first login!

At the first start, server does not have a name and region selected and thus will not be able to connect to Steam Master Server and will not be visible in the game on servers list. To set a name and region go to **Server parameters** menu.

### Adminstrator privileges

Any player can be assigned / revoked with **administrator privileges** from **Players** menu. Those privileges give access to following in-game commands:

Default [amount] in /gimi*RESOURCE* command is 100

#### God mode

Players with administrator privileges can enter **god mode** (/god command in chat window), this mode gives following abilities:

1. Immortality
2. Bypass of all building rights / permissions
3. Fly mode - to enter / leave this mode press Z

## Server update

To update server launch **SteamCMD** and use following commands

```
Steam> login anonymous
Steam> app_update 406800 validate
Steam> exit

```

To automate server update please refer to SteamCMD wiki.