This is a reference guide to set up a professional development environment on Windows for the Software, DevOps, or Cloud Engineer. This is not an exhaustive list, yet it is enough to get someone started.
Windows Terminal
First, get the Windows Terminal if you don’t have it already. It comes bundled with Windows 11 by default.
Note: I will be using “PowerShell” and “Windows Terminal” interchangeably in this guide.
Package Managers
In my opinion, it’s a good idea to have a package manager installed on Windows, regardless if you choose to operate with WSL or not. I’d recommend at least getting winget and chocolatey. There’s also scoop, but I haven’t personally used it myself. Ensure to do this from an Admin PowerShell.
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
winget -v
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco -?
WSL or Git Bash?
Unless you want to stick with PowerShell, which perfectly fine, we will need a way to run bash scripts (.sh files) and potentially run Linux command line tools.
Very Important thing to note: If your company utilizes a VPN, WSL WILL NOT WORK. You can see why here: WSL2 Sucks in Ways People Ignore. Use Git-Bash Instead - YouTube. I personally had an issue due to my organization running a VPN and SSH keys on GitHub. If this is the case, Git Bash will be much easier to get up and running, especially if you are not familiar terminals.
WSL
Microsoft’s Best practices for set up
You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
wsl --install
This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this).
wsl -l -v
This command will show which Linux distributions you have and which WSL version it’s on.
If you need to change versions, use the command: wsl --set-version <distro name> 1
replacing with the name of the Linux distribution that you want to update.
You can also go to the Microsoft Store and download a distribution from there.
After you set up a UNIX username and password, ensure you perform an update.
sudo apt update && sudo apt upgrade
Your New Home Directory
To open your WSL project in Windows File Explorer, enter: explorer.exe .
(In my .bashrc, I alias ii=explorer.exe
just like in PowerShell).
Be sure to add the period at the end of the command to open the current directory.
Microsoft recommends to store you project files on the same OS as the tools you plan to use (this can also cause problems with permissions). What I do is pin the \\wsl$\<DistroName>\home\<UserName>
filepath to Quick Access, make a directory called code, then put all my projects in there.
Git Bash
Using Git Bash does not include the overhead of a Linux VM running in parallel, such as with WSL. With Git Bash, you’ll still be working directly in the Windows file system and your home directory will be: C:\Users\<UserName>
.
Installing Git for Windows will also install Git Bash.
winget install --id Git.Git -e --source winget
Adding Git Bash to Windows Terminal
Open Windows Terminal > dropdown > Settings > Add a new profile:
- Name: Git Bash
- Command line: C:\Program Files\Git\bin\bash.exe (this may be different depending on your installation)
- Starting directory: %USERPROFILE%
- Icon: C:\Program Files\Git\mingw64\share\git\git-for-windows.ico
Git
You’ll need git for downloading repositories and have version control over your source code.
Git on WSL 2
If working in WSL 2, get git:
sudo apt install git
Git on Git Bash
You already have git installed!
If your organization uses SSH, you’ll need to set up the ssh keys from the Windows side following these instructions:
- Open Services > OpenSSH Authentication Agent
- Set Startup Type to Automatic
- Click Apply, click Start and ensure Service status: Running
- You may need to restart the Windows Terminal, then follow GitHub’s guide for generating SSH keys
GitHub Desktop
Another option is GitHub Desktop, which is a GUI alternative. Of course, this will only be viable if your company hosts their repositories on GitHub. You won’t have to deal with SSH keys and you’ll have the ability to directly sign into GitHub Enterprise. However, this does not install git, so the CLI commands will not work out of the box.
AWS CLI
If your organization uses Amazon Web Services, you’ll need the AWS CLI.
If you have a different cloud provider:
AWS CLI on WSL
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install unzip
unzip awscliv2.zip
sudo ./aws/install
aws --version
rm awscliv2.zip
aws configure
AWS CLI on Windows (Git Bash or PowerShell)
See the documentation.
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
In PowerShell or Git Bash:
aws --version
aws configure
Terraform
In order to provision container orchestration, VPCs, load balancers, etc. to your organization’s cloud provider, you’ll probably want to write the infrastructure as code (IaC) and to do that, you’ll probably need Terraform.
Terraform on WSL
sudo apt-get install software-properties-common
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform
terraform --version
Terraform on Git Bash or PowerShell
Download and install Terraform here: terraform.io/downloads.
Or, in PowerShell:
choco install terraform
terraform --version
VSCode
In order to actually write code, we’ll need a code editor or IDE. If you chose WSL you’ll be able to access files in your Linux filesystem with Visual Studio Code and the Remote Development Extension Pack. Otherwise, feel free to use any IDE of your choice.
winget install -e --id Microsoft.VisualStudioCode
Get started using Visual Studio Code with Windows Subsystem for Linux - Microsoft Docs
If you are a Java Developer, IntelliJ integrates with WSL as well.
Docker
Next on the list we need a piece of software to build and run containers on our local device. Although there are some ways around it, you’ll probably need to install Docker Desktop.
Docker WSL Integration
Setup is minimal with Docker Desktop and WSL 2: Docker Desktop WSL 2 backend | Docker Documentation
In summary, just ensure WSL integration is checked and the correct Linux distro is set to default. You can check that by running this in PowerShell:
wsl -l -v
wsl --set-default <distro name>
Docker on Git Bash or PowerShell
The docker
command should work by default after the Docker Desktop installation.
My .bashrc
Finally, here’s a copy of my aliases in my .bashrc that you can use in either WSL or Git Bash.
# Aliases
alias ls="ls -ahN --group-directories-first --color=auto"
alias cls="clear"
alias w="curl wttr.in"
alias ii="explorer.exe"
Closing
Feel free to read the links below to learn more about WSL and Git Bash. From here, everything else you would need is dependent the software that your company uses. Hopefully, this has given you a good foundation to start from.
References / Additional Info
WSL2 Sucks in Ways People Ignore. Use Git-Bash Instead - YouTube
3 Gotchas with WSL 2 around Disk Space, Memory Usage and Performance - YouTube
Reclaim Tons of Disk Space by Compacting Your Docker Desktop WSL 2 VM - YouTube
How to add repository from shell in Debian?
Remote Development Extension Pack
Adding Git Bash to Windows Terminal
Files showing as modified directly after a Git clone
Windows Subsystem for Linux Overview
(Windows) Git Bash vs Cygwin vs Windows Subsystem for Linux? - Reddit
git bash on windows vs. WSL - StackOverflow
What is the difference between Cygwin and MinGW? - StackOverflow