Skip to content

Instantly share code, notes, and snippets.

@jclosure
Last active January 30, 2023 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jclosure/936e84506ac92ef2679ff932113fd451 to your computer and use it in GitHub Desktop.
Save jclosure/936e84506ac92ef2679ff932113fd451 to your computer and use it in GitHub Desktop.
Notes: Windows Setup recipe for Linux Cloud Development

PC Setup notes

Enable CPU virtualization in the BIOS

After reboot continue

Turn off firewall

Install wsl

Open a CMD session as Administrator

wsl.exe --install

Launch Ubuntu

Right mouse click the Ubuntu window and go to "properties->Options". Set Ctrl+Shift+C/V as Copy/Paste

Open up sudoers (consider)

sudo sh -c "echo '$USER ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"

Install zsh

sudo apt install zsh
chsh -s $(which zsh)

Install Oh-My-Zsh

https://ohmyz.sh/#install

Install powerline fonts

  • Open Powershell as Administrator

  • allow scripts to be executed in powershell

Set-ExecutionPolicy unrestricted
  • clone the powerline fonts repo
git clone https://github.com/powerline/fonts.git
  • install the fonts
cd fonts
./install.ps1
  • In "WSL Ubuntu Window"->properties->Font, switch to DejaVu Sans Mono for Powerline

$PATH

In a zsh shell:

Add the following to ~/.zshrc

Setup access to PowerShell

export PATH="$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0"

Add these to ~/.zshrc

TODO: hook these up to zsh clip plugin, so zsh participates fully in copy/paste

# clipboard interop
wincopy() {
    content=$(echo "$1" | base64)
    powershell.exe -command Set-Clipboard -Value "$content"
}

winpaste() {
    content=$(powershell.exe -command Get-Clipboard)
    decoded=$(echo "$content" | base64 --decode 2>/dev/null)
    echo "$decoded"
}

Usage:

wincopy "I'm a little teapot"
winpaste

Optional

Setup $PATH with access to Windows system executables

export PATH="$PATH:/mnt/c/Windows/System32:/mnt/c/Windows\SysWOW64"

This is not necessary but does provide path access to win32/wow64 binaries

Install docker

   # install docker
   sudo apt-get update
   curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
   echo \\n  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\n  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
   sudo apt-get update
   sudo service docker start
   sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
   sudo service docker start
   sudo service docker status
   sudo usermod -aG docker ${USER}
   su - ${USER}
   docker ps

   # install docker-compose
   sudo apt install docker-compose
   
   # install lazydocker
   wget https://github.com/jesseduffield/lazydocker/releases/download/v0.20.0/lazydocker_0.20.0_Linux_x86_64.tar.gz
   tar xzvf ./lazydocker_0.20.0_Linux_x86_64.tar.gz
   cd ./lazydocker_0.20.0_Linux_x86_64
   mkdir ~/bin
   mv lazydocker ~/bin/
   echo 'export PATH="$HOME/bin:$PATH"' > ~/.zshrc 

Fire up an Alpine container

Attended

docker run -it alpine /bin/sh

Unattended

docker run -d alpine sleep infinity

Setup dockerd to start on wsl entry

TODO: research wsl Linux services starting at Windows boot time

echo "sudo service docker status || sudo service docker start" >> "$HOME/.profile"

Install VSCode

Install VisualStudio

Install support for

  • Unity
  • C++
  • .NET
  • Python
  • Node

Install Firefox

Install PicPick

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