Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🚀 WSL Development Environment Setup Guide

A step-by-step guide to setting up a development environment on Windows Subsystem for Linux (WSL).

This guide walks you through installing and configuring some of the most commonly used tools, helping you get your WSL setup ready for coding quickly and with minimal hassle.

System Preparation ⚙️

Update Package Manager and System Packages

Update the package list and upgrade all installed packages to their latest versions:

sudo apt update
sudo apt upgrade

Git Configuration 🌿

Install Git

Install the Git version control system:

sudo apt install git

Configure Git

Configure your Git identity and default preferences:

git config --global user.name 'McLovin'
git config --global user.email 'McLovin@Superbad.movie'
git config --global init.defaultBranch main
git config --global core.editor 'code --wait'

Configure Git Credential Manager

Microsoft recommends installing Git for Windows to share credentials and settings between WSL and Windows. It includes the Git Credential Manager (GCM), which updates with each release.

  1. Install Git for Windows and select Git Credential Manager (GCM) as the default credential helper.
  2. Configure WSL Git to use the Windows credential manager:
git config --global credential.helper '/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe'

💡 Change the path if Git for Windows is installed in a custom location.

Configure GPG Signing

GPG signing allows you to cryptographically sign commits and tags. Choose one of the following approaches based on where you want to manage your GPG keys.

Approach 1: Use GPG4Win (Windows-based)

Install GPG4Win on your Windows host. GPG4Win also includes Kleopatra, a certificate manager and GUI for GnuPG. Use it to import an existing key or create a new one, or if you prefer not to use it, you can do the same with the GPG CLI:

Generate a new key:

gpg --full-generate-key

🔐 Recommended: Use ECC key (sign and encrypt) with Curve 25519.

Or import an existing key:

gpg --import [SECRET_KEY_FILE_PATH]

List your GPG keys to find the key ID:

gpg --list-secret-keys --keyid-format=long

Then set the trust level of the imported key:

gpg --edit-key [KEY_ID]

In the GPG prompt, set ultimate trust:

gpg> trust
gpg> 5
gpg> y
gpg> quit

Configure Git to use GPG4Win for signing:

git config --global gpg.program '/mnt/c/Program Files (x86)/GnuPG/bin/gpg.exe'
git config --global user.signingkey [KEY_ID]
git config --global commit.gpgsign true
git config --global tag.gpgsign true

💡 Change the path if GPG4Win is installed in a custom location.

Approach 2: Use Linux GPG

Verify GUI support is available:

echo $DISPLAY

The expected output is usually :0 or :0.0. If it’s empty, you need to set up WSLg.

Install GPG and the graphical pinentry tool:

sudo apt install gnupg pinentry-gtk2

Run the following command to configure the GPG agent to use the graphical pinentry program:

cat << 'EOF' > ~/.gnupg/gpg-agent.conf
pinentry-program /usr/bin/pinentry-gtk-2
default-cache-ttl 28800
max-cache-ttl 86400
EOF

Restart the GPG agent to apply the configuration:

gpgconf --kill gpg-agent
gpgconf --launch gpg-agent

Generate a new key:

gpg --full-generate-key

🔐 Recommended: Use ECC key (sign and encrypt) with Curve 25519.

Or import an existing key:

gpg --import [SECRET_KEY_FILE_PATH]

List your GPG keys to find the key ID:

gpg --list-secret-keys --keyid-format=long

Then set the trust level of the imported key:

gpg --edit-key [KEY_ID]

In the GPG prompt, set ultimate trust:

gpg> trust
gpg> 5
gpg> y
gpg> quit

Configure Git to use GPG for signing:

git config --global gpg.program gpg
git config --global user.signingkey [KEY_ID]
git config --global commit.gpgsign true
git config --global tag.gpgsign true

Terminal Setup 💻

Install Zsh Shell

Install the Z shell (Zsh) as an alternative to the default bash shell:

sudo apt install zsh

Install Oh My Zsh

Install the Oh My Zsh framework for managing Zsh configuration:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Configure Oh My Zsh Plugins 🔌

Clone and install syntax highlighting plugin:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Clone and install auto-suggestions plugin:

git clone https://github.com/zsh-users/zsh-autosuggestions \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Add the following plugins to your ~/.zshrc file:

plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
)

🔄 Restart the terminal for changes to take effect.

Install PowerLevel10k Theme 🎨

Install the recommended MesloLGS font family and configure your terminal to use it.

Font Downloads:

Clone the PowerLevel10k theme into the Oh My Zsh custom themes directory:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

Update the ZSH_THEME value in your ~/.zshrc file to use the Powerlevel10k theme:

ZSH_THEME="powerlevel10k/powerlevel10k"

🔄 Restart the terminal to begin the theme configuration wizard.

Python Development 🐍

Install Miniconda

Create installation directory and download the installer:

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh

🔄 Close and reopen the terminal, or run the following command to activate:

source ~/miniconda3/bin/activate

Disable automatic environment activation on terminal startup:

conda config --set auto_activate false

Web Development 🌐

Install Node Version Manager (NVM)

Install NVM for managing Node.js versions:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

🔄 Close and reopen the terminal, or run the following command to activate:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

Install Deno 🦕

Install prerequisites (unzip utility):

sudo apt install unzip

Download and install Deno:

curl -fsSL https://deno.land/install.sh | sh

🔄 Restart the terminal for changes to take effect.

Install Bun 🥟

Install prerequisites (unzip utility):

sudo apt install unzip

Download and install Bun:

curl -fsSL https://bun.sh/install | bash

🔄 Close and reopen the terminal, or run the following command to activate:

exec /usr/bin/zsh

About

A step-by-step guide for setting up a development environment on Windows Subsystem for Linux (WSL).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors