Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Windows SubSystem For Linux setup that I like with some developers stuff mixed in

Setting Up WSL

Install A Distro:

  1. Run the following in powershell as admin Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Install a distro (ex: Ubuntu 18.04 LTS - https://www.microsoft.com/store/apps/9N9TNGVNDL3Q)

  3. Open your distro you installed via the start menu, let it setup

  4. Update and upgrade

sudo apt-get update
sudo apt-get upgrade

Install and configure a terminal

Alacritty

choco install alacritty
To use WSL, go to %APPDATA%\alacritty\alacritty.yml, and set to use bash shell:

shell:
 program: "C:\\Windows\\System32\\wsl.exe"

Install zsh, oh-my-zsh, and nice themes and fonts

  1. Install zsh and oh my zsh
sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. Switch to use ZSH by default (nano ~/.bashrc):
if [ -t 1 ]; then
exec zsh
fi
  1. Reload terminal (source ~/.bashrc), install powerlevel10k
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
  1. Set to use powerlevel10k theme (nano ~/.zshrc):
ZSH_THEME=powerlevel10k/powerlevel10k
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
  1. Reload terminal (source ~/.zshrc), install fonts:
git clone https://github.com/powerline/fonts.git

Alternatively, grab something like https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Meslo/M/Regular/complete

  1. Install fonts via powershell (open as admin):
Set-ExecutionPolicy Bypass
cd C:\Users\Alan\Fonts
.\install.ps1
  1. Set font for terminal
    Alacritty:

    font:
      normal:
        family: Noto Mono for Powerline
    

    If you got a nerd font like I had above, use it instead:

    font:
      normal:
        family: MesloLGM NF
      size: 9.0
    

    Also set the following in your .zshrc:

    POWERLEVEL9K_MODE='nerdfont-complete'
    
  2. Set a terminal theme:

# Colors (iTerm 2 default theme)
colors:
# Default colors
primary:
 background: '0x101421'
 foreground: '0xfffbf6'

# Normal colors
normal:
 black:   '0x2e2e2e'
 red:     '0xeb4129'
 green:   '0xabe047'
 yellow:  '0xf6c744'
 blue:    '0x47a0f3'
 magenta: '0x7b5cb0'
 cyan:    '0x64dbed'
 white:   '0xe5e9f0'

# Bright colors
bright:
 black:   '0x565656'
 red:     '0xec5357'
 green:   '0xc0e17d'
 yellow:  '0xf9da6a'
 blue:    '0x49a4f8'
 magenta: '0xa47de9'
 cyan:    '0x99faf2'
 white:   '0xffffff'
  1. Fix dir colors (in .zshrc):
LS_COLORS="ow=01;36;40" && export LS_COLORS

Install Dev Tools

Node and npm

  1. Install nodenv
curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-installer | bash
  1. Setup nodenv path (nano ~/.zshrc):
export PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init -)"
  1. Install node and update npm after reloading terminal (source ~/.zshrc)
nodenv install 10.16.1
nodenv global 10.16.1
npm install -g npm@latest

Python and pip

  1. Install pyenv:
curl https://pyenv.run | bash
  1. Setup pyenv path (nano ~/.zshrc):
export PATH="/home/alan/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
  1. Install dependencies, python version, and update pip after reloading terminal (source ~/.zshrc):
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
pyenv install 3.7.3
pyenv global 3.7.3
pip install --upgrade pip
@JamesHWade
Copy link

JamesHWade commented Dec 10, 2020

Thank you for sharing! This is a great guide.

I'm curious to know if you use alacritty as a standalone application or do you open in as a "profile" in Windows Terminal.

Thanks, again!

Loading

@AjkayAlan
Copy link
Author

AjkayAlan commented Dec 10, 2020

Good question @JamesHWade - honestly I need to update this, as what I am using now has definitely changed. Right now I use WSL with Windows Terminal directly, I don't use alacritty at all.

I had started a ways back with Alacritty but one I got familiar with Windows Terminal, I haven't looked back.

Loading

@JamesHWade
Copy link

JamesHWade commented Dec 11, 2020

I would be quite interested in any updates. I like my customization of Alacritty, but I'd like to see an alternative approach.

Loading

@benjaminrich
Copy link

benjaminrich commented Jun 4, 2021

Very useful. Thanks.

Loading

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