EVEN EASIER Automated OpenSSH Install for Nano Server

EVEN EASIER Automated OpenSSH Install for Nano Server

Yes, I already wrote something titled almost identically.

No it’s not a duplicate!

Last time I had you download a .nupkg, unpack it, then push the files to Nano and run a PowerShell script.

This time you can do the install right at the Nano remote prompt - no preparatory steps and no file copy. In addition, it works on Nano TP5 - which still has some challenging limitations that should be eliminated in the RTM version.

Note: the chocolatey package identifier for this port of OpenSSH was updated from “win32-openssh” to just “openssh” on 9/22/2016.

  1. At a remote prompt into a Nano machine, run: Install-PackageProvider NuGet -forcebootstrap -force
  2. Then run (provider MUST BE “nuget”): Register-PackageSource -name chocolatey -provider nuget -location http://chocolatey.org/api/v2/ -trusted
  3. Then run: Install-Package openssh -provider NuGet
  4. Then run: cd "$((dir "$env:ProgramFiles\nuget\packages\openssh*\tools" |select -last 1).fullname)"
  5. And finally (both dots are needed): .".\barebonesinstaller.ps1" -SSHServerFeature

How Does This Enable Running The Code Directly On Nano?

We are taking advantage of the fact that Chocolatey Packages are really just specialized NuGet packages. Since Nano TP5 has an operational ‘NuGet’ package provider, it is capable of downloading and extracting the .nupkg - that’s exactly the minimum we need to prepare for calling “barebonesinstaller.ps1” to install on Nano.

You can also put all the above lines into a script block and call it against may Nano instances using Invoke-Command.

Completely Offline Installs

The package still supports completely offline installs for scenarios where you might need it. Read here for more details on how the package can be used: https://gitlab.com/DarwinJS/ChocoPackages/-/blob/master/openssh/readme.md