Skip to content

Latest commit

 

History

History
194 lines (124 loc) · 3.76 KB

README-wsl.md

File metadata and controls

194 lines (124 loc) · 3.76 KB

Windows Subsystem for Linux

The Windows Subsystem for Linux lets developers run GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a virtual machine.

Manually Install the Windows Subsystem for Linux

Enable Windows Subsystem for Linux optional feature

Before you can run Linux distros on Windows, you must enable the Windows Subsystem for Linux optional feature and reboot.

  1. Open PowerShell as Administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart your computer when prompted.

This reboot is required in order to ensure that WSL can initiate a trusted execution environment.

Download and manually unpack and install

Here we take the installation of Debian GNU/Linux as an example, and installation directory is C:\WSL\Debian.

cd C:\WSL
  1. Download using PowerShell
Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile Debian.appx -UseBasicParsing
  1. Download using curl
curl.exe -L -o Debian.appx https://aka.ms/wsl-debian-gnulinux
  1. Extract and install a Linux distro

Extract the .appx package's contents, e.g. using PowerShell:

Rename-Item Debian.appx Debian.zip
Expand-Archive Debian.zip Debian

Run the distro launcher To complete installation, run the distro launcher application in the target folder, named .exe. For example: .\debian.exe, etc.

cd C:\WSL\Debian
.\debian.exe

  1. Setting up a new Linux user account

Once installation is complete, you will be prompted to create a new user account (and its password).

This user account is for the normal non-admin user that you'll be logged-in as by default when launching a distro.

Configure Linux account root

See User Accounts and Permissions for WSL

.\debian.exe config --default-user root
wsl
passwd root

.\debian.exe config --default-user dev

Update & upgrade your distro's packages

sudo apt update && sudo apt upgrade

For more details, please see:


Install Development Tools

Install development tools in the directory /opt.

sudo chown -R dev:dev /opt/

JDK

https://www.oracle.com/technetwork/java/javase/downloads/index.html

mkdir /opt/Java
cd /opt/Java

# Download jdk-8u212-linux-x64.tar.gz -- Need logged in

tar -xzvf jdk-8u212-linux-x64.tar.gz

Edit /etc/profile:

vi /etc/profile

JAVA_HOME=/opt/Java/jdk1.8.0_212
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JRE_HOME PATH CLASSPATH
source /etc/profile

java -version

Redis

Go

mkdir /opt/Go
cd /opt/Go

wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
tar -zxvf go1.12.7.linux-amd64.tar.gz

mkdir /opt/Go/gopath
cd /opt/Go/go
vi /etc/profile

GOROOT=/opt/Go/go
GOPATH=/opt/Go/gopath
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOROOT GOPATH PATH
source /etc/profile

go env
go version

etcd

mkdir /opt/etcd
cd /opt/etcd

wget https://mirrors.huaweicloud.com/etcd/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz
tar -zxvf etcd-v3.3.13-linux-amd64.tar.gz

cd etcd-v3.3.13-linux-amd64

./etcd
vi /etc/profile

ETCD=/opt/etcd/etcd-v3.3.13-linux-amd64
PATH=$PATH:$ETCD
export ETCD PATH
source /etc/profile