Install wine
You may have to install wine if it's not installed yet. Due to the amount of space used by wine (1.1 GB), we do not pre-install it on the OTS Hosting Service.
1sudo dpkg --add-architecture i386
2sudo apt-get update
3sudo apt -y install wine32-development wine-development
This will allow you to run both 32-bit and 64-bit .exe files. Note that sometimes wineconsole yields better results than using wine directly.
Test manually
1otsmanager@176-31-89-137:~/ots$ wineconsole YurOTS.exe
2# You can stop the execution by pressing CTR+C.
If everything works as expected and after a minute you see a console, you may proceed to change configuration for service unit.
Set up service unit
You need to edit /etc/systemd/system/tfs.service and set up working directory and binary path.
1otsmanager@176-31-89-137:~$ sudo mcedit /etc/systemd/system/tfs.service
Add or change the following three lines if your .exe is /home/otsmanager/ots/YurOTS.exe
1Type=simple
2ExecStart=/usr/bin/wine YurOTS.exe
3WorkingDirectory=/home/otsmanager/ots
Save the file (F2) and exit mcedit (F10).
Now you need to reload systemd configuration:
1otsmanager@176-31-89-137:~$ sudo systemctl daemon-reload
And start "tfs" (the name "tfs" here refers to the filename in tfs.service):
1otsmanager@176-31-89-137:~$ sudo systemctl start tfs
Check "tfs" log:
1otsmanager@176-31-89-137:~$ journalctl -u tfs -f
64-bit server engine
In case you have a Windows binary compiled for 64-bit, you need to install wine64-development and use wine64 instead of wine32-development.
1# install wine64
2sudo apt install wine64-development
3
4# create 64-bit wine runtime directory (one time only)
5Winearch=win64 WINEPREFIX=/home/otsmanager/.wine64 winecfg
6
7# run engine
8WINEPREFIX=/home/otsmanager/.wine64 wine64 theforgottenserver-x64.exe