Skip to content

Instantly share code, notes, and snippets.

@brandonros
Last active July 24, 2020 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonros/2de9b89509f10a5d270d067bcd07ee21 to your computer and use it in GitHub Desktop.
Save brandonros/2de9b89509f10a5d270d067bcd07ee21 to your computer and use it in GitHub Desktop.
Set up a new Windows Server 2019 install from scratch for node.js native module compiling

1. Enable SSH

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType "Automatic"
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

2. Install Choco package manager

Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

3. Install dependencies

choco install nodejs-lts python2 visualstudio2017buildtools visualstudio2017-workload-vctools -y

4. Mount VirtualBox shared folder to drive

net use Z: \\VBOXSVR\foo

5. Compile over SSH

ssh Administrator@192.168.0.61 "Set-Location Z:\bar; npm install; npm build"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment