Photo by Mike van den Bos on Unsplash
Setup Your Software Development Environment in Windows 11 (+WSL 2)
Me: "Tadaima"; My Personal Laptop: "Okaerinasai"
Your Windows 11 and Windows Subsystem for Linux 2 / WSL 2
WSL 2 is a really cool feature that lets you run Linux apps on your Windows computer, without any complicated setup or messing around with virtual machines.
Basically, it's like having a secret Linux superpower inside your Windows machine! And the best part? You can use all your favorite Linux tools and workflows, right alongside your usual Windows stuff.
It's the perfect way to get the best of both worlds, whether you're a developer or just a curious tech enthusiast. So go ahead and give WSL 2 a try – you might be surprised at all the cool things you can do with it!
Install WSL 2
Start CMD with administrative privileges
Run
wsl -l -o
to list other Linux releases.Execute
wsl --install
command to install default distro.You can install your favorite Linux distribution, use
wsl --install -d NameofLinuxDistro
.
Ubuntu 22.04 LTS has been installed. The requested operation is successful. Changes will not be effective until the system is rebooted.
Reboot the computer.
You then will be prompted to create a UNIX user and password.
To access your Linux distro, search it from your app then click Open.
Re-claim Your Dev Environment
Download Hyper terminal from its official site: https://hyper.is/
Open Hyper properties, go to the Compatibility tab then check "Run this program as an Administrator".
Reopen Hyper and let's make it access WSL by default: Edit > Preferences
Find and update these lines:
...
shell: 'C:\\Windows\\System32\\wsl.exe',
shellArgs: [~],
...
shell
executes the wsl.exe command once Hyper is booted, then shellArgs
changes the directory to the UNIX root.
- Install zsh and oh-my-zsh from Hyper:
sudo apt update && sudo apt upgrade -y
sudo apt install zsh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Download and Install VSCode: https://code.visualstudio.com/Download. Be sure to select Add to PATH option so you can easily open a folder in WSL using the code command.
From VSCode, search and install Remote Development extension.
Update your Linux distributions. Some WSL Linux distributions are lacking libraries that are required by the VS Code server to start up. You can add additional libraries to your Linux distribution by using its package manager. Run
sudo apt update
.Open VSCode then click the green symbol on the left-bottom screen. Choose Connect to WSL. VSCode will configure everything.
Coding.
Closing
In conclusion, WSL 2 is a powerful tool that brings the best of Linux and Windows together in one neat package. With its lightweight virtual machine, full Linux kernel, and built-in display server, it offers a seamless and efficient way to run Linux applications on a Windows computer.
Whether you're a developer looking to streamline your workflow or just a curious tech enthusiast, WSL 2 is definitely worth checking out. So why not give it a try and see what kind of cool things you can do with it? Who knows, it might just become your new favorite tool!
Keep an eye out for future posts where I'll delve into even more interesting topics. In the meantime, I hope this information has been helpful and I look forward to your continued engagement. Thanks again!