🌐 Detecting your location…
📢 Advertisement — Configure AdSense in Appearance → Customize → AdSense Settings

Guia de configuração completo do WSL2 2026: Linux no Windows da maneira certa

⏱️2 min read  ·  395 words
WSL2 Complete Setup Guide 2026: Linux on Windows the Right Way

WSL2(Subsistema Windows para Linux 2) executa um kernel Linux completo dentro do Windows 11 com desempenho quase nativo. Em 2026, WSL2 é o ambiente de desenvolvimento padrão para desenvolvedores Windows que usam Python, Node, Docker e ferramentas de nuvem.

Instale WSL2

Abra o PowerShell como administrador e execute um comando. O Windows instala WSL2 + Ubuntu automaticamente.

# Install WSL2 with Ubuntu (default)
wsl --install

# Choose specific distro
wsl --install -d Ubuntu-24.04

# List available
wsl --list --online

Reinicie após a instalação. Abra o Ubuntu no início, defina nome de usuário e senha.

Atualizar e instalar o Essentials

sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential curl git wget unzip

# Python 3.12
sudo apt install -y python3.12 python3.12-venv python3-pip

# Node.js 22 via nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 22 && nvm use 22

Configurar o Git

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global core.autocrlf input
git config --global init.defaultBranch main

# SSH key for GitHub
ssh-keygen -t ed25519 -C "you@example.com"
cat ~/.ssh/id_ed25519.pub  # add to GitHub Settings > SSH Keys

Docker em WSL2

Instale o Docker Desktop no Windows, habilite a integração WSL2. Ou instale o Docker Engine diretamente no WSL2.

# After Docker Desktop WSL2 integration enabled:
docker --version
docker run hello-world

# Or install Docker Engine directly
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
newgrp docker

Acessar arquivos do Windows

# C: drive at /mnt/c
ls /mnt/c/Users/YourName/Desktop

# Navigate to Windows project
cd /mnt/c/Users/YourName/Projects/myapp

# Open VS Code from WSL2
code .

# Open Windows Explorer from WSL2
explorer.exe .

Otimize o desempenho do WSL2

Criar%USERPROFILE%\.wslconfigno Windows para limitar o uso de RAM e CPU.

[wsl2]
memory=8GB
processors=4
swap=2GB
localhostForwarding=true

# Apply new config
wsl --shutdown
# Reopen Ubuntu

Código WSL2 e VS

Instale oExtensão WSLno código VS. Correcode .de qualquer pasta WSL2. O VS Code executa seu servidor dentro do Linux – IntelliSense completo e depuração no Linux.

Conclusão

WSL2 elimina inicialização dupla. Com Docker, VS Code e Git rodando nativamente em Linux no Windows, você obtém o melhor dos dois mundos. Configure-o uma vez e você nunca mais olhará para trás.

✍️ Leave a Comment

Your email address will not be published. Required fields are marked *

🌐 Read in:🇬🇧 English🇩🇪 Deutsch🇧🇷 Português🇸🇦 العربية🇮🇳 हिन्दी🇧🇩 বাংলা