Setting up WSL Ubuntu on your Windows Machine (Laptops| PCs)
Today will be slightly technical than my previous post, so brace yourself. I know many of us often work with both Windows and Linux. For a long time, I used Vagrant and VirtualBox to set up my Ubuntu environment for coding projects. It was a very convenient setup; I could carry out all my Linux tasks and run my servers without any issues. However, one day, I ran into problems. Vagrant simply stopped working. I tried troubleshooting it repeatedly, but nothing seemed to fix it. I decided to switch back to using WSL. **WSL(Windows Subsystem for Linux) **allows you to run a Linux environment, like Ubuntu, directly within Windows. It seems great in theory, right? But when I tried to set it up, I encountered another problem: I couldn't get the internet to work in my Ubuntu installation! This was a major setback. You know how crucial internet access is for a developer. How do you download packages, or push your code? I was in a difficult situation. I consulted ChatGPT and read numerous blog posts, and it was a very frustrating experience. Eventually, I found the solution in a Reddit thread. I have to give credit to that person! They suggested installing a tool called wsl-vpnkit. I followed the instructions provided, step by step, and finally, the internet connection was restored. Initial Setup: Install WSL1 (Optional): You might encounter fewer initial issues by first installing Ubuntu with WSL1. Open PowerShell as an Administrator and type in wsl --install to install Ubuntu. If you don't encounter issues, you can skip to the next step. Install Ubuntu: If you haven't already, install Ubuntu from the Microsoft Store. Upgrade to WSL2: Checkout the official documentation https://learn.microsoft.com/en-us/windows/wsl/install .... I observed from several installation that install WSL1 then upgrading to WSL2 saves one the stress of unnecessary troubleshooting but if install WSL2 works out for you at first trail....fine Resolving Internet Connectivity Issues: Download wsl-vpnkit: Download the wsl-vpnkit.tar.gz file from the GitHub releases page. The download link is: https://github.com/sakai135/wsl-vpnkit/releases/tag/v0.4.1 Import wsl-vpnkit: Open PowerShell and import the downloaded file as a new WSL distribution using the command wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit C:\Users\user\Downloads\wsl-vpnkit.tar.gz Remember to replace the path in the command with the actual location of your downloaded file. Run wsl-vpnkit: To establish the internet connection, open a separate PowerShell window and run the command below on the terminal wsl-vpnkit Keep this PowerShell window open in the background. Optimizing VSCode Connection: Speed Up VSCode Connection: To improve VSCode's connection speed to WSL, open a separate PowerShell terminal. Run 'wsl' in PowerShell: In that PowerShell terminal, simply type the wsland press Enter. Leave this terminal open. This action seems to pre-initialize WSL, allowing VSCode to connect more quickly. Connect VSCode: Now, try connecting VSCode to your WSL Ubuntu environment. The connection should be noticeably faster, without the usual long loading times. Internet Issues in VSCode/WSL: If you still experience internet connectivity problems within VSCode or your WSL Ubuntu environment, open another PowerShell terminal. *Run wsl-vpnkit (with --cd) *: In this new PowerShell terminal, run the command: wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit This ensures that wsl-vpnkit is running correctly and that the network connection is properly bridged. Keep this terminal open. Conclusion WSL is increasingly important in DevOps and Cloud Computing because it: Bridges Windows and Linux environments, crucial for heterogeneous setups. Streamlines development with Windows IDEs and Linux tools, replacing dual-booting/VMs. Enables consistent, portable, Linux-based environments mirroring production. Improves automation using Linux tools on Windows. Facilitates cloud adoption with Docker and Kubernetes (especially WSL 2). Offers cost-effectiveness by reducing the need for separate Linux machines. Boosts productivity by allowing developers to use preferred tools on either OS. WSL enhances efficiency, productivity, and adaptability for DevOps teams, supporting cloud adoption with a consistent and portable development environment. By following these steps, you should have a fully functional WSL Ubuntu setup with internet access, and VSCode should connect to it quickly and reliably.

Today will be slightly technical than my previous post, so brace yourself.
I know many of us often work with both Windows and Linux. For a long time, I used Vagrant and VirtualBox to set up my Ubuntu environment for coding projects. It was a very convenient setup; I could carry out all my Linux tasks and run my servers without any issues.
However, one day, I ran into problems. Vagrant simply stopped working. I tried troubleshooting it repeatedly, but nothing seemed to fix it. I decided to switch back to using WSL.
**WSL(Windows Subsystem for Linux) **allows you to run a Linux environment, like Ubuntu, directly within Windows. It seems great in theory, right? But when I tried to set it up, I encountered another problem: I couldn't get the internet to work in my Ubuntu installation! This was a major setback.
You know how crucial internet access is for a developer. How do you download packages, or push your code? I was in a difficult situation. I consulted ChatGPT and read numerous blog posts, and it was a very frustrating experience.
Eventually, I found the solution in a Reddit thread. I have to give credit to that person! They suggested installing a tool called wsl-vpnkit. I followed the instructions provided, step by step, and finally, the internet connection was restored.
Initial Setup:
Install WSL1 (Optional): You might encounter fewer initial issues by first installing Ubuntu with WSL1. Open PowerShell as an Administrator and type in wsl --install to install Ubuntu. If you don't encounter issues, you can skip to the next step.
Install Ubuntu: If you haven't already, install Ubuntu from the Microsoft Store.
Upgrade to WSL2: Checkout the official documentation https://learn.microsoft.com/en-us/windows/wsl/install .... I observed from several installation that install WSL1 then upgrading to WSL2 saves one the stress of unnecessary troubleshooting but if install WSL2 works out for you at first trail....fine
Resolving Internet Connectivity Issues:
Download wsl-vpnkit: Download the wsl-vpnkit.tar.gz file from the GitHub releases page. The download link is: https://github.com/sakai135/wsl-vpnkit/releases/tag/v0.4.1
Import wsl-vpnkit: Open PowerShell and import the downloaded file as a new WSL distribution using the command
wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit C:\Users\user\Downloads\wsl-vpnkit.tar.gz
Remember to replace the path in the command with the actual location of your downloaded file.
Run wsl-vpnkit: To establish the internet connection, open a separate PowerShell window and run the command below on the terminal
wsl-vpnkit
Keep this PowerShell window open in the background.
Optimizing VSCode Connection:
Speed Up VSCode Connection: To improve VSCode's connection speed to WSL, open a separate PowerShell terminal.
Run 'wsl' in PowerShell: In that PowerShell terminal, simply type the wsl
and press Enter. Leave this terminal open.
This action seems to pre-initialize WSL, allowing VSCode to connect more quickly.
Connect VSCode: Now, try connecting VSCode to your WSL Ubuntu environment. The connection should be noticeably faster, without the usual long loading times.
Internet Issues in VSCode/WSL: If you still experience internet connectivity problems within VSCode or your WSL Ubuntu environment, open another PowerShell terminal.
*Run wsl-vpnkit (with --cd) *: In this new PowerShell terminal, run the command:
wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit
This ensures that wsl-vpnkit is running correctly and that the network connection is properly bridged. Keep this terminal open.
Conclusion
WSL is increasingly important in DevOps and Cloud Computing because it:
Bridges Windows and Linux environments, crucial for heterogeneous setups.
Streamlines development with Windows IDEs and Linux tools, replacing dual-booting/VMs.
Enables consistent, portable, Linux-based environments mirroring production.
Improves automation using Linux tools on Windows.
Facilitates cloud adoption with Docker and Kubernetes (especially WSL 2).
Offers cost-effectiveness by reducing the need for separate Linux machines.
Boosts productivity by allowing developers to use preferred tools on either OS.
WSL enhances efficiency, productivity, and adaptability for DevOps teams, supporting cloud adoption with a consistent and portable development environment.
By following these steps, you should have a fully functional WSL Ubuntu setup with internet access, and VSCode should connect to it quickly and reliably.