Virtual Machine Setup

From ALFA
Jump to: navigation, search

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.

Process

  1. Install Windows Server (or Windows 10)
  2. Copy standard tools over:
    1. putty
  3. Create SG "NWN2 Servers" (if using Windows Server)
  4. Create SG "NWN2 Admins" (if using Windows Server)
  5. Create user "NWN2Server"
    1. Add to "NWN2 Servers" SG (if using Windows Server)
  6. Create C:\NWN2, xcopy NWN2 install over (or just install NWN2)
    1. Grant "NWN2 Servers" create files, create folders to "This folder only" (if using Windows Server)
    2. Grant "NWN2 Admins" modify to folder, subfolders, and files (if using Windows Server)
    3. Import NWN2.reg (only if not installing NWN2)
  7. Create C:\NWN2User
    1. Grant full control to "NWN2 Servers" (if using Windows Server)
    2. Grant modify/execute/list/read/write to "NWN2 Admins" (if using Windows Server)
  8. Run this in a command window: Runas /profile /user:NWN2Server cmd.exe (or log in as the NWN2Server user and open up a command window)
    1. cd /d "%userprofile%\Documents"
    2. mklink /j "Neverwinter Nights 2" C:\NWN2User
    3. putty -ssh alfa@sql.alandfaraway.info
      1. Confirm and accept central server public key for vault tunnel to work
  9. Create C:\NWNX4, xcopy NWNX4 installation over (or just simply install it)
    1. Grant modify/execute/list/read/write to "NWN2 Admins" (if using Windows Server)
    2. Grant modify/execute/list/read/write to "NWN2 Servers" for: (if using Windows Server)
      1. AuroraServerNWScript.log
      2. AuroraServerVault.log
      3. nwnx.txt
      4. nwnx_controller.txt
      5. StandardQueryLog.txt
      6. xp_mysql.txt
      7. xp_bugfix.txt
      8. xp_objectattributes.txt
      9. xp_srvadmin.txt
      10. xp_system.txt
      11. xp_time.txt
  10. Create C:\Users\Public\Desktop\Credentials.txt
  11. Copy standard links to C:\Users\Public\Desktop
  12. Copy standard links to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Tools
  13. Copy standard scripts to C:\Scripts
  14. Copy standard NWN2 tools to C:\Tools
  15. Copy NWNServerConsole to C:\NWN2\Console
  16. Fix PowerShell signing
    1. Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted -Force
  17. Install Git
  18. Install FileZilla
  19. Install Win8 Performance Toolkit or Windows 10 Performance Toolkit
  20. Install 7-zip
  21. Install gvim
  22. Install WinDbg for Windows 7 or Windows 8.1 or Windows 10.
  23. Set _NT_SYMBOL_PATH environment variable to SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

NWNX4 Installation

  1. nwnx4_controller.exe -installservice
  2. Configure NWNX4-1 service to run as the "NWN2Server" user (if using Windows Server)
    1. 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.
  3. Get SID for NWN2Server user with PowerShell: (if using Windows Server)
([wmi]"win32_Group.Domain='$env:ComputerName',Name='NWN2 Admins'").sid
  1. Set SD on nwnx4-1 service to allow NWN2 Admins to start/stop: (if using Windows Server)
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)
  1. Install SSH private key to C:\NWNX4\sshfs.ppk
  2. Add SSH public key to alfa@sql.alandfaraway.org:~/.ssh/authorized_keys
  3. Set configuration in C:\NWNX4\nwnx.ini
  4. Set configuration in C:\NWNX4\AuroraServerNWScript.ini
  5. Set configuration in C:\NWNX4\xp_mysql.ini
  6. Set configuration in C:\NWNX4\DatabaseConnector.ini
  7. Set configuration in C:\NWNX4\AuroraServerVault.ini

Module preparation

  1. 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).
  2. 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.

  1. Module didn't load or server doesn't start up?
    1. Look at the server log file and C:\NWNX4\AuroraServerNWScript.log for errors/exceptions for next troubleshooting steps.
  2. Database doesn't connect, or many exceptions in server log about the database, or PCs (but not DM's) are booted at log on?
    1. 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.
  3. Monitor Server Uptime script closes immediately?
    1. Make sure that the following command was run from an administrator privileged PowerShell session: Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted -Force
  4. Game server starts with NWNX4_GUI.exe but not as a service?
    1. 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.
  5. Toolset doesn't start/work properly?
    1. 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.
  6. Database or scripts don't work, or NWNX4 plugins didn't load?
    1. Make sure that all Visual C++ and .NET runtime dependencies were installed.
    2. Make sure that NWNScriptJIT.dll, NWNScriptJITIntrinsics.dll are installed in the NWN2 installation directory (not necessarily the NWNX4 installation directory).
    3. Make sure that plink.exe was run once as the service user (see above).
  7. Using a Microsoft account for the service account and the service fails to start with "The service dependency failed to start."?
    1. 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.