Laptop fresh install for a Coder.

New starts are always great chance to do something differently than before. My laptop for the last 5 or-so-years had served me nicely. It is still a great computer while plugged in but the battery has ran it course.

I had all my coding tools installed on Windows. My core tools are VS Code, git, nodejs, mysql & mysql workbench. I actually always installed the classic WAMP which comes with Apache and PHP too. Also an old MySQL version 5.6. Not ideal.

Now I decided to install the minimum to the Windows side and the bulk of tools to the Windows Subsystem for Linux (WSL) side. I chose the newest Ubuntu 22 LTS as the OS and it comes with git preinstalled, nice. Then I installed nodejs, npm and yarn that I am used to. And for the last thing I installed mysql 8 and recovered my dev schemas from my old computer using dumps.

For the Windows install the first thing was to install WSL and Ubuntu 22 LTS of course. After that GUI tools like VS Code editor and the MySQL Workbench. Also recommend the new Microsoft Terminal from the Store and set Ubuntu 22 LTS as the default. Then I noticed that VS Code requires you to install the WSL extension to use the git inside WSL environment.

Hickups

There were some hickups along the way that I encountered and wasn't really mentioned in the official documentations even. Note that you should not treat server environments the same as a WSL environment. WSL is for development and for your personal use.

WSL

I started installing WSL via Windows Store by searching "Ubuntu". The installation failed and I then just realized that, yeah, you need to install some WSL stuff beforehand. I followed this documentation by Microsoft to install it. Note that it installs some old Ubuntu as default so I recommend using the wsl --install -d <DistroName> command instead of the plain wsl --install command. Do this in Powershell as an administrator.

After I rebooted my machine the Ubuntu 22 LTS installation, that failed earlier, continued its process so I ended up with two version of Ubuntu. In Powershell, you can list all the installed distros with this command: wsl --list --all. If you have more than one you'll see which one is the default one and if you want to change it, you can with this command: wsl --setdefault Ubuntu-22.04 for example.

Git

The Ubuntu distro comes with Git by default and I thought that I don't need to install it on the Windows side. My hunch ended up being right!

After installing nodejs etc. I cloned one of my projects and opened it in VS Code from the Ubuntu by simply typing code . inside the project. VS Code opened but no git was found. It actually said that git doesn't exist so I installed Git for Windows. Still it didn't recognize the git repo. After a moment of confusion I realized that I need a WSL plugin for VS Code so what I did was I uninstalled Git for Windows and then installed the plugin. After starting VS Code again, it recognized git from the Ubuntu, great!

So IF you don't need git on the windows side for some reason, you don't need to install it.

MySQL on Ubuntu

I have installed MySQL on many servers before but in WSL it's a bit different. For example I didn't manage to get the service to start in startup process as you would in a server environment. But then again, do you want a mysql process on your device to run all the time? Just use sudo service mysql start and sudo service mysql stop commands when you need to.

I followed this documentation by Microsoft but in that phase 2 (the secure installation) I ended up in a loop when I had to give a password to Root, it just didn't accept anything. So I just had to close the terminal and started a new one and opened mysql connection by just typing mysql. Then I resetted the root password: ALTER USER 'root'@'localhost' IDENTIFIED BY '';. Close the connection and re-run the secure installation script. Now it was available to me write a proper password and complete the process. This I had to figure out myself, the documentation really doesn't help when you encounter problems! Also this has never happened when installing on a server environment.

Conclusion

To be honest I was quite ready to switch away from Windows, but I still ended up buying a Windows 10 laptop on a sale and can't really complain. This setup feels fresh and I can separate my coding projects from everything else. Windows and Ubuntu work seamlessly together and you can access each others filesystems with ease and starting up VS Code in Windows from the Ubuntu terminal is a great bonus. I also set Ubuntu as the default terminal in Microsoft Terminal (the new one).

After installing all of this in Windows 10, I installed Windows 11 and they still work!

Have something to say on this topic? Here's my Twitter: @opiispanen