WSL 2: Getting started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
- In this video, I'm gonna show you how to run WSL version two on a Windows 10 laptop. I'm gonna show you how to install WSL and I'm gonna show you how to use the integration between Linux and Windows to do interesting things. WSL version two builds on the work done with WSL version one, but rather than using a translation layer between Linux and Windows, it uses virtualization technology to allow you to run lightweight virtual machines directly on Windows 10. Gone are the days when Microsoft said "Linux is a cancer," gone are the days when Microsoft hated Linux. Microsoft have changed dramatically over the last few years. They've purchased GitHub, they do a lot of work in the cloud, and they now give you a Linux kernel directly within Windows. Yes, even though it's unbelievable, you get a Linux kernel with Windows 10 these days. This makes it very easy to learn Linux, allows you to run a Windows operating system, but still develop on Linux if you want to, very tight integration between WSL version two and Windows 10. Let's get started. (electronic music) In this example, I'm using this Windows laptop. This Windows laptop is running Windows Home Edition, it's not running Professional. You don't need the Professional version of Windows to do this. Home Edition is fine. As you can see here, Windows edition, Windows 10 Home. Now there are some requirements. You need to have a later release of Windows 10. If I run winversion, I can see that I'm using version 2004. It's recommended that you have at least that version, so OS Build 19041.246. You can see this on the Windows 10 release information. Version 2004 was released on the 27th of May 2020. Here's the operating system build. Once again, that's the version that I'm running on this computer. I've basically updated this computer to that version. It's recommended that you do the same. As always, go to your Windows update settings, go to Windows update. Make sure that you've updated your computer to at least this version of Windows 10. Once you've updated your Windows computer to that release, it's fairly simple to enable this. You need to go to turn Windows features on or off in Control Panel. I'm once again using Windows Home here, so I'm not going to enable the Hypervisor Platform. All I'm gonna enable is the Windows Subsystem for Linux and the Virtual Machine Platform. Make sure that you've enabled both of those options, Windows Subsystem for Linux and Virtual Machine Platform. Again, we're going to be using a virtual machine here rather than a translation layer between Linux and Windows. Much better in WSL version two. Click okay. Windows searches for the required files and then applies the changes. What you will need to do now is reboot your computer, so click restart now to restart your Windows computer. Windows updates are installed and the computer's rebooted. Once the computer has rebooted, go to the Windows Store and search for Ubuntu. Ubuntu released 20.04 LTS in April 2020, so I'm gonna get that latest release of Ubuntu. I've already downloaded this, so it displays as install. If you haven't downloaded it previously, then click download and once you've clicked download, click install to install this on your computer. It's about 432 Megan size. Once it's downloaded, click launch and as you can see, it says installing, this may take a few minutes. I'm getting an error saying this requires a kernel component. I need to go to this URL to get an update, so I'm gonna go to that URL. I'm told that I need to download the latest WSL two Linux kernel update package for 64-bit operating systems. I've already downloaded that, but I'll download it again. It's only 13 Megan size. In my downloads already, this is the file that I've downloaded, so I'll double-click on that and click run. I'm told that the setup wizard will install the Windows Subsystem for Linux update on my computer. Click next to continue, so I'll click next, click yes to install the software and click finish. Now that that's been done, I'll press any key to continue and I'll click launch again to install the software. I'm told installing this may take a few minutes. I'm told please create a default UNIX user account. The username does not need to match your Windows username, so I'm gonna create a username of David and I'll set a password and I'll press enter. I'm told that installation is successful. To run a command as administrator, use the sudo command and I'm told welcome to Ubuntu 20.04 LTS. Notice the Linux version 4.19.104 Microsoft Standard Edition x86 64-bit. LS as an example shows me that there are no files, PWD shows me the directory I'm in. I can go to root as an example, so PWD LS shows me the files here. As you can see, I'm running Linux. I'll type exit now to exit out of that. What I've basically done now is installed Linux on this computer. If I wanted to start that again, I can type Ubuntu and run Ubuntu and notice in a matter of a few seconds, I've got an Ubuntu shell running on my computer. What I'll do is open up PowerShell. This is PowerShell. It's not a Linux terminal, but I've got a Linux terminal in the background. Make this a bit bigger. I've got a Windows PowerShell and a Linux terminal. I can use the command WSL-L-V to see the version of the machines that I'm running. In this example, I'm running version two. If your Linux VM is running version one, you can use the command WSL--set version Ubuntu, or whatever the name of the virtual machine is, two and this will make it use version two. You could set it back to version one if you wanted to, but I'm gonna leave that at version two. You can also make version two the default by saying WSL--set default version two, and that'll make it version two by default. Your output may vary slightly to what I'm showing you here because I've already set mine to version two, but as an example, let's set that Ubuntu to version one. You can see the Linux shell closed. The conversion process is taking place now and while I'm waiting for that, let's get Ubuntu 18.04 LTS. I'll click get to get 18.04, so an older version of Ubuntu, and that's now downloading. Today, it's recommended that you use WSL version two. It's a lot more optimized, runs a lot quicker, it's using virtualization technology, but you could use version one if you wanted to. Version 18.04 has been installed. I'll click launch to launch 18.04. I'm gonna specify a Linux name once again, put a password in, and as you can see, I'm now using 18.04. I'll use LSB release actually so we can see the release. You can see that this version is 18.04 Ubuntu. Going back to my 20.04 WSL, L version shows me that 18.04 is running, it's using version two, 20.04 has been stopped, it's using version one, but I'll set it back to version two. I'd rather have everything running as version two. 18.04 started as version two because I set WSL version two as the default, but I'll close this down, I'll open up another PowerShell, WSL-L-version. This is being converted, this is running at the moment, so to start Ubuntu, simply search for the Ubuntu that I wanna use, so 18.04, and there you go. LSB release-A. I've got 18.04 running. Once the conversion has completed, I'll start 20.04. The version has completed. WSL-L, you can see we've got two Linux distributions, -L-V. We can see that Ubuntu 20.04 has stopped, it's using version two again, 18.04 is running using version two. You probably don't wanna jump from one version to the other like I've shown you here. I just wanted to show you the commands. You probably wanna stick with version two if that's the version that you're starting with. Again, I could start Ubuntu 20.04. Here's 20.04. I'll make the size of this window a bit bigger, so let's go 20. I've got two windows now. Again, LSB_release-A shows me that I'm running Ubuntu 18.04 here. On this window, LSB_release-A, I'm running Ubuntu 20.04 and here, I'm running Windows. Notice the prompt here is a Windows prompt whereas here, I've got Linux prompts. Let's make these windows a bit bigger. I've got Ubuntu 18.04, Ubuntu 20.04, and Windows 10 all running on the same computer. I can shut these down. Notice they're still running. If I just type WSL, I'm running directly within Ubuntu 20.04. If I exit out of there, I'm back on Windows again so I can use command such as DRR, I can also use the command WSL--help to see help. As you can see here, I've got the shutdown command to WSL--shutdown and then if I look at all my versions again, notice they both shut down. Both 20.04 as well as 18.04 shut down, but notice I could simply start Ubuntu 20.04 this way. It's already booted, so back in PowerShell, I can see 20.04 is running, 18.04 has stopped. I've got an Ubuntu shell here once again. It took only a few seconds to boot up. That's much quicker than using VMware Workstation Player as an example. And that being said, it's now possible with the latest release of VMware Workstation Player to run WSL version two and VMware Player at the same time. However, I have found that it doesn't work if you wanna use nested virtualization. This virtual machine requires nested virtualization and in this case, I have problems starting the virtual machine up. If you want to run a virtual machine let's say Kali or Kali Linux here, it's possible to boot this up at the same time as running in WSL, but I have found that it gives me problems, so after this point, I wouldn't be comfortable running VMware Workstation Player at the same time as WSL. You might find that it runs really slowly, but it is possible to run these two together. Notice I've got Kali or Kali booted up and I've got Ubuntu 20.04 running within WSL, so WSL-L-V, I've got Ubuntu 20.04 running as we can see over here and I've got Kali or Kali Linux running at the same time, so LSB release-A. I'll zoom in a bit here to make it easier to see, but notice I've got once again, LSB_release-A, this is Kali or Kali Linux 20.01 and I've got Ubuntu 20.04 running at the same time on a Windows 10 Home computer. Personally, I wouldn't run VMware Workstation Player or VMware Workstation Pro or VirtualBox at the same time as WSL because nested virtualization does not support it. I find that it runs slowly. You're probably gonna wanna stick with VMware Workstation Player or VirtualBox if you wanna boot up VM's, but the great thing about WSL is there's very tight integration between Windows and WSL and if you wanna get your feet wet so to say or if you wanna start learning Linux, this is a great way to get started. One of the advantages of WSL version two is it boots up really quickly. You could also compile a lot quicker. It's a lot quicker than WSL version one. It's much quicker to boot up a shell like this than it is to try and boot up the virtual machine, but there's also tight integration between Windows and Linux. If I type code dot, what I'm doing is starting the Visual Studio Code, which is a Windows application, and notice I'm told that the remote WSL extension is recommended as you have WSL installed on your system and I'm gonna click install to install that. What it's gonna allow me to do now is open any folder within Visual Studio Code. I'll run that again. The VS Code server for X86 is downloaded and installed and notice now, I'm able to create code within Visual Studio Code, but on the Linux Subsystem. Notice I can see my bash history. I'm basically working on the Ubuntu system. If I go file and new file, and I'll paste some Python code here, make that a bit bigger, this will allow me to SSH to a Cisco switch running on the internet. I'm gonna click save and I'm gonna call this xe.py and click okay. This is a Python script once again. On my Linux Subsystem, type LS. Notice I've got a file called xe.py. I could run this by using the command python3 xe.py. Now I'm told that netniko is not available, so first thing, is Python installed? Python version two is not installed, but Python version three is installed by default on my Linux Subsystem. I'll just minimize that so we can see the screen clearly. I've got Python three, but I need to install this module, netniko, to be able to use this command. I'm gonna run pip3. That's not currently installed, so I'm told I can use sudo apt install python3-pip. I'm told that that doesn't exist, so let's do sudo apt update to update my references. As you can see, these are proper Linux commands. Then let's install python pip three, so that went quickly. Just to show you the command, I ran this command sudo apt install python3-pip, I'm gonna say yes to install it. That's busy installing. There you go, it's installed, so I'll say sudo pip3 install-u netmiko to install netmiko. Netmiko is now installed, so I'll clear the screen. Once again, we wanna run this application, so on Linux, python3 xe.py, a Python script. This should connect to a Cisco router on the internet and pull back information such as the interfaces on the router, and there you go, and that came from this command. This is a command that I'm sending to a Cisco switch actually, not a router, and pulling back at the information. That shows us the output of a command, but to show the integration, I could use a command here such as show IP route and what I'll do is click file, save, and then back in Linux, if I type cat xe.py, notice the file has changed and if I run that again, the output will be different here. Here's the output. I'm running the script in Linux, but I'm editing it from within Windows. There's very tight integration between the Linux subsystem and the Windows operating system. That was a quick overview of WSL running within Windows 10. I hope you enjoyed this video. If you did, please consider subscribing to my YouTube channel, please like this video, and please click on the bell to get notifications. I'm David Bombal. I wanna wish you all the very best. (electronic music)
Info
Channel: David Bombal
Views: 425,264
Rating: undefined out of 5
Keywords: WSL 2, WSL2, Windows Subsystem for Linux 2, WSL, WSL1, WSL 1, Linux, Linux kernel, Microsoft, Ubuntu 20.04, Ubuntu, Windows on Arm, WSL2 on Arm, Python, Techn, Explanation, Tutorial, Windows 10, VS Code, wsl, how to install wsl 2, windows subsystem for linux, linux, windows 10, ubuntu, linux wsl 2, windows 10 wsl 2, powershell wsl 2, getting started wsl 2, set up wsl 2, setup wsl 2, upgrade to wsl 2, wsl 2 fast, wsl 2 powershell, update to wsl 2, windows subsystem for linux 2
Id: _fntjriRe48
Channel Id: undefined
Length: 20min 33sec (1233 seconds)
Published: Thu Jun 11 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.