Dedicated server setup

From ARK Wiki
(Redirected from Dedicated Server Setup)
Jump to navigation Jump to search

This page discusses the installation and fundamental setup of a dedicated ARK server.

For advanced configuration and deeper server setting, see Server configuration.

For scripts that you can run on your own dedicated server, see Dedicated server scripts.

Prerequisites

The ARK dedicated server (ShooterGameServer) is a 64-bit executable program and as such requires a 64-bit operating system to run.
Each server installation takes around 18 GiB of drive space, additional drive space is required to store game saves, tribe and player profiles, logs, updates download and installation, and eventually mods (for Steam players only).
CPU requirements aren't strict but it's is highly recommended to have 2 logical cores available for each ShooterGameServer instance. Single thread performance is preferred over having more cores, as ShooterGameServer doesn't take any noticeable advantage having more than 2 logical cores available and will never scale over 4 cores.

RAM

Excluding operating system, memory requirements vary depending on the map and it increases as the number of connected players, as players game progresses (structures, creatures, storages), on server configuration and eventually on mods installed.
For each player connected the memory requirements may rise by an average of 50-150MiB. System administrator must keep in mind as players progresses advance, more game objects will be created as a result, and the memory requirements will rise. Finally, memory usage also varies during creatures (re)spawn phase, that takes several minutes.
The following table shows the memory usage for each map on a new world save with default server settings and no players connected (the intervals are due to the creatures (re)spawn phase).

Map Name server Memory usage on empty map
The Island TheIsland 3.5-4.5 GiB
The Center TheCenter 3-4 GiB
Scorched Earth ScorchedEarth_P 3-4 GiB
Ragnarok Ragnarok 4-5 GiB
Aberration Aberration_P 3-4 GiB
Extinction Extinction 3-4 GiB
Valguero Valguero_P 3-4 GiB
Genesis: Part 1 Genesis 5-6 GiB
Crystal Isles CrystalIsles 5.5-6.5 GiB
Genesis: Part 2 Gen2 10-12.5 GiB
Lost Island LostIsland 5.5-7 GiB
Fjordur Fjordur 4-5 GiB

Network

Bandwidth needed increases linearly with players connected. Generally, for home connection class a 100Mb or better is highly recommended to support properly a good number of players. Specifically for VPS, each connected player may require up to 60KiB/s of bandwidth, shared across upstream and downstream, however all is directly tied by server tick-rate and the complexity of the world save reached.

The server listens for incoming connections on the local ports listed below. Ensure your network configuration (operating system firewall and router port forwarding) allows incoming connections to these ports and directs them to the host that will be running your dedicated server.

Port Purpose
UDP 7777 Game port
UDP 7778 Peer port (always Game port +1)
UDP 27015 Query port (for Steam's server browser only)
TCP 27020 RCON for remote console server access (optional)

Please note manual port forwarding may be needed since ShooterGameServer does not support UPnP or other automatic port forwarding protocols.

Multiple dedicated servers on the same host are supported. A common setup consists on assign and forwarding ports incrementally.

Server instance Game port (UDP) Peer port (UDP) Query port (UDP) RCON port (TCP)
Server instance 1 7777 7778 27015 27020
Server instance 2 7779 7780 27016 27021
Server instance 3 7781 7782 27017 27022
Server instance 4
(completely different ports)
9999 10000 37015 32330
Note: Completely different ports are supported as well, with the only limitation the Steam server browser not be able to find game servers without providing also the query port if this goes above 27020.
Note: Peer port is used by Steam P2P protocol for in-game browser advertising (Epic instead uses 80 and 443 standard ports with TLSv1.2), in the past (between patch 213.0 and 311.78) it was used for direct UDP socket connections (now disabled) and so it is sometimes wrongly referred as raw UDP port.

Operating system

Windows

The server requires Microsoft Visual C++ 2013 Redistributable X64 version and the last revision of the DirectX End-User Runtimes (June 2010) to be installed. While like the game ShooterGameServer supports Windows operating system from Windows 7 and beyond, it is highly recommended to use a supported operating system by both Microsoft and Steam. This translates on Windows 10 Version 22H2 and beyond or Windows Server 2016 and beyond. Please note Windows Server requires additional setup to support crossplay with EPIC/EGS game clients (read below).

Windows Server editions and crossplay with Epic players

Unlike consumer editions (e.g.: Windows 10), Windows Server editions lack of some certificates pre-installed, preventing the ShooterGameServer to work properly and to appear on game server list for Epic users. The missing certificates can be obtained from https://dev.epicgames.com/ (or just directly from http://crt.r2m02.amazontrust.com/r2m02.cer). They must be installed twice, both for "Current User" and "Local Machine", both "Place all certificates in the following store", both "Trusted Root Certification Authorities". Finally, a restart of the system is required. This should make correctly setup servers for EPIC players to work if hosted under Windows Server.

Linux

64-bit Linux servers require 32-bit binaries to install/run steamcmd.

sudo apt-get install lib32gcc1

The game server requires glibc 2.14 or greater. Ubuntu 14.04 (and newer) and Debian 8 (Jessie) satisfy this requirement automatically, but older versions, such as Debian 7 (Wheezy), do not. To install the required version of glibc on a Debian 7 (Wheezy) host:

  1. Add the following lines to /etc/apt/sources.list:
    # Experimental/unstable (sid) repositories
    deb http://ftp.debian.org/debian experimental main
    deb http://ftp.debian.org/debian sid main
  2. To update the host's available packages list and install the updated glibc library package, run the following commands via sudo or a root shell:
    apt-get update
    apt-get -t experimental install libc6-dev
Note: This procedure does not upgrade the host to Debian Unstable (sid); only glibc itself and any packages it depends upon are updated.

For other older distributions that don't include glibc 2.14 or newer, refer to the distribution's documentation and support forums for guidance.

Open Files Limit
Note: This section doesn't apply if you'll be using systemd to launch the dedicated server (as described below in #Automatic Startup), as it can set this limit at runtime.

To ensure that the host's open files limit is high enough to support the game server:

  1. Add the following lines to /etc/sysctl.conf:
    fs.file-max=100000

    then run the following command via sudo or a root shell to apply the change:

    $ sysctl -p /etc/sysctl.conf
  2. Add the following lines to /etc/security/limits.conf:
    *               soft    nofile          1000000
    *               hard    nofile          1000000
  3. Add the following line to /etc/pam.d/common-session:
    session required pam_limits.so
Warning: Without these changes, the game server may not successfully launch. If the server appears to start, but uses a high amount of CPU time without using at least 5.5GB of RAM, it hasn't been able to open all the files it needs and the above change should be applied.

Tuned is a daemon that monitors the use of system components and dynamically tunes system settings, currently only on RHEL7, CentOS7.x and Fedora.

Note: You need to set tuned to “throughput-performance”. Otherwise, all changes in /etc/security/limits.conf will ignored!

SteamCMD

The dedicated server is available for both Linux and Windows platforms. For both platforms, SteamCMD is used to download the server files. Refer to that page for detailed instructions on its installation and usage; the instructions included in the steps below are deliberately concise for space considerations.

Remember that you can use the force_install_dir <path> SteamCMD command to change the default installation location.

Server Installation

  1. Install SteamCMD on your host system.
  2. Create a folder to store the server files on a volume with at least 25GB of free disk space. The server files consume more or less than 18 GiB of space, but it's wise to plan for saves and future content updates which will require additional drive space.
  3. Launch SteamCMD on your host and use it to download the server files. Note: remove the < > and replace them with your installation path between double quotes (e.g.: force_install_dir "C:\Ark Server" on Windows). Use the app id 376030 for Survival Evolved or use 445400 for Survival of The Fittest.
    Steam> force_install_dir <install_dir>
    Steam> login anonymous
    Steam> app_update 376030 validate
    Steam> exit
    Alternatively, run from command line:
    steamcmd +force_install_dir <install_dir> +login anonymous +app_update 376030 +quit

    Replace <install_dir> with the full path to the folder created in Step 2. On Linux, this will be a path like /home/steam/servers/ark. On Windows, this will be a path like C:\arkserver.

  4. Create a script to launch the server with your desired options and settings. For simplicity, place it in the same folder where the server files were downloaded. On Windows, this is a batch file; on Linux, this is a shell script. Examples are provided below. For both platforms, the server options are specified with the same basic syntax. For a more deep comprehension and a guide about server settings, have a look at the server configuration page.
    • On Windows, create a text file named start_server.bat and place it in YOUR_ARK_SERVER_FOLDER/ShooterGame/Binaries/Win64/ (remove the '<' '>' symbols!)
      ShooterGameServer.exe TheIsland?SessionName=<server_name>?ServerPassword=<join_password>?ServerAdminPassword=<admin_password>?Port=<port>?QueryPort=<query_port>?MaxPlayers=<max_players>
      
    • On Linux, create a text file named server_start.sh and place it in YOUR_ARK_SERVER_FOLDER/ShooterGame/Binaries/Linux/ (remove the '<' '>' symbols!)
      #! /bin/bash
      ./ShooterGameServer TheIsland?SessionName=<server_name>?ServerPassword=<join_password>?ServerAdminPassword=<admin_password>Port=<port>?QueryPort=<query_port>?MaxPlayers=<max_players>
      

      After creating the script, make it executable:

      $ chmod +x server_start.sh

    Apart from Windows or Linux, replace <server_name> with the desired name for your server, <join_password> with whatever password players must provide to join your server and <admin_password> with the password that must be provided to gain administrator access to the serves. If no player join password is desired, remove the entire option from the list (including the ?ServerPassword= parameter itself). Set the number of players slots with <max_players>. Specify the game port (<port>) and the query port (<query_port>). These will be needed to be port-forwarded as well (see section below).

  5. Finally, to launch the server, run the script created in the previous step.

Port Forwarding and Firewall

For your server to become visible in both the Ark server lists and the Steam lists, do the following:

Windows (Firewall and Allow Rules)

  1. On Windows, click on Start and search for "wf.msc" without the quotes. Right click on it and choose the "Run as administrator" option.
  2. Click "Inbound Rules" on the left panel, then click "New Rule..." on the right panel.
  3. When the New Inbound Rule Wizard opens up, select Port, then Next.
  4. The wizard will present options for choosing the protocol and specifying ports. Select "UDP" and "Specific local ports". List the Query and Peer ports interval, as well the Steam query port, then select Next to continue. Example:
    For a default (one server only) setup list them as 7777-7778, 27015
    For a multiple instance setup like the one listened above, list them as 7777-7782, 9999-10000, 27015-27019, 37015
  5. Select "Allow the connection" and continue with the wizard.
  6. Finally enter a name (required) and a description (optional). It is recommended to append the protocol (UDP or TCP) to the rule name.
  7. If you are using also RCON repeat the above procedure but selecting "TCP" as protocol and the RCON port(s) chosen. Example:
    For a default (one server only) setup list them as 27020
    For a multiple instance setup like the one listened above, list them as 27020-27022, 32330
  8. When finished, you should have a rule for UDP ports in the Inbound Rules section and eventually a TCP one.
  9. If needed it is always possible to change these rules to add or remove ports on your setup needing.
Note: with default Windows settings there is no need to create outbound rules in the "Outbound Rules" section.

Linux

For most Linux distros, if there is a firewall at all it will be iptables based. Most modern distributions will use a different interface, it's a good idea to use that instead of direct iptables commands.

All firewall changes must be made either as root or with sudo. These open ports 7777 7778 and 27015 for UDP and optionally 27020 for TCP. You may want to adjust the list of ports you need by editing the "for port in..." line.

UFW

This script will open the ports in a way that will persist across reboots. UFW is the firewall on Ubuntu

 #!/bin/sh
 if [[ $EUID -ne 0 ]]; then
     echo "This must be run as root"
     exit 1
 fi
 for port in 7777 7778 27015; do
     ufw allow $port/udp
 done
 #Uncomment the next if you want to open the default rcon port
 #ufw allow 27020/tcp

FirewallD

This script will open the ports in a way that will persist across reboots. FirewallD is the firewall on RHEL7, CentOS7.x and Fedora.

 #!/bin/sh
 if [[ $EUID -ne 0 ]]; then
     echo "This must be run as root"
     exit 1
 fi
 for port in 7777 7778 27015; do
     firewall-cmd --permanent --add-port $port/udp
 done
 #Uncomment the next if you want to open the default rcon port
 #firewall-cmd --permanent --add-port 27020/tcp
 firewall-cmd --reload

iptables

Keep in mind that this is only a temporary solution and should only be used if neither of the other scripts apply for your system. To make it safe for reboots see the documentation of your distribution, how to add firewall ports to the existing configuration files - or how to add scripts to the boot process.

 #!/bin/sh
 if [[ $EUID -ne 0 ]]; then
     echo "This must be run as root"
     exit 1
 fi
 for port in 7777 7778 27015; do
   iptables -t filter -I INPUT -p udp --dport $port -j ACCEPT
 done
 #Uncomment the next if you want to open the default rcon port
 #iptables -t filter -I INPUT -p tcp --dport 27020 -j ACCEPT

Router Port Forwarding

The same ports of the server setup must be also forwarded on the router. There are many websites with tutorials on port forwarding. It is highly suggested you visit portforward.com, which offers tutorials for the majority of routers. For Virtual Private Servers, please refer to your host knowledge base and support site.

You must forward both UDP and TCP local ports for your server to show up on any lists. You can make sure your ports are open by using the tool from portforward.com, that is, after you enter the ports that you have forwarded in the start_server.bat file you should have created earlier.

For example, start ShooterGameServer.exe TheIsland?SessionName=<server_name>?ServerPassword=<join_password>?ServerAdminPassword=<admin_password>?Port=7777?QueryPort=27015?MaxPlayers=<max_players>

Finding Your Server in Lists

You can access your server via the Ark unofficial list or via the Steam servers list or. Just search for your name in the Ark list, or find your IP address in the Steam server list (remember if Steam Query port is above 27019 this must be specified as well)[1]. For Steam players it is best to add the servers with IP:PORT to your Steam favourites and for all players joining using the 'favourites' tab in game: the game list has a limit on the servers it can search at per minute and especially for Steam players this can take a good amount of time to find it.

Automatic Startup

Windows (via Scheduled Task)

You can configure a scheduled task to automatically run a batch file and start the dedicated server when the system boots.

  1. Open 'Task Scheduler'.
  2. Create Basic Task.
  3. The 'Create Basic Task Wizard' will appear, name the task whatever as desired.
  4. Set the Trigger to 'When the computer starts'.
  5. Set the Action to 'Start a program'.
  6. Browse to the program/script you wish to start (which is the .BAT batch file that starts the server).
  7. Depending on how the batch file works, it may need to set the "Start in (optional)" path, so the working directory of the batch file is correct. If the batch file simply contains the "start ShooterGame ..." command, then it should be set the "Start in (optional)" path of the scheduled task to the directory containing the batch file.
  8. Before creating the scheduled task, mark the checkbox "open properties window" after it's created.
  9. In the General Tab under the Security Options frame, it can be chosen "Run whether user is logged on or not" depending on the needs.

Linux (via systemd)

Note: systemd is not available for Ubuntu 14.04.

As an alternative to using a script to launch the dedicated server manually, hosts running systemd can be configured to automatically start the dedicated server when the system boots. When using this method to manage the server, using GameUserSettings.ini to specify its settings is highly recommended. Refer to Admin Game Commands for more information.

  1. Create a file named /etc/systemd/system/ark-dedicated.service with the following contents:
    [Unit]
    Description=ARK: Survival Evolved dedicated server
    Wants=network-online.target
    After=syslog.target network.target nss-lookup.target network-online.target
    
    [Service]
    ExecStartPre=/home/steam/steamcmd +login anonymous +force_install_dir /home/steam/servers/ark +app_update 376030 +quit
    ExecStart=/home/steam/servers/ark/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?SessionName=<session_name>
    WorkingDirectory=/home/steam/servers/ark/ShooterGame/Binaries/Linux
    LimitNOFILE=100000
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s INT $MAINPID
    User=steam
    Group=steam
    
    [Install]
    WantedBy=multi-user.target

    The ExecStart line specifies the command to run in order to start the service. It uses the same syntax as the startup examples shown above (in #Server Installation), with all the same arguments, but here it's important to adjust it to reflect the location of your ARK dedicated server on the host. Use the full path to the server executable, as shown above.

    Be sure to replace <SESSION_NAME> with the desired session name for your server as well.

    Finally, adjust the User and Group settings for your host. Without these two options in ark-dedicated.service, the dedicated server will be run as the root user. This is unsafe, as any vulnerability in the dedicated server could result in an attacker gaining remote superuser access on the host.

    It's recommended to run the dedicated server in an unprivileged account used solely for this purpose. In the example above, the user account "steam" is used. It's a member of the "steam" group, which is generally created along with the account.

    WorkingDirectory option is required to fix some issues. (For example, not having WorkingDirectory set will fail to download mods (if using with -automanagedmods))

  2. To install systemd:
    apt-get install systemd systemd-sysv

    You will need to reboot after installation to initialize systemd.

    Activate the new service so it starts automatically when the host boots by running the following command via sudo or a root shell:

    # systemctl enable ark-dedicated

    After running this command, the dedicated server will automatically start when the host does. The command doesn't start the server immediately, so to launch the dedicated server after enabling it, run:

    # systemctl start ark-dedicated

After following these steps, your server should be up and running and be automatically managed by the host on startup and shutdown.

Post-Setup Management

The server can be stopped by running:

# systemctl stop ark-dedicated

and its current status can be viewed (whether it's running or not) by running:

# systemctl status ark-dedicated
Note: If you need to update the ark-dedicated.service file (to change the dedicated server's startup options or to adjust its path), run the following command to ensure your changes are applied:
# systemctl daemon-reload

Updating

To update the server when a new version is released, repeat the same SteamCMD commands shown in the previous section. Be sure to use the correct set of commands for your platform. Refer to SteamCMD's documentation for details on automating this process.

If you use the systemd startup file you can easily integrate the update-mechanism to be run before every start of the game.

SteamCMD provides additional tools to make installation and updates easier and more seamless.

Console Commands

While running the game, the command console can be accessed with either the [~] (tilde) or [TAB] keys (depending on game version, default configuration and your keyboard layout). Once in the console, to activate administrator commands, enter:

enablecheats <admin_password>

Replace <admin_password> with the server's administrator password.

Refer to Admin Game Commands for a list of available commands.

If the console can't be opened in-game, exit the game, open the game's DefaultInput.ini file (located in your Steam library in the folder named steamapps\common\ARK\ShooterGame\Config) with a text editor and locate the line (near the bottom of the file) that reads:

;+ConsoleKeys=Tab

Remove the semicolon (;), changing the line to read:

+ConsoleKeys=Tab

Save the file and launch the game. The console should be accessible.

Backing Up Server Data

To make a backup of the server data, simply copy the folder named ShooterGame/Saved (and its content) to the desired backup location.[2] This folder contains all tribe, player and world data, as well configuration files, logs and eventually cluster data for the server. Performing a backup is recommended before updating a server to a new release.

Troubleshooting

Server loses characters or world data upon restart

If your server isn't retaining characters or world data when it's restarted, it may not have full access to the folder where it's installed.

The first time the server is run, it should create a folder named ShooterGame/Saved containing various configuration and save files. If the server has run at least once but hasn't created this folder, it may not have been able to create new folders and files there. Verify that the folder where the server is installed is readable and writable by the user account that actually runs the server. (For Windows servers, check the status of User Account Control)

The server software, by default, is set-up to automatically save world data every 15 minutes. If your server crashes before the first 15 minutes are up, you will not have any data saved.

Linux server exhibits high CPU usage and low memory usage (Below 1GB)

This can occur when the server can't open all the files it needs due to an insufficient open files limit on the host. Refer to the Linux section above and follow the procedure to increase the host's open files limit.

Tool - ARK Server Manager

You can also use this tool to manage your server when it is installed: https://steamcommunity.com/sharedfiles/filedetails/?id=468312476

ASM.png

The Ark Server Manager is designed to help you set up and maintain your own Ark: Survival Evolved (tm) dedicated servers. It provides a simple user interface allowing you to create and edit server profiles containing all of the settings you need to customize the playing experience for you and your friends.

What it does:

  • Manages the SteamCMD tool and Server installations/updates.
  • Organizes settings and writes INI files and command-line arguments automatically.
  • Tracks server status and allows direct control of server state.
  • Save and load server profiles - even import directly from an existing server deployment.
  • Scheduled updates server files and mods.
  • Scheduled save backups with in-game lag warning for players.
  • Auto-manage Windows firewall rules
  • Works with Survival of the fittest.

Notes

If you're planning to have players join from the Epic Games version of ARK, you must have the -crossplay and -PublicIPForEpic=<IPAddress> command line options set (read more at Server_configuration).

References

External links