Anvil Game Studios

Holdfast: Nations At War => Game Servers => Topic started by: Captain Conner on September 22, 2017, 11:06:10 pm

Title: How to host a Holdfast: Nations at War server on Linux
Post by: Captain Conner on September 22, 2017, 11:06:10 pm
This is a tutorial on how to host your own Holdfast: Nations at War on a Linux operating system.

This took me a lot of time and effort to get working and figure out what has to be installed and modified exactly. To host your own server, but without the hassle take a look at our Holdfast: Nations at War servers. You can get your own server for less than 1.50 EUR /month with 35% discount if you use code "holdfastlaunch" at checkout.



Note: This has only been tested on Ubuntu 16.04

1) Make sure no previous version of Wine has been installed, if it has, uninstall it completely and don't forget to run apt-get autoremove to clean up the remaining files.

2) Add the right architecture, execute:
Code: [Select]
dpkg --add-architecture i3863) Download the latest version of Wine, we recommend the development build as it contains multiple fixes that this requires:
Code: [Select]
wget -nc https://dl.winehq.org/wine-builds/Release.key
apt-key add Release.key
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu
apt-get install software-properties-common
apt-get install apt-transport-https
sudo apt-get update
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
apt-get install --install-recommends winehq-devel
apt-get install winetricks

4) Install Mono, a .NET runtime library for Wine.
Mono 4.6 download: https://www.sendspace.com/file/jss2rk
Install it with:
Code: [Select]
wine msiexec /i wine-mono-4.6.0.msi
5) Install Xvfb, which is a virtual display adapter. Holdfast needs the ability to output graphics, although it does not use it.

Code: [Select]
apt-get install xvfb
To start the virtual adapter:
Code: [Select]
Xvfb :0 -screen 0 1024x768x16 &
6) Install DirectX, Holdfast needs this as well. We recommend using version 9 as it fully supported by Wine:
Code: [Select]
winetricks directx9
7) Install all the Holdfast server files to a folder on your server

8) Once you have downloaded the server files, navigate to the folder and execute this command to start the server:

Code: [Select]
DISPLAY=:0.0 wine "/home/your/path/here/Holdfast NaW.exe" -startserver -batchmode -screen-width 640 -screen-height 480 -screen-quality Fastest -framerate 60 -servercarbonplayers 0 -serverConfigFilePath /home/your/path/here/config.txt -logFile /home/your/path/here/logs_output/outputlog_server5_coastalsiege.txt -logArchivesDirectory /home/your/path/here/logs_archive -s "YOURIPHERE" -p YOURPORTHERE -l "94.130.66.231" -o 7101
Replace "/home/your/path/here" with the path to the Holdfast server folder and hit enter. It will output a lot of warnings, however this is normal.


Congratulations, your server should now be up!


If you could not make your Holdfast server work on your Linux operating system, consider buying a cheap server from Oasis Hosting ( https://oasis-hosting.net/gameservers/holdfastnaw/ ) - Servers start 1.50 EUR /month for both Naval AND Land battles. Use discount code "holdfastlaunch" for 35% discount!
Title: Re: Hot to host a Holdfast: Nations at War server on Linux
Post by: Illuminati on September 22, 2017, 11:11:05 pm
+1
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Felix Buxton on September 22, 2017, 11:15:59 pm
A nice release, helps the community.  ;)
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Refleax on September 22, 2017, 11:18:51 pm
Stickied. Thank you very much!
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Dodo on September 22, 2017, 11:21:23 pm
The development version is not necessary, the stable one works as well.
Furthermore, there is no need of directX to make this work.

But cool.

EDIT: A newer version of mono can be found here: http://dl.winehq.org/wine/wine-mono/4.7.1/
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Captain Conner on September 22, 2017, 11:30:00 pm
The development version is not necessary, the stable one works as well.
Furthermore, there is no need of directX to make this work.

But cool.

EDIT: A newer version of mono can be found here: http://dl.winehq.org/wine/wine-mono/4.7.1/

For me it did require DirectX, that is why I listed it.

Thanks for the new mono version by the way.
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Walki on September 30, 2017, 11:21:04 am
You actually have two 3s in the tutorial.
The first 3.) seems a bit off.

Code: [Select]
wget -nc https://dl.winehq.org/wine-builds/Release.key
apt-key add Release.key
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu
apt-get install software-properties-common
apt-get install apt-transport-https
sudo apt-get update
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
apt-get install --install-recommends winehq-devel
apt-get install winetricks

First off, you are adding the Ubuntu wine repository twice, there is obviously no reason for that. apt-add-repository is part of software-properties-common (at least in Debian), which means the correct order would be:

Code: [Select]
wget -nc https://dl.winehq.org/wine-builds/Release.key
apt-key add Release.key
apt-get install software-properties-common
apt-get install apt-transport-https
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu
[sudo] apt-get update
apt-get install --install-recommends winehq-devel
apt-get install winetricks

You can cut this down even further, since there is no real reason to use apt-transport-https since we are pulling from a public repository. You can also cut installing software-properties-common and then adding the repository manually using the bash >> operator.

Debian (stretch):

Required packages:
Code: [Select]
dpkg --add-architecture i386
apt-get update && apt-get upgrade -y
apt-get install -y gnupg gnupg1 gnupg2 wget zip vim curl

Code: [Select]
curl -o Release.key https://dl.winehq.org/wine-builds/Release.key
apt-key add Release.key
echo "deb http://dl.winehq.org/wine-builds/debian stretch main" >> /etc/apt/sources.list
apt-get update
apt-get install -y --install-recommends winehq-stable

As Dodo has mentioned in your second 3), you can download the latest version of mono directly from winehq, no need to do the step via sendspace (I would recommend transfer.sh for this purpose btw ;), since you can wget that link and it doesn't come with ads). As of this post the newest version of mono is 4.7.1.

Code: [Select]
curl http://dl.winehq.org/wine/wine-mono/4.7.1/wine-mono-4.7.1.msi && wine msiexec /i wine-mono-4.7.1.msi

Tidy up
Code: [Select]
rm wine-mono-4.7.1.msi Release.key

Step 5, from first post. Setting up the virtual screen.
Code: [Select]
apt-get install xvfb
Xvfb :0 -screen 0 1024x768x16 &

Now onto downloading the game. Getting SteamCMD and launching in Windows mode:

Code: [Select]
mkdir /home/holdfast && cd /home/holdfast
curl -o steamcmd_linux.tar.gz "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" && tar zxf steamcmd_linux.tar.gz
./steamcmd.sh +@sSteamCmdForcePlatformType windows +force_install_dir holdfastserver
Steam>
Code: [Select]
login [username]
 ... Enter Password & 2-Factor Auth Code
app_update 589290

Note: Repeat this step later if you want to update your server. You can also put this into a bash script obviously. If your server ever breaks you can use app_update 589290 validate to check the file integrity.

Now follows a rather dirty step, get the server files from DropBox: https://www.dropbox.com/sh/ppkfny3r9kcnz8x/AADiIXOrlAWPh-XbhPpimw0ja?dl=0

Code: [Select]
cd /home/holdfast/holdfastserver
curl -L -o holdfast_naw_public_servers.zip https://www.dropbox.com/sh/ppkfny3r9kcnz8x/AADiIXOrlAWPh-XbhPpimw0ja?dl=1
unzip -o holdfast_naw_public_servers.zip

Now we can finally start our server
Code: [Select]
DISPLAY=:0.0 wine "/home/holdfast/holdfastserver/Holdfast NaW.exe" -startserver -batchmode -screen-width 640 -screen-height 480 -screen-quality Fastest -framerate 60 -servercarbonplayers 0 -serverConfigFilePath /home/holdfast/holdfastserver/serverconfig.txt -logFile /home/holdfast/holdfastserver/logs_output/outputlog_server5_coastalsiege.txt -logArchivesDirectory /home/holdfast/holdfastserver/logs_archive -s "YOURIP" -p 20100 -l "94.130.66.231" -o 7101
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Korvyr on March 13, 2018, 09:30:28 pm
I actually recommend people use the development version found here for wine:

https://wine-staging.com/installation.html

I had no end of trouble using the packaged version of wine on CentOS and Ubuntu. The staging versions are extremely unstable, but contain patches for each of the issues I kept running into.

I suppose it depends on your setup. Give the packaged versions a run, and if that fails, try a development version of wine. If you can't find a development package for your GNU sauce of choice, you can also try compiling it yourself:

https://wiki.winehq.org/Building_Wine
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: [VG] Le Royaliste on January 27, 2019, 07:34:39 pm
Mmm ok
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Topsat on January 28, 2019, 07:10:40 pm
debian release
[close]

Hello, I followed Walki's path, and I have a fail on one step with the X server when I launch this command "wget http://dl.winehq.org/wine/wine-mono/4.7.1/wine-mono-4.7.1.msi | wine msiexec /i", it return this error :

(https://i.imgur.com/YpSF6rN.png)

"err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly."

When I do htop I see my Xvfb process :

(https://i.imgur.com/ChRh2w3.png)

Someone have an idea ?
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Walki on January 28, 2019, 10:51:23 pm
debian release
[close]

Hello, I followed Walki's path, and I have a fail on one step with the X server when I launch this command "wget http://dl.winehq.org/wine/wine-mono/4.7.1/wine-mono-4.7.1.msi | wine msiexec /i", it return this error :

(https://i.imgur.com/YpSF6rN.png)

"err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly."

When I do htop I see my Xvfb process :

(https://i.imgur.com/ChRh2w3.png)

Someone have an idea ?

Try:

Code: [Select]
curl http://dl.winehq.org/wine/wine-mono/4.7.1/wine-mono-4.7.1.msi && wine msiexec /i wine-mono-4.7.1.msi
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Topsat on January 29, 2019, 03:52:06 pm
Ok it works when I executed

Code: [Select]
wine msiexec /i wine-mono-4.7.1.msi
I don't use curl because it makes artefacts on putty
[close]

So I'm in the last step :

Code: [Select]
DISPLAY=:0.0 wine "/home/holdfast/holdfastserver/Holdfast NaW.exe" -startserver -batchmode -screen-width 640 -screen-height 480 -screen-quality Fastest -framerate 60 -servercarbonplayers 0 -serverConfigFilePath /home/holdfast/holdfastserver/topsat.txt -logFile /home/holdfast/holdfastserver/logs_output/topsat.txt -logArchivesDirectory /home/holdfast/holdfastserver/logs_archive -s "145.239.168.184" -p 20100 -l "94.130.66.231" -o 7101
(https://i.imgur.com/mKJVjcH.png)

@Walki : I think I should copy the "/etc/mono" folders to "/home/holdfast/holdfastserver/Holdfast NaW_Data/Mono/etc/mono" but am not sure..
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Walki on January 29, 2019, 09:18:58 pm
(https://i.imgur.com/mKJVjcH.png)

@Walki : I think I should copy the "/etc/mono" folders to "/home/holdfast/holdfastserver/Holdfast NaW_Data/Mono/etc/mono" but am not sure..

Try to validate the integrity of the installation (rerun steamcmd on the same directory using):

app_update 589290 validate

Then relaunch the server using the same command.
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Topsat on January 30, 2019, 07:31:08 pm
Ok nice, it works fine, thanks you !
Title: Re: How to host a Holdfast: Nations at War server on Linux
Post by: Walki on January 30, 2019, 10:05:13 pm
Ok nice, it works fine, thanks you !

Glad to hear that.