Prepping a Windows Machine for Development
After nearly 20 years away, I found it was surprisingly easy to set up a full development environment on a modern Windows 10 machine. Given a decent browser, terminal, shell, and IDE, the underlying desktop environment turns out not to be much of an impediment.
Steps:
-
Download and install Git. The installation will present quite a number of windows with questions as to how you want to install it. The defaults provided will work just fine.
-
Install Windows Terminal. Pin it to the taskbar. Then:
- Add a git bash profile, and possibly adjust the starting directory
- Optionally add one or more ssh profiles
-
Download and install Visual Studio Code
-
Within a terminal window, run
winver
. If you don't see version 2004 or higher, go to Download Windows 10 and click "Update Now" beneath the "Windows 10 May 2020 Update". Despite it being late July, Windows Update on my computer would only taunt me and tell me that the May update would be available at a later time; but if you threaten to download a full ISO, you will get an option to download the update. -
Install Windows Subsystem for Linux. Paste the following two commands into your terminal:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Reboot your machine.
Install Linux Kernel Update package.
Now paste one more command into the terminal:
wsl --set-default-version 2
-
Install Ubuntu 20.04.
-
Get systemd running on WSL2. Options include:
I'm not sure I'm qualified to determine which is best at this point, but the wsl2-hacks approach seemed the most straightforward and least obtrusive. That being said, I had a number of problems:
- The first, and most minor, is that I'm running Ubuntu 20.04, so
where it says
ubuntu1804.exe
, I replaced that withubuntu2004.exe
. - Next, I found that ubuntu already had a
/usr/bin/bash
, so I went with/usr/bin/bash-bootstrap-services
instead. - Finally, and most troublesome,
daemonize
is in/usr/bin
instead of/usr/sbin
. The script, as written, will hang indefinitely.
Given the third problem, I would recommend that the steps in the wsl2-hacks instructions be run in a different order. After step 1, jump to step 4. Then do step 3 (
sudo
will no longer be required at this point) and then test the script by running it. If it logs you in as your user ID and the test in step 5 works, then and only then do step 3.Incidentally,
ubuntu2004.exe help
has a typo: distribuiton. - The first, and most minor, is that I'm running Ubuntu 20.04, so
where it says
I am not clear why systemd is not included with WSL's Ubuntu 20.04, and
what I am losing by using the wsl2-hacks,
but that hack allows me to fully reproduce my development environment.
I can even add entries for ::1
in my
C:\Windows\ System32 \drivers\etc\host
for my vhosts and access
them directly in Firefox (but curiously, not Edge or Chrome).
One thing I have not done is to enable Running Graphical Applications. The apps I use outside of the command line all are available on Windows.