This text was taken from the book and a Udemy course The DevOps Toolkit: Catalog, Patterns, And Blueprints
Help us choose the next subject for the course by filling in a survey at https://www.devopsparadox.com/survey
Linux Shell is essential and I will not go into great length to explain the reasons given that I am assuming that you already know that. So, we’ll jump straight into Windows Subsystem for Linux (WSL). It lets us run Linux environment directly on Windows, and without the overhead of a virtual machine. It is part of Windows (not a replacement), so you can keep doing "Windows stuff", while still benefiting from Linux Shells and quite a few other things. It is a much better solution than using Shell emulators like Cygwin or GitBash, and it saves you from wasting resources on a virtual machine. WSL might be the best thing that happened to Windows, at least during the last couple of years.
Before we proceed, please note that I am assuming that you are using Windows 10 or newer.
The setup is relatively easy and straight forward, so let’s get down to it right away.
We’ll start by getting you up-to-date.
Please open Windows Update Settings. You can do that by typing it in the search field, or any other way you prefer opening applications.
If you’re running an older build of Windows, this might be the right moment to upgrade. I’ll assume that you know how to do that.
Next, we need to turn on the Developer mode.
Open Settings followed with Update & Security, and select the For developers tab. Once inside, turn on the Developer mode.
Now we are ready to install the Windows Subsystem for Linux (WSL).
Open OptionalFeatures, select Windows Subsystem for Linux, and restart.
The only thing missing is to install Linux.
Wait until Windows is restarted, and open Microsoft Store.
You should be able to install any Linux offered in the store. However, for simplicity, I recommend that you start with Ubuntu since that’s the one we’ll use in the examples that follow. Otherwise, you might need to modify the commands in the examples. Most of them should be the same no matter which Linux you choose, and the significant change would be in installing and managing packages.
Please search for Ubuntu, select it, and follow the instructions to install it. I’m using Ubuntu 20.04 LTS.
Launch it once it is installed.
After a while, you will be asked for credentials.
Type your user name, enter the password, and confirm it.
From now on, you should be able to use Bash. Let’s confirm whether that’s indeed true.
exit to get out of Ubuntu’s terminal and open
What you see in front of you is Bash Shell. From now on, you can run the same commands as those using macOS or Linux, and you do not need to emulate anything or create a virtual machine.
Nevertheless, we are not yet done getting to the same level as those using other operating systems. Ubuntu installed as WSL does not come with all the tools that are typically installed in a stand-alone Ubuntu. For now, we’ll focus only on the two essential tools. We will need
curl to send requests or download files. We will also need
git, and I have no intention of explaining what it does. You’re in deep trouble is you never used Git.
We’ll start by adding the
git-core package repository.
sudo apt-add-repository ppa:git-core/ppa
You will be asked for the password. Use the same one you provided during the Ubuntu installation process.
From now on, I will not be telling you to type the password whenever you’re asked, or to confirm that you want to continue with some process.
Next, we need to update the local copy of the package definitions.
sudo apt update
Now we are ready to install
sudo apt install curl git
We will not need the terminal any more in this section, so let’s
That’s it. You are still using Windows for whatever reasons you like using it, but you also have Ubuntu running as Windows Subsystem, and you can use it for all Shell-related tasks. Now you should be able to run all the commands from this book without resorting to magic, emulations, or virtual machines.
Please note that there might be other packages you might need. I’ll provide the instructions for those required in this book, and you are on your own for the others. I am sure you will figure them out.
What matters is that, from now on, you should follow the instructions for Linux and not for Windows. As a matter of fact, there will not be any Windows-specific instructions anymore. You’re a Linux guru now, at least when commands and scripting are concerned.
Let me make sure that the message is clear.
From now on, follow the instructions for Linux whenever something is executed from a command line.