Skip to content

Instantly share code, notes, and snippets.

@priyadarshan
Last active January 3, 2020 16:36
Show Gist options
  • Save priyadarshan/a78de5dfcf2d886a0a38606e22fa63e0 to your computer and use it in GitHub Desktop.
Save priyadarshan/a78de5dfcf2d886a0a38606e22fa63e0 to your computer and use it in GitHub Desktop.
Install WSL/Debian and tools

To select Debian as default distro:

wslconfig /s debian
#!/bin/sh
# sudo nano /etc/apt/sources.list
# Comment out stable sources, add:
# deb http://http.us.debian.org/debian unstable main non-free contrib
# deb-src http://http.us.debian.org/debian unstable main non-free contrib
# Perform full upgrade
# sudo apt update
# sudo apt full-upgrade
# Set home dir and shell, edit proper line:
# sudo nano /etc/passwd
# priyadarshan:x:1000:1000:,,,:/mnt/c/home:/usr/bin/zsh
# Finally, install needed tools
sudo DEBIAN_FRONTEND=noninteractive apt -yq install autossh git zsh wget curl notmuch isync emacs aspell hunspell parallel picolisp sbcl man apt-file w3m fd-find ripgrep gcc make youtube-dl
# Add wsl.conf (it should not be there)
# sudo nano /etc/wsl.conf
cat << 'EOF' | sudo tee /etc/wsl.conf
# Enable extra metadata options by default
[automount]
enabled = true
# This would mount C: drive as /c, not /mnt/c
# root = /
options = "metadata,umask=22,fmask=11"
mountFsTab = false
# Enable DNS – even though these are turned on by default,
# we’ll specify here just to be explicit.
[network]
generateHosts = true
generateResolvConf = true
EOF
# Uninstall if already installed
# Get-AppxPackage TheDebianProject.DebianGNULinux | Remove-AppPackage
# This is link to Debian on Microsoft Store
# https://www.microsoft.com/store/productId/9MSVKQC78PK6
# Use this to verify: https://store.rg-adguard.net/
$URL = 'http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/1263b2f8-5626-45cc-b018-eebfee500d1a?P1=1577367893&P2=402&P3=2&P4=eEoWa4I%2bes8l%2fY4lpnyc8vZa8WDRp1chNpZJf76YyeQVQMKxHSfjhwRvzr3pbld9yzi4irJjd0iFlv%2bjGEzAUg%3d%3d'
# $Filename = "$(Split-Path $URL -Leaf).appx"
$Filename = 'wsl-debian-gnulinux.appx'
# $ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'Continue'
Invoke-WebRequest -Uri $URL -OutFile $Filename -UseBasicParsing
Add-AppxPackage $Filename
# This will run the post-install (create user, etc)
debian.exe
@priyadarshan
Copy link
Author

priyadarshan commented Dec 26, 2019

Invoke with:

iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/priyadarshan/a78de5dfcf2d886a0a38606e22fa63e0/raw/bb4d3039161b8c01ca681ce1021b7801445f6c71/wsl-debian-install.ps1'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment