Virtual Machine Setup
From ALFA
This document describes in rough detail the recommended checklist for setting up a new game server host VM in the standard configuration. This configuration is suitable for running nwn2server.exe as a limited user account.
Prerequisites
.NET 3.5 and the DirectX End-User Runtime are optional unless the toolset will be run locally on the game server host machine.
- If running the toolset on the host is desired (optional), enable .NET 3.5 in Add/Remove Windows Features before installing DirectX
- DirectX End-User Runtime (required only if the toolset will be used to stage content on the game server)
- Microsoft .NET Framework 4
- Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update
- Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package MFC Security Update
Process
- Install Windows Server (or Windows 10)
- Copy standard tools over
- Create SG "NWN2 Servers" (if using Windows Server)
- Create SG "NWN2 Admins" (if using Windows Server)
- Create user "NWN2Server"
- Add to "NWN2 Servers" SG
- Create C:\NWN2, xcopy NWN2 install over
- Grant "NWN2 Servers" create files, create folders to "This folder only"
- Grant "NWN2 Admins" modify to folder, subfolders, and files
- Import NWN2.reg
- Create C:\NWN2User
- Grant full control to "NWN2 Servers"
- Grant modify/execute/list/read/write to "NWN2 Admins"
- Runas /profile /user:NWN2Server cmd.exe
- cd /d "%userprofile%\Documents"
- mklink /j "Neverwinter Nights 2" C:\NWN2User
- putty -ssh alfa@sql.alandfaraway.org
- Confirm and accept central server public key for vault tunnel to work
- Create C:\NWNX4, xcopy NWNX4 installation over
- Grant modify/execute/list/read/write to "NWN2 Admins"
- Grant modify/execute/list/read/write to "NWN2 Servers" for:
- AuroraServerNWScript.log
- AuroraServerVault.log
- nwnx.txt
- nwnx_controller.txt
- StandardQueryLog.txt
- xp_mysql.txt
- xp_bugfix.txt
- xp_objectattributes.txt
- xp_srvadmin.txt
- xp_system.txt
- xp_time.txt
- Create C:\Users\Public\Desktop\Credentials.txt
- Copy standard links to C:\Users\Public\Desktop
- Copy standard links to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Tools
- Copy standard scripts to C:\Scripts
- Copy standard NWN2 tools to C:\Tools
- Copy NWNServerConsole to C:\NWN2\Console
- Fix PowerShell signing
- Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted -Force
- Install Git
- Install FileZilla
- Install Win8 Performance Toolkit
- Install 7-zip
- Install gvim
- Install WinDbg for Windows 7 or Windows 8.1.
- Set
_NT_SYMBOL_PATH
toSRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
NWNX4 Installation
- nwnx4_controller.exe -installservice
- Configure NWNX4-1 service to run as the "NWN2Server" user
- If using a Microsoft account (user@email) for the server user, use Computername\Username where Username is the value that %USERNAME% shows from "echo %USERNAME%" in cmd.exe and Computername is the value that %COMPUTERNAME% shows from "echo %COMPUTERNAME%" in cmd.exe. Also, in this case, you have to manually grant this user "Log on as a service" rights by going to Local Security Policy, Local Policies, User Rights Assignment, Log on as a service, and adding Computername\Username to the list. This only applies to accounts set up as a Microsoft account initially, not to local accounts that a Microsoft account was connected to afterwards.
- Get SID for NWN2Server user with PowerShell:
-
([wmi]"win32_Group.Domain='$env:ComputerName',Name='NWN2 Admins'").sid
-
- Set SD on nwnx4-1 service to allow NWN2 Admins to start/stop:
-
sc sdset nwnx4-1 D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RPWP;;;<NWN2 Admins SID from above command>)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
-
- Install SSH private key to C:\NWNX4\sshfs.ppk
- Add SSH public key to alfa@sql.alandfaraway.org:~/.ssh/authorized_keys
- Set configuration in C:\NWNX4\nwnx.ini
- Set configuration in C:\NWNX4\AuroraServerNWScript.ini
- Set configuration in C:\NWNX4\xp_mysql.ini
- Set configuration in C:\NWNX4\DatabaseConnector.ini
- Set configuration in C:\NWNX4\AuroraServerVault.ini
Module preparation
- If the module is being cloned directly from source control or copied from a very old backup, it may be necessary to recompile the module against a current alfa2_acr.hak to ensure that the database connection (and self-update) work at module startup. If the module never loads acr_databaseconnector in AuroraServerNWScript.log and no "DatabaseConnector" log messages in nwserverLog1.txt are seen before the ACR_OnModuleLoad: log line then this may be the problem (but also check for errors in AuroraServerNWScript.log that might indicate a misconfigured NWScript Accelerator installation).
- Make sure that alfa2_acr.hak is recent. An extremely old build predating the DatabaseConnector integration may not be able to self-update the rest of the ACR.
Troubleshooting
Fixes for some problems encountered during server deployment are listed here.
- Module didn't load or server doesn't start up?
- Look at the server log file and C:\NWNX4\AuroraServerNWScript.log for errors/exceptions for next troubleshooting steps.
- Database doesn't connect, or many exceptions in server log about the database, or PCs (but not DM's) are booted at log on?
- Make sure that plink.exe was run once as the user that the NWNX4-1 service runs as in order to accept the SSH key of the central server.
- Monitor Server Uptime script closes immediately?
- Make sure that the following command was run from an administrator privileged PowerShell session: Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted -Force
- Game server starts with NWNX4_GUI.exe but not as a service?
- Make sure that the service is running as the right user. Go to services.msc and configure it to run as the user whose %userprofile%\Documents\Neverwinter Nights 2 has the module, server vault, etc. present.
- Toolset doesn't start/work properly?
- Make sure that .NET Framework v3.5 (sometimes called .NET Framework v2.0) is installed, and then the DirectX End-User Runtime is installed. If the DirectX End-User Runtime was installed first, it's installer has to be re-run after installing .NET Framework v3.5.
- Database or scripts don't work, or NWNX4 plugins didn't load?
- Make sure that all Visual C++ and .NET runtime dependencies were installed.
- Make sure that NWNScriptJIT.dll, NWNScriptJITIntrinsics.dll are installed in the NWN2 installation directory (not necessarily the NWNX4 installation directory).
- Make sure that plink.exe was run once as the service user (see above).
- Using a Microsoft account for the service account and the service fails to start with "The service dependency failed to start."?
- Configure the service to log on using Computername\Username and ensure that from Local Security Policy, Local Policies, User Rights Assignment, that Computername\Username was granted "Log on as a service" rights.