ARK: Survival Evolved

ARK: Survival Evolved

Nincs elegendő értékelés
Installing an ARK: Survival Evolved Dedicated Server on Debian, CentOS, and Arch Linux
Készítő: Qai
This guide provides the steps to install an ARK: Survival Evolved dedicated server on x64 versions of Debian 8+, CentOS 7+, and Arch Linux. The method can be extended pretty much in-tact to other Linux distributions that use systemd[www.freedesktop.org] provided that the necessary libraries in Step 2 are installed accordingly.

The assumption is made that you are already familiar with Debian/CentOS/Arch and have the know-how to accomplish the operating system tasks in this guide. This is not a guide on how to use Linux in general or Debian/CentOS/Arch in particular.

Steps 1-7 will get the server up and running. Steps 8-14 are for server maintenance and extending functionality.

References:
   
Díjazás
Kedvenc
Kedvenc
Törlés
1. Forwarding/Opening Ports
Forward/open the following ports on your router/firewall:
  • 27015 UDP (query port for Steam's server browser)
  • 27020 TCP (RCON for remote console server access)
  • 7777 UDP (game client port)
  • 7778 UDP (raw UDP socket port; always game client port +1)
2. Installing Required System Libraries
The 32-bit binaries for glibc[www.gnu.org] are required to run SteamCMD (Step 3), even when running a 64-bit version of Linux. To install these binaries execute the following commands:

Debian
$ sudo apt-get install lib32gcc1

CentOS
$ sudo yum install glibc.i686 libstdc++.i686

Arch
$ sudo pacman -S lib32-gcc-libs

Before you execute the above command in Arch, you need to first enable the multilib repository. You do this by uncommenting the following two lines in /etc/pacman.conf:

from this:
#[multilib] #Include = /etc/pacman.d/mirrorlist

to this:
[multilib] Include = /etc/pacman.d/mirrorlist
3. Installing SteamCMD
SteamCMD is the command-line version of Steam used to install servers of all sorts, both Valve and non-Valve products. In addition to ARK, examples of other games that use SteamCMD for its servers are Left 4 Dead 2 (Valve) and Arma 3 (Bohemia Interactive).

Install SteamCMD as a non-root user. To do this, execute the following command:


in one of the following directories (create as necessary):

/home/<USER>/steam/steamcmd

or

/home/steam/steamcmd

The first option is if you want to use an already-existing user account denoted by <USER>. The second option is if you create a user named 'steam' used specifically for server-related purposes. In this case <USER> is 'steam' and the path is truncated accordingly. The rest of the guide will assume the server is installed under the user 'steam'.

For security reasons, avoid installing SteamCMD in locations such as /usr, /usr/local, /opt, etc. By installing in /home, the read/write priveleges and authorized access are significantly restricted.
4. Downloading Server Files
Execute the following command in the steamcmd directory created in Step 3:

$ ./steamcmd.sh

Then, enter the following commands at the Steam> prompt:

Steam> login anonymous Steam> force_install_dir /home/steam/servers/ark Steam> app_update 376030 validate Steam> quit

If the download does not finish and instead times out and returns you to the Steam> prompt with an error message, then re-enter 'app_update 376030 validate' until installation is successful. You may have to do this several times.

It is also possible to initiate the download as a single command:

$ ./steamcmd.sh +login anonymous +force_install_dir /home/steam/servers/ark +app_update 376030 validate

A final argument +quit can also be added to the preceeding command so as to avoid having to manually exit SteamCMD. However, my preference is to avoid doing so in the event that the update encounters errors and the app_update command needs to be re-executed. As is commonly done in Linux, the single-line command can also be aliased to save on typing and memorizing (don't forget to adjust the execution path for steamcmd.sh).

As was the case for SteamCMD, for security reasons the server should also be installed in /home. The install path is /home/steam/servers/ark.
5. Create systemd Service
Add an entry to systemd[www.freedesktop.org] so the server can be started as a proper system service. To do this, create a file named ark-server.service in the following location:

/etc/systemd/system/ark-server.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/steamcmd.sh +login anonymous +force_install_dir /home/steam/servers/ark +app_update 376030 +quit ExecStart=/home/steam/servers/ark/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?listen?SessionName=<SESSION_NAME> -server -log LimitNOFILE=100000 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s INT $MAINPID User=steam Group=steam [Install] WantedBy=multi-user.target

Replace <SESSION_NAME> with the text to appear in the browser listing. Also note that ExecStartPre and ExecStart are both just single lines. Steam may be causing line-wraps in your viewing of this guide so as to make it appear as if there are additional lines between ExecStartPre, ExecStart, and LimitNOFILE. The correct lining is:

[Service] ExecStartPre=... ExecStart=... LimitNOFILE=... ExecReload=... ExecStop=... User=... Group=...

Also notice that the service is registered under the User+Group 'steam'. Change accordingly if needed.

The above code starts the server with The Island as the world map. To use The Center, change TheIsland -> TheCenter (no spaces in TheIsland or TheCenter) in the ExecStart line.

The ExecStartPre line is simply the single-line command in Step 4 for updating the server. Therefore, when the server is started it will automatically first check for updates before proceeding to initialize. This line can be removed if updates are handled manually and the service is used simply to start the server. Additional information on modifying system service files can be found here:

https://www.freedesktop.org/software/systemd/man/systemd.service.html.

Note: Various other guides instruct to create scripts for launching the server and also instruct to modify certain system settings to increase the number of open files allowed in order to satisfy the requirements for ARK. Using the above systemd approach eliminates the need for using such scripts and modifications as everything is automatically taken care of when the server is run as a proper system service.
6. Initializing the Server
Start then immediately stop the server (after it completes its first initialization):

$ sudo systemctl enable ark-server $ sudo systemctl start ark-server $ sudo systemctl stop ark-server

Starting the server once will generate the necessary default configuration files, which can then be modified to tweak the server's settings.

The enable command is what registers ark-server.service as a service and allows the server to automatically start on boot. To disable automatic startup and the service in general, execute the following command:

$ sudo systemctl disable ark-server

Note the difference in usage of enable versus start and disable versus stop: enable and disable relate to registering and de-registering the service with the operating system, while start and stop just activate and de-activate the service without affecting its registered status with the operating system.
7. Configuring the Server
Configure the server's settings to your liking via the following two files*:

/home/steam/servers/ark/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
/home/steam/servers/ark/ShooterGame/Saved/Config/LinuxServer/Game.ini

then start the server again:

$ sudo systemctl start ark-server

Consult the following for a comprehensive list of configuration options:

http://ark.gamepedia.com/Server_Configuration

* It is possible to add some (but not all) settings directly to the ExecStart command line in Step 5 instead of the above .ini files. A lot of people prefer to (incorrectly) use this method. The .ini configuration files approach is the preferred method, especially if only one game instance is being run. The command line arguments approach has two main uses: 1) to quickly change certain settings for testing and debugging purposes, and 2) to easily switch between multiple different game instances (different maps, mods, etc.), with the intention of still playing other instances. This allows one to maintain a single set of .ini files common to all instances. Moreover, it is possible to register multiple different system services as done in Step 5 with differing ExecStart lines in order to facilitate switching between different game instances. For example, instead of ark-server.service, one could create ark-server-island.service and ark-server-center.service, and each of these can have its own set of mods loaded via ExecStart, while sharing the same base .ini configurations.

Leaving the default-generated settings will allow connections to the server at this point. Also, once the server is started it is immediately visible and joinable (in ~1 min) in the public server browser. It's a good idea to set a join-server password until all configurations have been completed:

GameUserSettings.ini
[ServerSettings] ... ServerPassword= ...

To see the server, go to View -> Servers in the main Steam client. Then, navigate to the Favorites tab -> click on Add a server -> enter the IP address of the server. If it is not visible, then there is likely a problem with port forwarding and/or the firewall. Adding it to favourites here will also list it under the Favorites filter in-game.

Note: After the server is started, it will take approximately 1 minute to initialize everything before it is visible and joinable.
* 8. Checking Server Status
The following command lets you check the status of the server:

$ sudo systemctl status ark-server
* 9. Updating Service File
After any future updates to ark-server.service, run the following command to ensure the changes are applied:

$ sudo systemctl daemon-reload
* 10. Making a Backup
All game states are saved in:

/home/steam/servers/ark/ShooterGame/Saved/SavedArks

You will see the following files in the above directory:
  • TheIsland.ark - Current game state
  • TheIsland_DATE_TIME.ark - Previous game state
  • #.arkprofile - Players that have joined the server
  • #.arktribe - Tribes on the server
You will likely see a lot of TheIsland_DATE_TIME.ark files. They can be safely deleted. It's a good idea to keep a handful, though (the server only keeps the 20 most-recent saves).

To make a backup, simply copy the above files to a safe location. It's good practice to just backup the entire directory at regular intervals (e.g., once or twice a day) and keep a 1-2 week's worth of archives. Each game state is ~30 MB in size.

The frequency that the server will create a saved state can be set in the server configuration files.
* 11. Restoring a Backup
Take the TheIsland_DATE_TIME.ark that was backed up in Step 10 that you want to restore as the current game state and rename it to TheIsland.ark. Stop the server, place the file back into the /SavedArks directory (overwriting the current file), and restart the server.
* 12. Updating the Server
Whenever an update is released, simply 'stop' the server, execute Step 4, then 'start' the server. It is not necessary to 'disable'/'enable' the server, just 'stop'/'start'.

Make sure to keep backups in case you need to roll-back.
* 13. Adding Mods
There are many fantastic mods available on the Steam Workshop. While these mods can significantly enhance ARK, they can also be the downfall of your server if not selected and managed carefully.

In general, the two prime considerations that should be given when selecting mods are:
  1. They should be 'clean' and 'stackable'. This means that they do not interfere with or alter any core game files, and that they can be used alongside other mods. Many mods specify in their Workshop descriptions that they satisfy these criteria. This first consideration will not necessarily be satisfied in the case of 'total conversion' or 'overhaul' mods.

  2. Is the mod worth having at the cost of additional maintenance and time spent diagnosing possible future errors? Does your server really need 100 mods?

Before installing any mods, stop the server.

To install mods, the first thing that should be done is to add the mod IDs to the server configuration file. To do this open:

/home/steam/servers/ark/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini

and under the [ServerSettings] block add/modify the ActiveMods line:

[ServerSettings] ... ActiveMods= ...

Mods should be separated using a comma without white spaces following the comma, i.e., use #,# and not #, #.

For example, two mods that I like to use are Structures Plus and Platforms Plus. They would appear in GameUserSettings.ini as:

ActiveMods=731604991,719928795

These IDs are obtained from the corresponding Workshop urls:

Structures Plus: http://steamcommunity.com/sharedfiles/filedetails/?id=731604991 Platforms Plus: http://steamcommunity.com/sharedfiles/filedetails/?id=719928795

When creating the ActiveMods list, the order may be important as some mods require that they be loaded before others. Load order is left-to-right. That means that the left-most mod, or the first in the list, will be loaded first by the server, while the right-most mod, or the last in the list, will be loaded last by the server. Workshop descriptions will typically indicate if load order is important for a particular mod. Otherwise, if order is important but not specified, then it will need to be determined by trial-and-error.

The next step is to get the actual content onto the server. Navigate to the Workshop page of a particular mod, then use your Steam client to subscribe to the mod on the computer where you have the user-playable installation of ARK installed. The subscription should trigger the content download.

Once the download is complete, start ARK on that computer and wait at the main menu screen until the mod is actually installed. Mod installation status is displayed in the bottom-right of the main menu screen.

Then, exit ARK and navigate to the following location on the computer where the user-playable version of ARK is installed:

\steamapps\common\ARK\ShooterGame\Content\Mods

Locate the folder and the .mod file corresponding to the ID value you noted down from the Workshop url. Copy those two items to your server:

/home/steam/servers/ark/ShooterGame/Content/Mods

The server can now be started and the mods will be loaded.

If a user attempts to login to the server and they do not have a mod in the list, then the mod will be automatically downloaded. Depending on the number and/or sizes of the mods, users might timeout and get disconnected from the server when attempting to join if downloading and installing takes too long. Several attempts to join the server might be necessary until everything is downloaded and installed.

It is at this point that the issue of the number of mods on the server comes into play. The server does not update mods automatically. The process of copying mods over to the server manually must be done each time there is an update to a mod. This becomes problematic when considering a lot of mods.

First of all, when a Workshop content update triggers in the Steam client, there is no information as to what exactly from the Workshop was updated. So there is the problem of tracking down which mod was updated.

The second problem is that Workshop content updates are pushed automatically to clients (the Steam option to not automatically update game content does not apply to Workshop content). Therefore, it is possible that users are locked out of a server because of incompatibilities between their version of the mod and that which is installed on the server. Then, instead of a simple update and continuing to play the game, time is wasted trying to hunt down which mod needs to be updated.

A third possible issue is if a game update breaks a mod's compatibility with the game. Until patched by the mod authors, you could end up losing dinos and your base.

Therefore, consider using only a handful of carefully-selected stable, and preferrably actively-maintained, mods (10 is a reasonable number, 20 is pushing it) that can be quickly looked up on the Workshop pages for modification dates in order to track down which mods need to be updated.

The higher the number of mods used, the higher the probability of more frequent updates. You don't want to be updating the server on a daily basis.
* 14. Server Tools
The following are comprehensive tools for all things server-related (these are not mine, but rather just ones that I particularly like):

https://github.com/FezVrasta/ark-server-tools

It is recommended to get acquainted with and use these tools after the initial installation. While the tools can also install the server, it initially takes longer to figure out how the tools work than it is to just follow Steps 1-7. However, beyond the installation phase, these tools are indispensable.

Think of the following analogy: you are on foot about to cross an intersection. Crossing by foot will likely get you across more quickly (Steps 1-7) than hailing a cab (the Tools). However, once you do cross, you are limited by how far you can go by walking compared to in-vehicle. People typically want to get a server up and running as quickly as possible. The details can come later =)
32 megjegyzés
Minipomme 2019. aug. 9., 8:52 
Hi ! I have some issues on my dedicated server, for users they can see all mods loaded, but in game, no mods works. Have you a solution ? Please
Ator 2017. nov. 18., 3:17 
Hi @Qai

Ty for all, now I have other problem.

Good, when ark gets an update my servers are updated alone and they are turned on again, the problem is that for some time, some of my servers do not start again (sometimes it happens to Ragnarok and other times to others), they can spend hours and do not start.
When I do an arkmanager status, it says:
Server running: Yes
Server listening: No

And by manually stopping and restarting, the same thing happens again. To fix it I have to use a backup much later than when the server did not restart.

An example:
https://gyazo.com/60f18dacb14178500175d4536e4a5340

the server stopped working at 10 am
And the backup that works is at 8 a.m.

There are 2 hours in which the server has worked but the progress has not been saved.

Thanks for trying to help me :)
Qai  [készítő] 2017. szept. 3., 15:21 
For cron, have a look at:
https://www.cyberciti.biz/faq/linux-show-what-cron-jobs-are-setup/

For running multiple servers on the same machine, have two separate .service files and try adding the following to the ExecStart line of each:

Port=<#>?QueryPort=<#>?

for both of your servers. Port and QueryPort cannot be the same as each other and they have to be different for both servers (don't forget to open/forward all necessary additional ports). For example:

/etc/systemd/system/ark-server-island.service
ExecStart=<...>/ShooterGameServer TheIsland?listen?Port=<7777>?QueryPort=27015?

/etc/systemd/system/ark-server-center.service
ExecStart=<...>/ShooterGameServer TheCenter?listen?Port=<7779>?QueryPort=27025?

I've never run more than one server simultaneously before, so I'm just guessing. The above might not work, but it's the first thing that I would try.
Suky 2017. szept. 3., 13:54 
Hello again! I need your help, I'm doing a cluster with the server where I have the Arkmanager and I do not know how I can configure it to be able to use it with both servers at the same time, we have followed your guide and we have the arkmanager in the / etc folder. The new server will be called Ark2 and I do not know how to put the path where it should find it without removing the other one. And the last question, how can I see the cron job tasks are using by the arkmanager install cronjob ? Thank you very much for your help!
Qai  [készítő] 2017. aug. 27., 10:24 
Backing up while the server is on isn't a problem.

If you want to use cron independently of the tools (i.e., directly at the OS level), then the following is a good explanation of how to do so:

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

If you want to use the tools instead, then it's via the command "install-cronjob" (there's a section on how to use this in the tools readme).

If you use the "update" command with the tools, it will shut down the server for you before updating. Passing the "--backup" argument will only cause it to save a backup before the update, but the server has to shut down. The "--warn" argument simply alerts people in-game that the server is going down.

Just keep in mind that if you are going to use cron, then to make sure your distro has a cron utility installed (e.g., cronie, fcron, dcron, anacron, etc.) as you might not have one installed by default.
Ator 2017. aug. 27., 9:49 
Hello, I would like to know if the backups can be done while the server is on, I would also like to know how to program the autoupdates chronjob, if I use the update command while the server is on will it work? And if so what parameters I have to use --warn?
Thanks for your time :)
Qai  [készítő] 2017. júl. 19., 10:19 
@Aoi Blue
My guide is on Debian, CentOS, and Arch and I state in the main description: "The method can be extended pretty much in-tact to other Linux distributions that use systemd provided that the necessary libraries in Step 2 are installed accordingly."

If people do not understand how to apply this guide to other distros, then they shouldn't be using Linux. The important point is not "distro Y is a derivative of distro X therefore everything is automatically applicable". Derivatives are not necessarily compatible in all respects with the parent distro, and I don't keep up with the inner workings of distros I don't use and can't verify the steps in this guide. That's why I emphasize familiarity with systemd and the necessary libraries.
Suky 2017. júl. 19., 6:27 
@Qai Thank you so much for the info, I will try to do it and I will tell you how it has gone!! :steamhappy:
Aoi Blue 2017. júl. 19., 1:53 
In the case of not wanting to mention distros you could just say "and derivatives/relatives"

Most Linux geeks know what this means, and anyone else can ask a Linux Geek.
Qai  [készítő] 2017. júl. 18., 19:54 
@Aoi Blue

Mentioning other distros then opens up the flood gates of others wanting their favourite distros mentioned etc. I picked 3 very common distros that are frequently used for things server-related and also happen to be distros that I personally use.