Guides / setup-linux-wsl
Setup Linux (wsl)
Setting up an Ubuntu environment on WSL ready for development.
22 Apr 2026· 6 min· 12 sections
In this guide · 12 sections
What will we install?
WSL Install
First, we need to enable some Windows features so everything works as expected. For this, we need a PowerShell window in Administrator mode. Windows will need to restart to complete the installation. Restart your computer and then come back to continue.
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform, HypervisorPlatform -AllIn PowerShell, let’s install WSL
wsl --installOn you user folder C:\Users\{user} (%USERPROFILE%) add a file named .wslconfig with the following content.
This will mirror the wsl network on windows and allow you to access apps running on WSL on you LAN
[wsl2]networkingMode=mirroreddnsTunneling=truenestedVirtualization=trueAliases & Path
First let’s download vim (optional) to edit some files during the process
sudo apt install -y vimEnter the aliases file (if you don't like vim, switch to nano or another)
vim ~/.bash_aliasesAdd the shortcuts and modify as necessary, these are some that I like to use (attention to add your name and email, this will be important later)
# Aliasesalias refresh='source ~/.bashrc && source ~/.bashrc'alias config='vim ~/.bash_aliases'alias update='sudo apt update && sudo apt -y upgrade'alias clean='sudo apt -y autoclean && sudo apt -y autoremove'
# Shortcutsalias q='exit'alias c='clear'alias home='cd ~/'alias chrome='google-chrome $@ &'alias google='google-chrome $@ &'alias toolbox='~/toolbox/bin/jetbrains-toolbox &'alias idea='~/.local/share/JetBrains/Toolbox/apps/intellij-idea/bin/idea &'alias studio='~/.local/share/JetBrains/Toolbox/apps/android-studio/bin/studio &'
# Varsexport USER_EMAIL='Your email here'export USER_NAME='Your name here'export ANDROID_HOME=$HOME/Android/Sdk
# PATHexport PATH=$PATH:$ANDROID_HOME/emulatorexport PATH=$PATH:$ANDROID_HOME/platform-toolsexport PATH=$PATH:/usr/local/go/binnow reload the file to have access to these commands
source ~/.bash_aliaseswith these aliases it gets much easier from now on, now we can use the refresh command to do this
Basic packages
updatesudo apt install nautilus -ysudo apt install git zip unzip fuse net-tools -yTo finish configuring git, it is necessary to configure user information
git config --global user.name "$USER_NAME"git config --global user.email "$USER_EMAIL"git config --global core.autocrlf truegit config --global pull.rebase trueSSH Key
Fill in your email before typing the command and confirm or enter password steps as you wish.
ssh-keygen -t ed25519 -C "$USER_EMAIL"eval "$(ssh-agent -s)"ssh-add ~/.ssh/id_ed25519echocat ~/.ssh/id_ed25519.pubcopy the key at the end of execution, then just paste it on github
Java
SDKman is absolutely the most practical way to install and manage one or multiple java versions on Linux, but it also helps you download Kotlin, Groovy, Maven, Gradle among other tools.
curl -s "https://get.sdkman.io" | bashsource "$HOME/.sdkman/bin/sdkman-init.sh"sdk install javajava --versionFrom now on use the sdk command to manage your installations
sdk --helpNode
Fast node manager, is a Node version manager recommended on the official website, so let’s use it
curl -fsSL https://fnm.vercel.app/install | bashsource ~/.bashrcfnm install --ltsnode -vnpm -vFrom now on use the fnm command to manage your installations
fnm --helpIf you want to download pnpm
npm install -g pnpmGolang
To install the most up-to-date version check on the official website the current version and update the command according to the version number (there is an apt package called golang-go, but it is usually outdated)
export GO_VERSION='1.23.1'With the version defined in our variable we can download it just by copying the commands below and in the future run the same process if we need to update go
sudo rm -rf /usr/local/gowget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gzsudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gzrm go${GO_VERSION}.linux-amd64.tar.gzgo versionDocker
By installing Docker directly on wsl instead of docker desktop, it gets much more practical to use Docker as it would be used on a Linux machine and with CLI. If you prefer Docker with a graphical interface and pretty buttons, skip this step and install Docker desktop.
sudo apt install -y apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgecho "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullupdatesudo apt install -y docker-ce docker-ce-cli containerd.iosudo usermod -aG docker $USERAfter installation, since the user was modified, close the terminal and open it again, in case of problems check the installation
docker --versionGoogle Chrome
After installation, we will be able to use the shortcuts we configured earlier, google, chrome or the standard command google-chrome (this will lock the terminal)
rm -rf ~/tmpmkdir ~/tmpcd ~/tmpwget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debsudo apt install --fix-missing ./google-chrome-stable_current_amd64.debcleancd ..Intellij (Toolbox)
Download Jetbrains toolbox, it’s a Jetbrains tool manager where you can download Intellij (Goland, WebStorm…).
google-chrome https://www.jetbrains.com/pt-br/lp/toolbox/Now let’s go to the download folder, extract and move the file to the right place.
cd ~/Downloadstar -xvf jetbrains-toolbox-*.tar.gz # Extractrm jetbrains-toolbox-*.tar.gz # Delete the zipmv jetbrains-toolbox-* ~/toolbox # Move the files to the toolbox foldertoolboxDone, now just use the toolbox command configured back in the aliases and download Intellij through the Toolbox graphical interface
Android Studio (Toolbox)
We will need QEMU-KVM for emulation within linux
sudo apt install qemu-kvmLet’s check if everything is OK
kvm-okIf it’s OK, let’s give your user access to KVM
sudo adduser $USER kvmgrep kvm /etc/groupRecommendation: after this change restart WSL in powershell
wsl --shutdownNow we need Android Studio, let’s install it through toolbox
toolboxInstall Android Studio normally, and now install the emulator.
After the download you can use the studio alias to open Android Studio.
More Action > Virtual Device Manager > Create virtual device > Select a device (Recommended: Medium device)
Attention: If there is a warning that your user does not have access to KVM, close Android Studio and Toolbox and open again in a new terminal
VsCode
If you want to use VSCode, install it directly on windows and use it directly from Linux using the code command. In case of problems with your installation, remove the Linux configuration files using:
rm -rf ~/.vscode-*Now you have the essentials installed inside WSL. Congratulations✨
Happy coding 🧑💻