- [Instructor] In a recent video about virtual machines,
I made mention that Microsoft has taken significant steps
to embrace the opensource community.
One of those steps is the inclusion
of a subsystem for Linux.
The Windows Subsystem for Linux is a Windows feature
that allows you to run an instance of Linux
on your server.
Now I'm not talking about a duel-boot scenario.
Windows and Linux can run at the same time.
This doesn't require Hyper-V or virtual machines
or containers.
It's not virtualization at all.
It's an entire instance of Ubuntu or SUSE Linux,
running concurrently on your Windows server.
Installing the feature is pretty simple
but pulling down and installing a Linux distribution
does take a couple of steps.
You can install the subsystem
by using the Install Windows feature in Powershell
or by launching the wizard from the server manager.
Since I did the last one in Powershell,
I'll go ahead and run this one from server manager
just for fun.
I'm going to launch the wizard from the dashboard
and move forward through,
yes I want to install a role or feature,
I want to install it on this machine,
and it's to a role, I want to install a feature.
So here I'm going to scroll to the very bottom
of the alphabetic list
and look for Windows Subsystem for Linux.
And when I check that box,
you can see that no additional steps were added
so I can go ahead and just continue on forward
and add this feature.
And this installation might only take a few seconds
or a couple minutes, depending on your resources,
but as you can see here,
it does require a reboot because
it's made some substantial changes.
So, I'm going to go ahead
and close this wizard and reboot the system.
And restart because of a planned operating system
reconfiguration, and I'm going to fast forward
to the point where the server has restarted.
All right, now that the reboot has completed,
I want to download and install a distribution of Linux.
So let me go ahead and move over the Powershell to do that.
Run as Administrator
and first, we need to go ahead and download it.
And to do that, I'm going to use the Invoke-webRequest
commmandlet.
I need to specify couple of parameters here.
First, I need to say that the URI
is HTTPS,
aka dot ms, slash,
and here I gave the name of the distribution
that I would like to download.
And you can do web searches
to find what's available at the time.
I've seen SLES GNU,
SUSE Debian Ubuntu
available for downloading and use in this environment,
but I'm going to go ahead
and start with an Ubuntu distribution.
Ubuntu, let's use 1604,
and then another parameter that I need to add
to this commandlet is I need to specify the output file
and the file that I'm going to create,
I'm going to give it a very simple name to type later.
I'm just going to call it Ubuntu dot APPX
because that's the file extension
that it's downloading anyway,
and I'm going to add one other parameter, UseBasicParsing.
Now, this download can be fairly large,
so once again, I'm going to skip forward quite a bit
and the video will resume momentarily
at the end of this download.
All right, now that's downloaded,
and no, my server isn't quite that fast.
We just trimmed out some of the time
to speed things up a bit here.
Now that the download's done,
we're going to need to rename the file
so that we can unpack it.
The Linux installer downloads as an APPX file,
but that file has all of the same properties
as a common ZIP file.
So, I can rename the file
right here in Powershell, using Rename-Item.
The file that I want to rename is
Ubuntu dot APPX
and I would like to rename it to
Ubuntu dot ZIP.
And renaming doesn't take very long at all
so the next commandlet is to expand the archive.
And we're going to unpack the file, Ubuntu dot ZIP,
and we're going to put all of that information
in a new directory which we will create
and call Ubuntu.
And that unpacking doesn't take very long.
Let me go ahead and take a look at where we are.
Here, you can see that the Ubuntu folder is not here.
That's because I told it to put this folder
in the root of the Drive.
So let me go ahead and change directories
to the root of this drive
and if I hit the Directory again,
there's my Ubuntu folder.
So change directories into the Ubuntu folder.
Run another directory listing
and here we find the Ubuntu dot EXE,
the file that's going to install this distribution of Linux.
In Powershell, when you want to run an executable,
even if you're in the current directory,
it's always a good idea to start with dot slash
and Powershell is not real particular
about whether that slash leans forward or backwards.
Whichever you type will end up working out just fine.
Let me go ahead and type Ubuntu dot EXE
and that will install Linux into that subsystem
on this machine.
Now this is going to take longer than the download,
but when it's complete,
you'll be asked to create a Linux username and password
and then you'll be dropped directly
into your Linux environment.
You can exit out of that
and at any given time, you can open Powershell
or a command prompt and type Bash
to re-enter your selected Linux distribution.
That environment will allow you to
install Linux applications.
Maybe you want to install the Linux instance of Docker.
Then you can host Windows containers
and Linux containers at the same time
from the same physical hardware
or from within the same virtual server.