Installing WLS - KineticTheory/Linux-HPC-Env GitHub Wiki
Reference
Previously
Enabling WLS on enterprise installs of Windows 10.
- You must have Administrator access (R-account)
- Open a Power Shell as Administrator
- Windows key, begin typing
power
, right-click on Power Shell and select Run As Administrator
- Windows key, begin typing
- In the elevated Power Shell run these commands:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- Restart the PC.
- Download a Distro and install it.
- Open a Power Shell as Administrator (R-account)
cd $env:USERPROFILE\Downloads Add-AppxPackage ubuntu-1804.appx
- Press the Windows key to open the menu. A new icon for Ubuntu should be at the top of the list. Select this item.
- A new window will open with the text
Installing, this may take a few minutes...
- You will be asked to create a user account (moniker, password)
- A new window will open with the text
- Details for WSL version 2 are at https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
- From powershell or cmd, run
wsl -l -v
to see available distributions and versions. - To convert to wsl2:
wsl --set-version "Ubuntu-20.04" 2
(takes a few mintues).
- From powershell or cmd, run
- Add Ubuntu to WindowsTerminal
- In the ubuntu windows, obtain the guid by running
uuidgen
- WindowsTerminal -> Settings -> Add a new profile to the list (example below).
{ "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "//wsl$/Ubuntu-20.04/home/kellyt/" }
- In the ubuntu windows, obtain the guid by running
- Set the new wsl instance as the default.
wsl.exe -l wsl.exe -s Ubuntu-20.04
Basic WLS configuration for corporate environments (firewalls, blocked windows store)
- To allow
apt get
to function correctly you will need to teach it about any proxy settings used at your site. I needed to create/etc/apt/apt.conf
(sudo vi /etc/apt/apt.conf
) with the following content:
Acquire::http::Proxy "http://proxyout.lanl.gov:8080/";
Acquire::https::Proxy "http://proxyout.lanl.gov:8080/";
- Use appropriate proxy information for you site.
- If permissions on
C:\Program Files\WindowsApps
are blocking you, try these two commands from an elevated permissions command prompt:
takeown /F "c:\Program Files\WindowsApps" /R /D Y
icalcs "c:\Program Files\WindowsApps" /q /c /t /reset
Installing basic developer software
- Basic fetch and install commands
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get upgrade
sudo apt-get remove "emacs*"
sudo apt-get autoremove
sudo apt-get install -y gnome-terminal meld emacs-lucid xterm net-tools
# sudo apt-get install -y ubuntu-desktop
sudo apt-get install -y build-essential gcc gfortran git pkg-config python python-dev unzip libtool
sudo apt-get install -y keychain autoconf autopoint texlive-full
# needed for cairo (x11)
sudo apt-get install -y libx11-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev
sudo apt-get install -y libxcb-xkb-dev libcairo2-dev librsvg2-dev librsvg2-bin
sudo apt-get install -y libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblzma-dev libtiff-dev libtiffxx5 gnutls-dev gnutls-bin
- Fix broken install of meld:
sudo apt-get install --reinstall meld gnome-icon-theme
More software setup for firewalled installations
- Fix proxy issue for Git
git config --global url."https://".insteadOf git://
Using spack to install packages needed for Draco development
git clone [email protected]:spack/spack/ && cd spack/
export SPACK_ROOT=~/spack/
export PATH=$PATH:~/spack/bin
spack compilers
Create ~/.spack/modules.yaml from https://github.com/KineticTheory/spack_tools/blob/master/etc_spack/modules.yaml
Create ~/.spack/packages.yaml to point to already installed tools (autoconf, automake, bzip2, gettext, git, m4, perl, tar).
spack install lmod cmake numdiff ack htop gsl random123 openblas
spack install openmpi parmetis libquo caliper [email protected] lcov
spack install llvm
X11 support
- There are some issues with X11 right now.
- To enable X11 support, install VcXsrv on Windows 10 and run it.
- Alternatively: https://x410.dev/ (commercial software)
- Option 1: Disable X11 access controls.
- When running VcXsrv, disable access controls with
-ac
"C:\Program Files\VcXsrv\vcxsrv.exe" -multiwindow -ac
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1
- X11 will just work, but you may get flagged by security scanners.
- When running VcXsrv, disable access controls with
- Option 2: Run sshd in the WSL2 and connect via Putty.
- Setup sshd:
sudo vi /etc/ssh/sshd_config
and setPort 222
- Start sshd:
sudo service ssh start
- Get the IP address of the WSL2 instance:
ifconfig
- Use Putty to connect to the IP address on port 222 with X11 forwarding.
- Setup sshd:
- Issues
libGL error: failed to load driver: swrast
$ sudo ldconfig -p | grep -i gl.so libwayland-egl.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwayland-egl.so.1 libcogl.so.20 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcogl.so.20 libGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libGL.so.1 libEGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libEGL.so.1 $ sudo mv /lib/x86_64-linux-gnu/libGL.so.1 /lib/x86_64-linux-gnu/libGL.so.1.bak
Issues/Maintenance
-
If wls fails to start, try
- From Admin powershell:
restart-service vmms
- https://github.com/microsoft/WSL/issues/5401
- From Admin powershell:
-
Update Linux kernel
- You can also use
wsl.exe --update
to update the Linux kernel to the latest version,wsl.exe --update --status
to view your current Linux kernel version and when it was last updated, andwsl.exe --update --rollback
to roll back to an older version of the Linux kernel.
- You can also use
More useful information
- Initializing a newly installed distro
- Windows Subsystem for Linux Installation Guide for Windows 10
- Manually download Windows Subsystem for Linux distro packages
- Windows 10 Is Getting a Built-in Linux Kernel
- https://utf9k.net/blog/emacs-wsl2-install/
Previous: Custom Software Settings