Dedicated Server Setup: Linux and Wine

Introduction
This guide is an collection of all steps that can or need to be taken to set up an working Conan Exiles Server. Additionally side info about settings and adding mods ins included.

Basic requirements

 * A computer with the minimum dedicated server system requirements is required.
 * Basic knowledge of the OS you will be using. (Linux)
 * Basic knowledge of SteamCMD.
 * Knowledge of Wine.
 * Knowledge of Shell scripts and how they work.
 * Knowledge of Screen and Screen commands. (more info)
 * Knowledge of Crontab and structure.

Installation
The Linux Guide will take place in the command line, as it is a relatively fast way to set up any Gameserver. This Guide is for 'Ubuntu'.

Video of this installation can be found here.

Setting Up SteamCMD
You will need to edit  file to enable all multiverse, universe and restricted repositories. It should look similar to the following when you're done. Substitute 'focal' for 'bionic' if you're on 20.04 Focal Fossa: You need to install some dependencies and enable 32bit binaries:

sudo apt-get install lib32gcc1 software-properties-common -y sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get upgrade

Now you can finally install SteamCMD:

sudo apt-get install steamcmd

Do not run SteamCMD while operating as the root user - to do so is a security risk. To run SteamCMD and your Servers in an safe environment, create an user account named 'steam': sudo useradd -m -s /bin/bash steam

Finally, link the SteamCMD executable so it is startable by typing steamcmd from anywhere:

sudo -iu steam mkdir bin cd bin ln -s /usr/games/steamcmd steamcmd exit

Using SteamCMD to install the Conan Exiles Server
First, become the 'steam' user. As mentioned above, you should never run steamcmd as the root user since this creates a security risk: sudo -iu steam Configure the steamcmd platform to be 'windows':

SteamCMD will now open and install any pending updates. After this is done, execute the following command to login to the SteamAPI:

login anonymous

After this is done, you will want to select an directory for your Server. Note that if you do not give a full pathname (e.g. /home/steam/server) then the dir will be created under /home/steam/.steam/steamcmd/:

force_install_dir

After selecting your directory, use this command to download the Server Files:

app_update 443030

All in one installation line looks like this. Congratulations, your Server will now download and you can continue with the next step!

Installing Wine and Screen
Wine is an program that allows Windows Programs to be run on Linux Distributions. We will use it to make the Conan Exiles Server compatible with Ubuntu. Screen will be used to run the Server in the background without the need to keep an Terminal open.

You'll need to run these commands as the regular user you login to your Linux box with, not the 'steam' user.

Install Wine by running the following Commands:

wget https://dl.winehq.org/wine-builds/Release.key sudo apt-key add Release.key The updated instructions (as of 10th may 2019) have the following lines instead: this guide worked with the above, but adding this for future reference. wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add The updated instructions (as of 7/12/2020) have the following lines instead: for Ubuntu 20.04 from Ububtu repositoriessud. The repositories were changed a while ago and you have a different one depending on your version of Ubuntu.

For Ubuntu 20.04 For Ubuntu 18.10 sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ cosmic main' For Ubuntu 18.04 sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' For Ubuntu 16.04 sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' Now you can finish off the wine install with the following. sudo apt-get update sudo apt-get install --install-recommends winehq-stable

For Ubuntu 20.04 Note: Wine is big and might take a while to install.

Now you will want to install screen and xvfb:

sudo apt-get install screen xvfb

Congratulations, you've done everything needed to be able to run the server comfortably!

Configuring the Server
There are various settings within various files in the directory. To make this as easy as possible, only Settings that can't or shouldn't be changed in game are listed. Various Additional Commands can be found below.

All .ini files are located under /ConanSandbox/Saved/Config/WindowsServer/

To create all the config files initially, from the steam user account run the server once using these commands: export WINEARCH=win64 export WINEPREFIX=/home/steam/.wine64 xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine /home/steam/InstallDirectory/ConanSandboxServer.exe -log

After a while (2-5 Minutes) press + to close the Server. All config files should now be present.

Engine.ini
Add these lines in this order at the Bottom of your .ini. [URL] Port=7777                ;The Port for your Server

[OnlineSubsystemSteam] ServerName=              ;The Name of your Server which is shown in the Server Browser ServerQueryPort=27015    ;The Port the SteamAPI will query your Server from ServerPassword=          ;The Password needed to access the Server

ServerSettings.ini
Add these lines at the Bottom of your .ini if they don't exist yet.

MaxNudity=                              ;Either 0, 1 or 2. 2=Full, 1= Partial, 0=None LogoutCharactersRemainInTheWorld=False  ;This option currently should be disabled as there is an issue with Bodies PVPEnabled=False                        ;Add this line to disable PVP AdminPassword=                          ;This option is important: Use this to change all Settings ingame later.

Game.ini
Add these lines at the Bottom of your .ini if they don't exist yet.

[ConanSandbox] UserID=steam [/script/engine.gamesession] MaxPlayers=20                         ;you can choose the max allowed players on the server [/script/engine.gamenetworkmanager] TotalNetBandwidth=4000000             ;careful changing the bandwith values as it may cause lags to your players MaxDynamicBandwidth=100000 MinDynamicBandwidth=40000

Running the Server
The Server can be run using the following Commands: sudo -iu steam cd  screen xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine ConanSandboxServer.exe -log

Alternatively you can place a start.sh in the Server Folder with the following content: Once your server is started, reaccess the Console by typing screen -r in the terminal, then retyping that Command with the PID attached if multiple Screen Sessions are running. screen -r  Once inside the console, stop the Server by using the + Shortcut.

Updating and Additions
To Update the Server, simply stop it using the above described method. After the Server has stopped, open SteamCMD in the Terminal by typing:

steamcmd +@sSteamCmdForcePlatformType windows

After that type:

login anonymous

After the login process is done, use this Command to update the Server: app_update 443030

When this process is finished, your Server should be up to date.

Shell script update Example update.sh inside update.sh you need to have the below information.

Known Problems

 * Running SteamCMD using scripts sometimes leads to problems that render the Server unusable. Solution: Do the manual steps as described above.
 * Dreamworld:Display: SQLite database open FAILED. Solution: Run as root account.
 * to unimplemented function msvcp140.dll.?_IsNonBlockingThread@_Task_impl_base@details@Concurrency@@SA_NXZ Solution: Delete game-db.shm and game-db.wal, additionally delete the Logs Folder.

Adding Mods
Adding mods can be done. See the SteamCMD command example shown below. This is only an example of a mod but what you need is the workshop id number which is shown in the address bar of your web browser.

Example: https://steamcommunity.com/sharedfiles/filedetails/?id= After the = sign there is a long number this number is associated with the workshop mod your looking at subscribing to or modding your server to. That number goes into what is shown up at the top as the 999999999 number above.

Ended up writing a shell script to kill the server process then update the game and then the workshop items I am using. The reason I automated this process is because mods are constantly being updated and if users have a miss match on there mods they won't be able to login to the server..

Below is an examples of shell scripts i wrote for this process..

Create a new shell script by using nano an editor in linux. By using the command: nano update.sh Place below code in the document the use ctrl - x and save it. Next you will want to create workshopmapupdate.sh To do this use nano as the editor as performed above for the first part of the process and create the file. Example: nano workshopmapupdate.sh Once the below information is copied and pasted and adjusted for the mods you wish to add use ctrl - x then save it. ''The above should be written all in one line do not use enter to go to the next line.. This is a very very long command line. In place of the 1's you will want to put your first id number as gathered at the end of that hit space and put a plus sign to start the next command in this case we start off with the second workshop item 2's. You can add as many workshop mods that you want but they All must be on the same line. End the command process by using a plus sign then exit after the last work shop map has been placed in your shell script.''

The Mods will be downloaded to a file located in the home directory of the steam user that you are using.. This directory is hidden but can be accessed by using the cd commands like listed below.

Example: The folders located in this place is the mods that you are using you will need to later direct your modlist.txt to the .pak files located inside each of the folders.

Next we need to create the Mods folder.

Go into your saved directory where you have stored the server in our case we used a folder called server. Inside this folder look for ConanSandbox folder. You will want to change director into this folder by using the cd command like this.. Example: cd ~/server/ConanSandbox

After you are inside the ConanSandbox folder you will want to make a directory called: Mods Example command: mkdir Mods

Now you will want to change directory into mods to do this type: cd ./Mods

Use nano to create a file called modlist.txt Example command: nano modlist.txt

Here you will want to add the file locations to the .pak files of the mods you are using for your server.

Below is an example. Use ctrl-x command to save the file.

Now you will eventually want to automate this process by crontab. To access crontab type in commandline: crontab -e

UPDATE

Your start script should look like this if your using cron to start the game for automation. In this case the script is named start.sh and we located it in /home/user/server/ folder.

So the above is an example the file locations and how you can use crontab to automatically update your game server and the workshop mods using linux.

09-08-2019

Up until this point the above worked but some thing changed in the way SteamCMD handles shell scripts so now we update our severs like this here is an updated view of

crontab -e For some reason this wiki has word wrap turned on so I have uploaded a backup copy here to pastebin in hopes it helps. https://pastebin.com/7b6yX42a

Here is an example of killall.sh

Backing Up and Savefiles
In crontab -e you will want to put the correct file locations when running your script Here is an example of what crontab might look like.

Here is what that shell script might look like. Change the locations needed for your setup. Backup script name is autobackup.sh

Now you will want to make a directory for backup folder "mkdir /home/user/Backup"

You can also run the backup script manually by running the command "sh autobackup.sh"

Removing Mods
Removing a mod from the server and using the same database may cause issues.

When you remove a mod, those mods leave a lot of garbage behind.

This can cause undesired effects. Removing a mod is sometimes paired with wiping the database clean for a fresh install of the server.

Wiping your Savefiles
Be careful doing so, because it will erase all progression and saved buildings!

Delete or rename the game.db file. This will recreate a new empty file.