How to Set up novnc on Windows using WSL

How to set up novnc via Windows Subsystem for Linux (WSL):

install tigervnc then Start > (type) services.msc > Right-click tigervnc and Start
Click Start > (type) Configure vnc)
Windows/Symantec Firewall > Allow inbound TCP 443
 
#### install WSL
open powershell as Administrator
 
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
.\Ubuntu.appx

Open a shell

Start > (type) cmd > OK > (type) bash
apt-get install novnc websockify -y
 
# Create a self-signed certificate
openssl req -new -newkey rsa:4096 -x509 -subj "/C=US/ST=Texas/L=Austin/O=IBM/OU=Support/CN=host.example.com" -days 365 -nodes -out self.pem -keyout self.pem
 
# Don't prompt when running sudo
sudo sed -i 's/) ALL/) NOPASSWD:ALL/g' /etc/sudoers
 
# Create a script to run novnc
sudo bash -c 'echo "sudo -i /usr/share/novnc/utils/launch.sh --listen 443 --cert /home/x/self.pem --vnc localhost:5900" > /usr/local/bin/novnc'
sudo chmod 755 /usr/local/bin/novnc
 
# run these in cmd. It runs novnc in a hidden window on windows login
curl -L https://raw.githubusercontent.com/Gabrielcarvfer/WSLSetup/master/runHidden.vbs -o %userprofile%\runHidden.vbs
echo %userprofile%\runHidden.vbs bash -c novnc > "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup\novnc.bat"

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.