00:00:00
[Music]
00:00:06
hello everybody J here from Jon inspired
00:00:09
hope you guys are doing good so guys I'm
00:00:11
going to be showing today how to set up
00:00:12
a Linux environment on Windows vs code
00:00:16
and um this is actually the setup I use
00:00:17
because it gives me the flexibility of
00:00:19
using both the power of Windows
00:00:21
applications and Linux applications
00:00:24
simultaneously okay without having to
00:00:27
use a virtual machine or a dual boost
00:00:28
prision so it has made my life so much
00:00:31
more easier and I'm hoping it's also
00:00:32
going to make yours too so without
00:00:34
further Ado let's just get
00:00:36
started so for those who this may be new
00:00:39
to let me show you how to download
00:00:40
visual studio code okay so come right
00:00:42
here to your search and type in code
00:00:44
Visual studio.com and hit
00:00:47
enter so it should bring you to a page
00:00:49
like this but before I go on I just want
00:00:51
you guys to know that every link I'll be
00:00:53
using this tutorial I've linked them in
00:00:55
the description below so feel free to
00:00:56
copy and paste them okay so right here
00:00:59
it says download for Windows stable
00:01:01
build um if you're on another operating
00:01:04
system okay you can always click down
00:01:06
this drop down button and then you can
00:01:08
see your operating system right here but
00:01:09
since this video is still made for
00:01:11
Windows I'm just going to click on
00:01:12
download for Windows okay so it should
00:01:14
bring you to this page right here where
00:01:16
it tells you thanks for downloading vs
00:01:18
code for Windows and then if you check
00:01:20
the bottom left of your screen it should
00:01:21
see it's currently downloading okay so
00:01:24
I'm just going to pause my video right
00:01:26
now and I'll get back to you once it's
00:01:27
done so if you're done downloading um
00:01:30
click on the application so we install
00:01:32
it okay and then it brings up the
00:01:35
license agreement so go ahead and read
00:01:37
it if you wish and then click on I
00:01:40
accept the agreement and
00:01:43
next so um I have my um these check
00:01:46
boxes that specifies the kinds of
00:01:48
operations my visual studio code will be
00:01:50
doing so I actually like all the
00:01:52
services that is rendering so I'm going
00:01:54
to check all my checkboxes and click on
00:01:57
next okay and then click on install just
00:02:00
like that so you should have a page like
00:02:03
this that says um click finish to exit
00:02:06
setup so I'm not going to launch Visual
00:02:08
Studio code okay I'm just going to click
00:02:10
on finish and that's
00:02:12
all so next we will need to install
00:02:14
Linux on windows with WSL so WSL stands
00:02:18
for Windows subsystem for Linux and
00:02:20
there are two ways to do this the simple
00:02:21
way and the manual way to do it a simple
00:02:24
way it requires that you have a Windows
00:02:26
11 or a Windows 10 version 2004 and
00:02:29
higher with a build of 19041 and higher
00:02:32
so how do you check the build of your
00:02:34
operating system go ahead and hit the
00:02:36
windows logo key plus r so if I do that
00:02:40
it's going to bring up this dialogue box
00:02:42
and type in w i n v e r just like you
00:02:45
have right here and it'sit okay and then
00:02:47
it tells me right here I have a version
00:02:49
20 H2 with a build of
00:02:52
190421 1526 which is actually higher
00:02:55
than this so it means I can do this the
00:02:57
simple way so let me just show you how
00:02:59
to to do it so all you need to do is
00:03:02
come right here and enter this command
00:03:05
in an administrator power shell or
00:03:07
Windows command prompt and then restart
00:03:09
your machine so this command will enable
00:03:11
the features necessary to run WSL and
00:03:13
just in addition to this it's going to
00:03:15
enable WSL 2 as the version of WSL which
00:03:19
happens to be the latest version of WSL
00:03:21
at the time of this video and it will
00:03:23
install the ubun distribution of Linux
00:03:26
which can actually be changed later okay
00:03:28
so once you're done go ahead restart
00:03:30
your system and that's all so um come
00:03:32
right here to your search by type in
00:03:34
power you should see par shell so once
00:03:36
you see it come right here to run as
00:03:38
administrator so you should see an
00:03:40
interface like this so go ahead and type
00:03:41
in WSL install or just ping the command
00:03:44
hit enter it's going to do a necessary
00:03:46
setup and then once it's done restart
00:03:48
your machine and you're good to go so if
00:03:51
you are able to do this using the
00:03:52
previous step feel free to skip this one
00:03:54
and go to the next frame just in case
00:03:56
you still want to install it manually
00:03:57
the first step will require us to enable
00:03:59
the window subsystem for Linux and to do
00:04:02
that open up the par shell as an
00:04:03
administrator and enter this command so
00:04:07
I've linked this in the description
00:04:08
below so copy it and then come right
00:04:12
here and type in
00:04:14
partial and run as
00:04:17
administrator so you should have an
00:04:19
interface like this so go ahead and
00:04:20
paste that command and hit enter so it
00:04:24
tells me the operation completed
00:04:25
successfully so you should have
00:04:27
something like this so if you have it
00:04:28
let's go over to the Next Step so the
00:04:31
next step is to check the requirements
00:04:32
for running
00:04:33
wsl2 and I just have to mention that
00:04:35
this step is actually optional because
00:04:38
um wsl1 is actually effective in its own
00:04:40
sense but it's advisable that if you
00:04:42
want to get the best experience of Linux
00:04:44
on windows at this time of this video
00:04:46
you update to wsl2 so to run wsl2 you
00:04:51
must be running Windows 11 or Windows 10
00:04:54
and for 64-bit systems on Windows 10 you
00:04:57
must have a version of 1903 or later
00:05:00
with a build of 18362 liter and you can
00:05:03
also see the specifications for m64
00:05:05
systems and to check the version and the
00:05:07
build of your operating system go ahead
00:05:09
and hit the windows logo key and arrow
00:05:12
so just like you have right here and
00:05:14
type in w n v e r okay so I'm just going
00:05:17
to do that and then hit
00:05:19
okay so it shows me right here the
00:05:23
version and then the build of my
00:05:25
operating system so I have 19242 which
00:05:28
happens to be greater than this okay so
00:05:30
I actually pass to run wsl2 on my system
00:05:34
so if that's done the next thing is to
00:05:36
enable the virtual machine feature okay
00:05:38
so to do that go ahead and open up our
00:05:41
shell as an administrator and copy this
00:05:43
command so I've also linked this in the
00:05:45
description below so go ahead and copy
00:05:47
it paste it right here and hit enter so
00:05:52
when it's done you should have the
00:05:54
operation completed successfully just
00:05:56
like this so to complete the
00:05:58
installation we need to restart a
00:05:59
machine right now so go ahead and
00:06:01
restart yours and then we'll continue
00:06:02
with step four when you're back so next
00:06:05
we need to download the Linux Kel update
00:06:07
package so right here I have a link to
00:06:10
the latest package for a 64bit machine
00:06:13
and just in case you're on an m64
00:06:15
machine go ahead and use this link
00:06:17
instead so I have it linked in the
00:06:18
description below okay and if you're not
00:06:20
sure of the kind of machine you have go
00:06:22
ahead and run this Command right here
00:06:25
okay on partial I've also linked this in
00:06:28
the description below and it's going to
00:06:29
show show you the kind of machine you're
00:06:31
running so right now since I'm on a
00:06:32
64bit machine when I run this command it
00:06:35
showed me right here that I'm I have a
00:06:36
64 bit PC okay so I'm just going to
00:06:40
click right here right now so once
00:06:43
you're done downloading it go ahead and
00:06:44
click on it to
00:06:46
install so click on
00:06:48
next and click on
00:06:52
finish next let's go ahead and set wsl2
00:06:55
as our default version so to do that go
00:06:57
ahead and copy this command
00:07:00
and paste it on
00:07:04
partial so it tells you um the operation
00:07:08
completed successfully so next we need
00:07:11
to install a Linux distribution of our
00:07:12
choice so to do that you're going to
00:07:14
open up the Microsoft store so come to
00:07:15
your search bar right here and type in
00:07:18
micro so you should see Microsoft
00:07:19
storees you just open it up so you
00:07:21
should see something like this so I'm
00:07:24
going to search for Ubuntu so I'm just
00:07:25
going to type in
00:07:27
Ubuntu and um at the time of this this
00:07:29
video I think this is the latest version
00:07:31
this um Ubuntu 22.041 LTS I'm just going
00:07:34
to click on this and I'm going to click
00:07:36
on
00:07:39
get so once you're done installing it
00:07:41
you should have this button right here
00:07:42
which says open so go ahead and click on
00:07:44
it to launch it so it tells you right
00:07:47
here unpacking the
00:07:49
D so if I click on this drop down button
00:07:52
right here it says please enable the
00:07:53
virtual machine platform Windows feature
00:07:56
so this has been enabled and ensure
00:07:58
virtualization is enabled in the bios so
00:08:02
um currently I haven't enabled
00:08:03
visualization in the Bios that's why the
00:08:05
installation is not actually completing
00:08:08
so if you haven't also let me just show
00:08:09
you how to rectify this so close up
00:08:12
everything and open up your partial and
00:08:15
type in this
00:08:17
command hit enter so right now we're
00:08:19
trying to confirm the state of our
00:08:21
virtualization so check this guys where
00:08:23
it says hyperv requirements it says
00:08:25
right here virtualization enabled in
00:08:28
firmware no so it means our
00:08:30
visualization is not enabled so now
00:08:32
let's go ahead and enable it so come
00:08:35
right here to your search bar and typ in
00:08:39
recovery and look for this one that says
00:08:41
recovery options with system settings
00:08:43
under it and click on it so you brings
00:08:45
you to this page where it says Advanced
00:08:47
startup and then click on restart
00:08:50
now so once you get right here to this
00:08:53
window comea here to
00:08:56
troubleshoot H
00:08:58
enter come right here to advance
00:09:01
options hit
00:09:03
enter and I'm come right here to ufi
00:09:06
Firmware
00:09:07
settings hit enter so navigate with your
00:09:11
um arrow keys and um click on
00:09:14
restart so next click on um F10 bio
00:09:21
setup next use your right arrow key and
00:09:24
toggle to the configuration
00:09:26
tab just like that and then scroll down
00:09:30
to virtualization technology so if you
00:09:32
get there right now with your down arrow
00:09:34
key you realize that it shows disabled
00:09:37
so go ahead and hit
00:09:39
enter so it gives us the option of
00:09:41
toggling to enable so I'm just going to
00:09:43
hit the down arrow key now I'm going to
00:09:46
hit enter to select
00:09:48
enabled next use your right arrow key
00:09:51
and navigate again to
00:09:53
exit and then it says right here save
00:09:56
changes and exit so because I want to
00:09:58
save my changes and I'm going to hit
00:09:59
enter and I'm also going to hit enter
00:10:02
for yes so if your system has rebooted
00:10:05
go ahead and open up your windows par
00:10:07
shell again and impute this
00:10:12
command so it tells us a hypervisor has
00:10:15
been detected okay so let's go ahead
00:10:18
right now and open up our Ubuntu so once
00:10:21
it's done installing it should open up
00:10:23
this page that allows you select your
00:10:24
language so I'm just going to come down
00:10:26
right here to English okay and I'm going
00:10:29
to hit
00:10:31
enter it's going to ask me my name uh my
00:10:35
username and then the password so I'm
00:10:38
just going to change my username right
00:10:39
now to match the rejects pattern that
00:10:41
it's given to us so I'm going to type in
00:10:44
just inspired you know so just take note
00:10:47
that this field cannot accept you know
00:10:49
capital letters so there are a bunch of
00:10:51
characters that this field cannot accept
00:10:52
so make sure that you comply with the
00:10:54
rejects pattern and then come right here
00:10:56
to choose your password so I'm just
00:10:57
going to type in my password right now
00:11:00
so this page allows you to add more
00:11:01
customization to your UB WSL but I'm
00:11:04
just going to stick with the default so
00:11:05
I'm just going to hit
00:11:07
enter and then it tells me applying
00:11:10
changes so it tells me setup complet all
00:11:13
settings will take effect after next
00:11:16
restart of U so just go ahead and hit
00:11:19
enter and it tells me rebooting
00:11:22
installation
00:11:24
successful and here we are we currently
00:11:28
in our shell program right
00:11:32
here okay guys it's time for some good
00:11:35
stuff so go ahead right here and type in
00:11:37
code just like that so this should open
00:11:39
up visual studio code right here from
00:11:41
your terminal so now you should be
00:11:43
inside Visual Studio code so you can
00:11:45
always set your theme from here I like a
00:11:47
dark theme so I'm just going to click on
00:11:48
next section so I'm also going to click
00:11:51
on next section don't want to change
00:11:55
anything um so you can install git right
00:11:58
here already reading Al so I can do that
00:12:01
install git
00:12:04
and
00:12:06
markor so to hook up vs code to WSL you
00:12:10
need to install this extension so come
00:12:12
right here to this icon okay so if you
00:12:14
it is you say extensions click on it and
00:12:18
then come right here and type in
00:12:20
WSL just like that so once you type this
00:12:24
in you should see this extension right
00:12:26
here from Microsoft okay so go ahead and
00:12:28
click on it so go ahead and install this
00:12:33
extension okay so right now if you have
00:12:36
it installed come right here to your
00:12:37
search bar and type in Ubuntu so you
00:12:39
should see the app which you installed
00:12:41
previously click on
00:12:42
it and then right here let's just go
00:12:44
ahead and create a directory so mkd let
00:12:47
me just call this
00:12:49
example and I'm going to CD into
00:12:52
it right now I'm going to type in Code
00:12:56
full stop okay full stop stands for the
00:12:58
present working directory I'm going to
00:12:59
hit
00:13:02
enter so you should have a page like
00:13:04
this that asks if you trust the authors
00:13:05
of this file and all that so I'm just
00:13:08
going to click trust the authors of all
00:13:10
files in parent folder just inspired I'm
00:13:13
going to click yes I trust the authors
00:13:16
so we are currently in vs code but this
00:13:18
environment which you see currently is
00:13:20
running in ubun 22 2.04 wsl2 which you
00:13:23
can see right here and this has a
00:13:25
variety of implications one of them
00:13:27
being that we can access the Linux
00:13:29
system directly from our vs code GUI and
00:13:33
then we can open up a Linux based
00:13:34
terminal right here inside vs code so to
00:13:37
show what I mean come right here to the
00:13:38
terminal tab click on it click on new
00:13:41
terminal so as you can see right here
00:13:43
this opens up a Linux based terminal
00:13:45
with bash running on it so if you check
00:13:47
right here it says bash which you can
00:13:48
see let's go ahead right now and open up
00:13:51
a file so I'm just going to call this
00:13:52
demo so click on this icon which says
00:13:54
new file and let's just call this demo
00:13:57
okay
00:13:59
and right now I
00:14:01
can specify my shebang and the part of
00:14:05
my bash interpreter okay and then let me
00:14:07
just type in a simple command like Hello
00:14:10
World save this next let's go ahead and
00:14:15
make our script executable okay and
00:14:18
let's run it so as you can see right
00:14:20
here I have Hello World printed out to
00:14:21
my standard output so guys this is how
00:14:24
to set up a Linux environment on Windows
00:14:27
vs code with wsl2 um there's a bunch of
00:14:30
settings and extensions you need to
00:14:31
implement to optimize your experience in
00:14:34
various programming languages but I
00:14:35
think this is a good place to just get
00:14:37
started all right so if you enjoy this
00:14:39
video feel free to give it a like
00:14:41
subscribe if you're new here okay and
00:14:43
that's it from me for now I'll see you
00:14:45
in the next one