My WSL2 Setup

August 18, 2024

How I set up my development environment on Windows WSL v2 for working with rust, python, node js and other tools, I no longer need to overpay for a Mac!

Coming from a Mac environment, I was used to having a Unix-like shell and a package manager that made it easy to install and manage the software I need on a daily basis. But I grew tired of the silly high prices from Apple.

I tried using the WSL, and everything changed. I no longer need to pay the Apple tax to have a Unix-like environment. I can use Windows for both fun and work.

Setup WSL v2

WSL stands for Windows Subsystem for Linux. It's a compatibility layer that enables you to run Linux environments directly on Windows. This means you can use Linux tools, utilities, and applications seamlessly on your Windows system without the need for a virtual machine.

This is a short guide on how I set up my development environment on Windows WSL v2 for working with rust, python, node js, and other tools.

Setup the Linux environment

Setup the shell

My .bash_aliases file

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
alias py="pyenv exec python"
# For Loading the SSH key
export HOST=luca-machine
keychain -q --nogui ${HOME}/.ssh/id_ed25519
source ${HOME}/.keychain/${HOST}-sh

Allows to use py to run the python version managed by pyenv and to load the SSH key when I open a new shell.

Setup git config

git config --global user.name Luca Sbardella
git config --global user.username lsbardel
git config --global user.email luca@quantmind.com
git config --global core.editor vim

and check it with git config --list

Setup Rust

Setup Python

When working with python, there are a few tools that I find essential. One of them is pyenv, which allows you to manage multiple python versions on your system. This is super useful when you need to work on different projects that require different python versions.

Setup Node.js

Node.js has a similar tool to pyenv called nvm. This tool allows you to manage multiple node.js versions on your system.