Seamless Development on Windows 11 with WSL 2.3 and Ubuntu 24.04.1 LTS
Developers and tech enthusiasts often find themselves navigating between the robust development tools of Linux and the user-friendly ecosystem of Windows. This is where Windows Subsystem for Linux (WSL) becomes a real game-changer With WSL 2.3 on Windows 11 and vscode, you can seamlessly run a full Linux environment like Ubuntu 24.04.1 LTS without needing a dual boot or virtual machine.
Setting Up WSL 2.3 on Windows 11¶
Enable WSL¶
- Open Command Prompt, Terminal or PowerShell with administrator privileges.
- Run the following command to enable WSL:
- This will install the latest version of WSL, including the Linux kernel.
Ensure You're Using WSL 2.3¶
- Check the version of WSL in use:
- If you're not using WSL 2.3, update WSL:
Install Ubuntu 24.04.1 LTS¶
- Download Ubuntu from the Microsoft Store Ubuntu 24.04.1 LTS
- Open Ubuntu and follow the instructions to set up your user and password.
Configure .wslconfig
Limit CPU and RAM (recommended)¶
By default, WSL can use as much memory as it needs, potentially consuming significant resources, especially during intensive tasks like compiling code or running multiple processes, to ensure balanced resource allocation between your Windows host system and the Linux environment running in WSL we need to limit WSL memory in .wslconfig
- Create or edit the
.wslconfig
file inC:\Users\<username>\.wslconfig
. - Create new files in notepad and add the following configuration to limit resources:
- Restart WSL for the changes to take effect:
Setting Up Ubuntu 24.04.1 on WSL¶
Update and Upgrade Packages¶
Install Tools and Dependencies¶
Integrating VS Code with WSL¶
Install VS Code in Windows 11¶
- Download and install Visual Studio Code.
Install WSL Extension¶
- Open VS Code, then install Remote Development extension.
Connect to Ubuntu¶
- Open the Command Palette (Ctrl+Shift+P), type Remote-WSL: New Window, and select the Ubuntu distribution.
Install Extensions (Optional)¶
- Code Editor Tools: Prettier, ESLint, GitLens.
- Docker Extension: For managing containers.
Conclusion¶
Integrating Windows 11 with WSL 2.3 and Ubuntu 24.04.1 LTS bridges the gap between the flexibility of Linux and the convenience of Windows, The integration offers the best of both such as
- A powerful development environment without the overhead of virtual machines.
- Direct access to Linux tools and utilities within the Windows ecosystem.
- Seamless workflows using tools like VS Code and Docker.
While the setup might require some initial configuration, the benefits far outweigh the effort. WSL provides a lightweight yet robust platform for coding, testing, and deploying applications efficiently.