Windows Subsystem for Linux (WSL) Tutorial & How To

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now back in the day men were real men women were real women small furry creatures from Alpha century were real small furry creatures from alpha Century Linux was real Linux Windows was real Windows and never either to have anything to do with each other until windows subsystem fallings hello there my name's Gary Sims this is Gary explains thanks to Douglas Adams for that opening quote there today I want to talk about Windows subsystem for Linux so if you want to find out more please let me explain [Music] so windows subsystem for Linux is an official thing official feature of Windows provided by Microsoft itself that provides a compatibility environment that allows Linux tools and programs to run inside of Windows once you install it you get access to a terminal window where you can run bash and from there you can run all the normal things you would run compilers and you can do editing copy things around secure shell and access a virtualized a containerized compatible kind of Linux environment now I don't want to get at all into the politics you might think this is a terrible idea or you might think it's a great idea I want to look at the technology that Microsoft provide now I say this is mainly for command-line tools now I'll talk at the end about GUI apps so let's just pick that up at the end before we do that let's just jump straight in and install it and see what it provides ok so here we are on a Windows 10 machine and the first thing you do is go down to the Start bar and find the control panel I'll do that by starting to tuck the word control there comes a control panel then go to here to programs and then turn or Windows Features on or off that will bring up a little list of things that are activated here on this windows feature that install and we want to find it here windows subsystem for Linux and we want to tick that and click OK and that will start to install it and then once the installation has completed says we need to reboot the PC so we'll just quickly reboot this [Music] [Applause] okay and once the PC has restarted we now need to install a Linux distribution and the way you do that is you go to the Microsoft Store and then you can pick a Linux distribution that you want to run I'm gonna opt for Ubuntu I think if we type in here Linux we can see some of the different versions are available here here we go look at this Debian and Carly and SUSE Enterprise and so on so I'm going to go with the Ubuntu 18.04 long-term support version so that will be handy because we know it's supported for a long time five years from 2018 so just click install on that max off asked me if I want to sign in with my account I do not at this point and so it's gonna start downloading that now and then that will install in a moment okay now that's installed we can launch I'm not going to launch you from here and want to show you how you launch it from the Start menu can go down here and it is up there of course or we can start typing and it finds it like that so let's launch it and it will come a window and this window says there's a little bit more of installation that requires to happen just before it can actually work fully this only happens one time the very first time you install it so we'll let it finish doing its work there okay and one of the things it needs to do is to create a an account for us so I'm going to type in a username and password here for myself okay and that's it now here we are on a linux command shell actually it in bash I think so you can do normal things you know LS there's no files in there to show we can run top for example to see the processes are running now most things you know PWD shows us where we are now most things you might need are probably not installed in this it's quite a minimal system so even AC compiler GCC is not there it will say it won't be able to find that you know things like even like Python are not even installed okay so what I'm gonna do now is I'm just going to install the command line G see compiler see compiler and we're gonna write a quick C program and run it and then what we do is we're gonna see how compatible that binary is with other Linux system so first of all we do a sudo apt-get update to make sure all of the links to the repositories are up-to-date we'll just let that run for a moment okay and then we're gonna run apt-get install GCC so we'll just let that run yes we'd like to stall it all please and this will take a few minutes to just download that stuff okay so that's now installed so what we're going to do is in a write very simple C program hello world dot C so let's just quickly type that in hello world from windows subsystem for Linux okay let's say that let's see if it compiles GCC hello world C yes it does so now we have a file called paid out which as we can see is a 64-bit Linux file okay and we can now just run that page out and there we go hello world from wsl now I have another server on my network which is a Linux a standard Linux server nothing funny about it at all and what I'm gonna do is I'm going to copy this file a dot out to that server okay and it's on a local address here okay and we're gonna copy straight into my home directory there it's gonna ask us if that's ok yes type in the password for that other server ok so it's now copied a door out over to there so now if we actually log in to there using secure shell and type in the password for there now on this system which as you can see is a ubuntu 16.04 system we can see there is now this file called a door out and is exactly the same file and we can run it here there we go a door outside I've taken this Linux file I've compiled on the windows subsystem for Linux and I've copied it over to a normal linux server and it run fine in fact if we go back to our normal server I have my thread test tool if you remember from other videos and what we can actually do is we can copy the source code for that one it's also on that server once they clear 1.7 source slash thread test tool dot C and it's copied over to here ok and here is that C program I've got there ok and reason I'm copying this over because this is a bit more of a complicated program because for example it's running with P threads so let's do that GCC - P thread - OH thread test tool thread test tool dot C and there it has its compiled fine and then we can actually run it and here we can see it running on my on this windows subsystem for Linux so that worked absolutely fine now of course you can do other things for example if you want to get access to your files on Windows ok let's go over to here like this if we go to if we do a DF - H we can see that the C Drive there is mounted on slash melt slash C so we can go to slash mount slash C okay and that is my actually my windows files and if I go to users Gary ok now that is my normal directory and in here we could create ourselves a you know and a directory called Ubuntu and we can go in here and let's say we can copy actually that C program that I just wrote hello world so we're going to copy hello W dot C to here and we can copy a door out to here and there they are in that directory you can still run a time I know Windows Explorer and in here if I want to drill down through to my normal directory the C Drive users Gary and then now here I've got this Ubuntu folder so I'm very easily able to access files between the two different systems in fact if I was running for example a nice IDE like visual code I could actually run this here and edit the programs and then switch to this window here to compile or make the program so they have it so basically the windows substantive Linux gives you a bash command line that allows you to run Linux net just for example if you went to select cetera here it really does think it's a Linux system as we look at LSB release it thinks it's a Ubuntu 18.4 you can run commands like PS aux but as you notice it's more kind of like a container than a full system because there's only a few commands running here one other interesting thing though is if we start up another one you can't open multiple windows and it doesn't start another Linux system it's the same one so if we run top in this one to see the difference you can actually see there are two bashes running in here now and there's a CH top and there's top so ones running in here and ones running in here so you multiple windows give you access to the same subsystem it doesn't give you multiple copies of Linux running you're all able to access the same things and in this here we can see exactly the same programs and a door out and all that that was there so you get a kind of window terminal on to that one subsystem okay let me show you now what happens if we install two Linux distributions so let's start to exit out of these things here so we go back to the Microsoft Store and again now we're going to look for Linux okay and actually there's another thing here shows all the ones that are available just the official ones available so I'm going to go for Debian this times we would installed Ubuntu let's now go for Debian and let's install it and see what happens again window is asking me if I want to use my username and password don't at this moment so let that down-low and then we'll see what happens okay so that's installed so let's go down here to the Start menu again and now we can see Debbie Ann and when we click on that up comes a window and just like when we installed Ubuntu there is a final few minutes of installation that needs to happen so we'll just let that finish and as before when you type in a username and password so we'll just type those in now and there we go now we have a bash shell up here for Debbie air now he's it important if I do LS now if I list the fault am I going to see those files that we were using in Ubuntu you know the C files and the files we compiled and the answer is no so when you install a second distro it's like having a second virtual Linux environment okay are like a separate containers so here we can see it's a very simple Linux system running under that windows subsystem okay and the files are not there which means that if we go down here and run Ubuntu okay so we can have two of these open now and here if we do in LS we can see those files so I've got two separate environments now I can still go to if we do a DF - I can still go to the C Drive so if I go to mount C and then users Gary and then we create the directory they remember called Ubuntu and there we have those two files we ran and in fact we can still run a door out and there it is running but this is a different environment so another advantage of this is we could actually install two or three or more different Linux subsystems here and have all of them running now if you actually look if you ask it to tell you about the etc slash OS release it says it's running there beyond here if we do set excetera slash OS release it's saying i'm running ubuntu so that we have to completely return here remember here we have installed GCC in it so it says no file if i type GCC here it says not found so i have to go and do the app installs are completely two separate environments which is a really really cool way or being able to do testing and developing across two environments all with inside the windows subsystem here okay so I said I would mention GUI app so as you saw this is primarily a way of running command-line tools now there is a way of running GUI apps and you do that Union X server actually running on your Windows desktop now if you'll be interested in the video but how to get an X server running and how to connect let's say a Raspberry Pi and have it bring back the interface onto your Windows PC and the same with windows subsystem for Linux then let me know in the comments below and I'll make a video about that also there is now a second version of Windows subsystem for Linux really cleverly named WSL 2 because it's the second version and that actually provides a much more virtualized environment including an actual bona fide Linux kernel now at the moment you can find that in the insider versions of Windows at the time I'm making this video but we're it's available if you are subscribed to that program where we can actually have a look at what that's going to do so again if you'd like a video back WSL to please let me know in the comments below and I'll go ahead and make that other than that my name is Gary Sims this is Gary explained I really hope you enjoyed this video please do give a thumbs up don't forget subscribe don't forget the new speeches G Channel and well I suppose that's it I'll see the next one [Music] [Applause] small furry creatures from Alpha century were a small insider [Applause] [Music] [Applause] [Music] [Applause] [Music] [Applause]
Info
Channel: Gary Explains
Views: 346,904
Rating: undefined out of 5
Keywords: Gary Explains, Tech, Explanation, Tutorial, Windows 10, Windows Subsystem for Linux, WSL, Linux, Ubuntu, Debian, Microsoft
Id: av0UQy6g2FA
Channel Id: undefined
Length: 14min 58sec (898 seconds)
Published: Tue Aug 20 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.