Skip to content

WSL

Habilitar o WSL

  habilitar-wsl

Instalar o WSL

wsl --install

Verificar distribuições disponíveis

wsl --list --online 

Instalar distribuição Debian

wsl --install -d Debian <Nome-Computador>

Exemplo:

wsl --install -d Debian my-debian

Habilitar o alcance de redes

sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

Atualizar pacotes instalados no sistema

sudo apt update && sudo apt full-upgrade

Customizando meu terminal

# CUSTOM WSL PS1

COMPUTER_NAME="my-debian"

if [ "$color_prompt" = yes ]; then
    # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@$COMPUTER_NAME\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    # PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    PS1='${debian_chroot:+($debian_chroot)}\u@$COMPUTER_NAME:\w\$ '
fi