WSL Warmup

For some reason, I find myself installing fresh WSL instances for different purposes quite often, and finally decided to put together this collection of the most often used recipes.

Lazy Passwordless sudo

#

This is sort of insecure, but for my needs it is ok

Editing sudo config is recommended using a tool visudo. The on-screen tips help with saving the file:

sudo visudo /etc/sudoers.d/user     # use the user name here

Just one line in the file is enough, user ALL=(ALL) NOPASSWD:ALL substitute “user” with the name of the desired user.

Fresh GIT from PPA

#

The included in the Ubuntu repos version is often lagging behind, and we want the most up-to-date.

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

Node, NVM, NPM

#

A handy guide for installing Node on WSL is listed in Microsoft’s docs here, run the suggested command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install node
nvm use node

Now nvm ls should give some meaningful output with green text. And npm i can be run inside a freshly cloned repo folder successfully.

Pyenv

#

Install dependencies (recommended by wiki)

sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Utilize the awesome pyenv installer

curl https://pyenv.run | bash

As suggested by the installer, add the following to the .bashrc and .profile:

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

And now in a new terminal window pyenv update should yield proper results.
Install the desired python version:

pyenv install -l        # pick from the list
pyenv install 3.10.6    # for example

To be continued…

#

Published on