1
00:00:03,250 --> 00:00:08,440
At this point you should have vagrant and virtual box installed on your operating system.

2
00:00:08,440 --> 00:00:14,410
The next steps that we're going to do include adding a box a vagrant setting up a vagrant project and

3
00:00:14,410 --> 00:00:17,530
bringing up those boxes logging into them and so on.

4
00:00:17,710 --> 00:00:21,840
So the first thing we need to do is start a command line session.

5
00:00:21,850 --> 00:00:25,570
Now if you're a Windows user what you need to do is start the command prompt.

6
00:00:25,660 --> 00:00:31,750
Click on the Start button and in the search box type the words command prompt and then in a list of

7
00:00:31,750 --> 00:00:37,630
results just double click on the command prompt and that will start your command line session for you.

8
00:00:37,630 --> 00:00:44,440
For you Mac users start the Terminal application which is located in the slash applications slash Utilities

9
00:00:44,440 --> 00:00:50,010
folder for Linux users go ahead and start your favorite terminal emulator probably using the menu system

10
00:00:50,020 --> 00:00:51,250
in your distribution.

11
00:00:51,250 --> 00:00:56,340
Examples include gnome terminal console and xterm as you can see here.

12
00:00:56,340 --> 00:01:02,710
I'm working on a Mac but the commands we're going to run work on Windows Linux or Mac so no matter what

13
00:01:02,710 --> 00:01:06,230
operating system you're on you can follow these exact commands.

14
00:01:06,550 --> 00:01:10,600
So now that we have a command line session open we're ready to add a box to vagrant.

15
00:01:10,750 --> 00:01:16,960
And as you probably remember from a previous lesson a box and vagrant speak is an operating system image.

16
00:01:17,080 --> 00:01:22,230
And the vagrant box add command will download and store that box on your local system.

17
00:01:22,240 --> 00:01:27,370
You only need to download a box once as this image will be cloned when you create a new virtual machine

18
00:01:27,370 --> 00:01:30,340
with vagrant using that box's name.

19
00:01:30,340 --> 00:01:35,710
I created a box specifically for this class and uploaded it to the public vagrant box catalogue.

20
00:01:35,890 --> 00:01:38,890
Run the following command on your local machine to download it.

21
00:01:38,890 --> 00:01:47,010
That command is vagrant box at Jason C. forward slashes Santos 7.

22
00:01:47,200 --> 00:01:52,160
By the way I always follow the instructions in the project or exercise documentation because sometimes

23
00:01:52,150 --> 00:01:55,930
that these links change but I'll try to stay as close to that as possible.

24
00:01:55,930 --> 00:02:00,820
But again if you see something slightly different on your screen just know that the document that you're

25
00:02:00,820 --> 00:02:04,130
following is the source of truth.

26
00:02:04,210 --> 00:02:07,080
So I hit enter and the box will start to download.

27
00:02:19,430 --> 00:02:23,830
OK the box has successfully been added to our local system.

28
00:02:24,050 --> 00:02:29,590
So our next step is to create a folder or directory to keep all of our course work in.

29
00:02:29,900 --> 00:02:34,760
And I just want to point out really quickly that when you open the command prompt on Windows or the

30
00:02:34,760 --> 00:02:39,280
terminal on Mac or Linux typically you're placed into your home directory.

31
00:02:39,440 --> 00:02:45,110
For example if I'm logged into a Windows system as Jason my home directory could be something like C

32
00:02:45,140 --> 00:02:48,310
colon backslash users backslash Jason.

33
00:02:48,440 --> 00:02:52,280
Now this might vary depending on what version of Windows you're using but it's going to be something

34
00:02:52,280 --> 00:02:53,250
very similar.

35
00:02:53,440 --> 00:02:56,300
I'm logged into a Mac system as I am here.

36
00:02:56,390 --> 00:02:59,950
My home directory will be forward slash users forward slash.

37
00:02:59,950 --> 00:03:05,530
Jason if I'm logged into a Linux system as Jason my home directory is going to be for Slash home Ford

38
00:03:05,550 --> 00:03:06,820
slash Jason.

39
00:03:07,130 --> 00:03:11,900
So this just gives you an idea of where you're at on the system so you know where to find the files

40
00:03:11,900 --> 00:03:15,020
that you're about to create and work with during this course.

41
00:03:15,260 --> 00:03:20,030
So again like I said we're going to create a folder or a directory to keep our coursework in we're going

42
00:03:20,030 --> 00:03:28,840
to name that folder show class and what we're going to do now is type make der Shao class that command

43
00:03:28,840 --> 00:03:31,870
works on Windows Mac and Linux so we're good here.

44
00:03:32,080 --> 00:03:36,960
So next we want to move into that folder we just created a well run CD which stands for change directory

45
00:03:37,860 --> 00:03:45,550
show class vagrant has this concept of projects and a vagrant project must consist of a folder and a

46
00:03:45,550 --> 00:03:50,070
vagrant configuration file called a vagrant file that's placed in that folder.

47
00:03:50,080 --> 00:03:56,830
So let's start out by creating a test box oh one folder.

48
00:03:56,970 --> 00:04:03,940
Next we'll move into that folder with CD and now to create the vagrant configuration file you'll want

49
00:04:03,940 --> 00:04:12,990
to run the vagrant init command followed by the box name so run vagrant and that Jason see forge slash

50
00:04:13,050 --> 00:04:16,050
Cintas 7 and press enter.

51
00:04:16,440 --> 00:04:22,200
The first time you run the vagrant up command vagrant will import or clone the vagrant box into virtual

52
00:04:22,200 --> 00:04:23,700
box and then start it.

53
00:04:23,850 --> 00:04:28,950
If vagrant detects that the virtual machine already exists in virtual box it will just go ahead and

54
00:04:28,950 --> 00:04:30,800
simply start it by default.

55
00:04:30,810 --> 00:04:36,060
When the virtual machine is started it is started in headless mode meaning that there is no user interface

56
00:04:36,060 --> 00:04:39,540
for the machine visible on your local host machine.

57
00:04:39,560 --> 00:04:43,770
It will be running in the background but you won't necessarily see anything change.

58
00:04:44,070 --> 00:04:56,650
Let's bring up your first Linux virtual machine with vagrant by running vagrant up pressing enter.

59
00:04:56,670 --> 00:05:01,610
I want to point out a couple of common issues that some people run into when they run the vagrant up

60
00:05:01,620 --> 00:05:02,530
command.

61
00:05:02,580 --> 00:05:07,980
Sometimes I've seen some issues where someone has accidentally mis type the box name when they did the

62
00:05:07,980 --> 00:05:09,200
vagrant init.

63
00:05:09,360 --> 00:05:14,760
That can lead to an error that states that the box couldn't be found and so vagrant will not be able

64
00:05:14,760 --> 00:05:16,830
to clone that box and so on.

65
00:05:16,830 --> 00:05:17,880
So that's a common issue.

66
00:05:17,880 --> 00:05:24,180
So make sure with your vagrant a command you spelled everything correctly and I'm going to show you

67
00:05:24,180 --> 00:05:25,340
in a second how to fix that.

68
00:05:25,350 --> 00:05:26,430
If you didn't.

69
00:05:26,430 --> 00:05:31,950
Another issue that you may run into when running vagrant up is that you'll get an error reporting something

70
00:05:31,950 --> 00:05:34,770
about timed out while waiting for the machine to boot.

71
00:05:34,780 --> 00:05:37,060
It could be a couple of different reasons for this.

72
00:05:37,110 --> 00:05:42,960
The most likely reason is that the virtual machine started without its network interface enabled.

73
00:05:42,960 --> 00:05:47,820
I've mainly seen this on older Windows systems I'm not sure what it is about the host operating system

74
00:05:48,120 --> 00:05:54,300
that sometimes doesn't enable the virtual network interface to be enabled on start but you can quickly

75
00:05:54,300 --> 00:06:00,240
fix this by editing the vagrant file and adding a block of text that I'll provide in the exercise notes.

76
00:06:00,260 --> 00:06:06,120
And with that block a configuration does is it just forces the cable to be plugged in and that virtual

77
00:06:06,120 --> 00:06:08,360
network device to be turned on.

78
00:06:08,370 --> 00:06:15,090
A third possibility is that VTX or the virtualization settings for your C.P you are not enabled on the

79
00:06:15,090 --> 00:06:16,140
host computer.

80
00:06:16,140 --> 00:06:20,940
And then what you need to do in that case is to go into the BIOS and enable those through your computer

81
00:06:21,000 --> 00:06:23,710
restart and then try again.

82
00:06:23,730 --> 00:06:28,670
By the way there was a trouble shooting video specifically on these issues that goes into more detail.

83
00:06:28,710 --> 00:06:32,540
So if you're still having problems go ahead and skip forward to the trouble shooting video.

84
00:06:32,580 --> 00:06:33,240
Watch that.

85
00:06:33,240 --> 00:06:39,220
Fix your problem and then come back to this exercise so quickly how we're going to fix these issues

86
00:06:39,220 --> 00:06:44,590
or how we're actually going to provide further configuration is to edit the vagrant file to do that

87
00:06:44,590 --> 00:06:49,420
you want to open it with your favorite text editor and I'm saying text editor for a reason do not use

88
00:06:49,420 --> 00:06:55,710
a word processor do not use Microsoft Word Libris Office Writer do not use Apple pages.

89
00:06:55,720 --> 00:06:56,950
Use a text editor.

90
00:06:56,950 --> 00:07:03,810
One text editor that I recommend a lot is Adam spelled 80 O M and it's available at Adam dot I O O M

91
00:07:04,100 --> 00:07:11,290
IO and it works on windows of Mac and Linux so I'm going to go ahead and open up my Adam text editor

92
00:07:11,590 --> 00:07:13,480
and edit the vagrant file here.

93
00:07:19,290 --> 00:07:21,870
Now you can open up the vagrant file with your text editor

94
00:07:25,640 --> 00:07:32,140
to go to my home directory then find shelf class and then test the box one.

95
00:07:32,550 --> 00:07:34,950
And finally open the vagrant file.

96
00:07:34,980 --> 00:07:39,840
So this is where it becomes important to know where your home directory is where you created your shell

97
00:07:39,840 --> 00:07:45,210
class folder and where what project you're working on and obviously where the vagrant file list.

98
00:07:45,240 --> 00:07:49,150
So once you've located the file you can open it with your favorite text editor.

99
00:07:49,190 --> 00:07:54,380
So if you did run vagrant a net with the incorrect box name you can come down to the config that the

100
00:07:54,400 --> 00:07:57,200
box line and make your changes needed.

101
00:07:57,200 --> 00:08:02,960
For example I've seen some people do this Jason Ford slash sento seven or some other variation like

102
00:08:02,960 --> 00:08:04,790
that and then you can fix it here.

103
00:08:04,790 --> 00:08:09,220
Save your vagrant file and then run vagrant up again and you should be good to go.

104
00:08:10,180 --> 00:08:15,230
Let's confirm that our first virtual machine is running by starting the virtual box application.

105
00:08:15,370 --> 00:08:21,220
On Windows you can double click on the Oracle VM virtual box icon on your desktop for Mac users you

106
00:08:21,220 --> 00:08:26,800
can start the applications virtual box application and Linux users will just need to find the application

107
00:08:26,800 --> 00:08:28,470
in their menu system.

108
00:08:28,930 --> 00:08:34,360
Now you can confirm that you see a virtual machine running and it will start with the name of your vagrant

109
00:08:34,360 --> 00:08:35,260
project folder.

110
00:08:35,320 --> 00:08:39,830
So you here you can see that it starts with test to box 0 1.

111
00:08:39,850 --> 00:08:41,510
Let's get back to the terminal real quick.

112
00:08:43,480 --> 00:08:49,240
You can also use the vagrant status command to check the status of the virtual machine and you can confirm

113
00:08:49,240 --> 00:08:54,490
that it shows that the virtual machine is in a running state by running vagrant status.

114
00:08:56,200 --> 00:09:00,610
The vagrant status command confirmed that the machine is running just like we saw it running inside

115
00:09:00,610 --> 00:09:03,160
the virtual box application as well.

116
00:09:03,190 --> 00:09:09,400
Now that we have a box up let's connect to it with S-sh as it's aitches called secure shell and it's

117
00:09:09,400 --> 00:09:12,650
the network protocol used to connect to Linux systems.

118
00:09:12,640 --> 00:09:19,890
Vigor provides a nice shortcut to S-sh into the virtual machine and that shortcut is vagrant S-sh.

119
00:09:19,940 --> 00:09:24,420
Now you are connected to the Linux virtual machine as the vagrant user.

120
00:09:24,440 --> 00:09:29,390
This default vagrant account is used to connect to the Linux system for your convenience the vagrant

121
00:09:29,390 --> 00:09:35,780
application takes care of the details that allow you to connect to the box over S-sh without a password.

122
00:09:36,110 --> 00:09:39,910
For reference the password for the vagrant account is vagrant.

123
00:09:39,950 --> 00:09:42,500
The password for the root account is also vagrant.

124
00:09:42,500 --> 00:09:49,940
That's a V A G R A N T the vagrant user has full sudo or administrative privileges and then allows you

125
00:09:49,940 --> 00:09:52,710
to further configure the system if you want to.

126
00:09:52,850 --> 00:09:57,850
Of course we'll be dealing more with accounts and privileges ensue later in this course.

127
00:09:57,860 --> 00:10:03,890
Now let's exit the virtual machine by typing the exit command and now we're log out of the Linux virtual

128
00:10:03,890 --> 00:10:07,520
machine and back to our host operating system.

129
00:10:07,520 --> 00:10:12,650
The vagrant Hok command shuts down the virtual machine when you run this command you will not lose any

130
00:10:12,650 --> 00:10:17,920
work you performed inside the virtual machine the virtual machine will still exist in virtual box it

131
00:10:17,930 --> 00:10:19,420
will just simply be stopped.

132
00:10:19,430 --> 00:10:20,580
So lets do that now.

133
00:10:24,270 --> 00:10:25,670
OK the machines should be halted.

134
00:10:25,680 --> 00:10:27,910
Let's look at it in the virtual box application.

135
00:10:29,120 --> 00:10:34,580
You can see that the virtual machine still exists in virtual box but it's just simply powered off.

136
00:10:34,580 --> 00:10:37,040
You might have noticed only logged into the Linux system.

137
00:10:37,040 --> 00:10:43,790
We had a prompt that read vagrant app local host local host is the name of the virtual machine inside

138
00:10:43,790 --> 00:10:44,960
the virtual machine itself.

139
00:10:44,960 --> 00:10:48,350
It's what Linux thinks its name is.

140
00:10:48,350 --> 00:10:53,060
We can have vagrant configured that name for us and to do that we need to put that configuration in

141
00:10:53,060 --> 00:10:54,100
the vagrant file.

142
00:10:54,260 --> 00:10:59,600
So open up your favorite text editor navigate to the location of the vagrant file and then load that

143
00:10:59,600 --> 00:11:02,330
file up and we're going to put a line of configuration in there.

144
00:11:02,450 --> 00:11:08,810
So the configuration in the vagrant file really starts at this vagrant configure line and it goes all

145
00:11:08,810 --> 00:11:12,780
the way down to the bottom of the file here at the end keyword.

146
00:11:12,800 --> 00:11:19,070
What we're going to do is start placing our configuration right after this config that VM box line to

147
00:11:19,070 --> 00:11:26,060
set the hostname we can type config VM dot hostname equals and then specify the name.

148
00:11:26,060 --> 00:11:29,230
So we're going to call this box test box.

149
00:11:29,250 --> 00:11:34,370
So we want it now and we need to do is save it to go to file and save.

150
00:11:34,550 --> 00:11:36,360
And let's return to the command prompt.

151
00:11:37,160 --> 00:11:43,340
At this point you could run vagrant halt followed by vagrant up to activate this change however vagrant

152
00:11:43,340 --> 00:11:49,670
provides a shortcut vagrant reload which restarts the virtual machine load the new vigorish configuration

153
00:11:49,910 --> 00:11:51,620
and starts the virtual machine again.

154
00:11:51,620 --> 00:11:53,190
So let's give that a go here

155
00:12:03,100 --> 00:12:03,460
OK.

156
00:12:03,470 --> 00:12:07,560
Let's connect to the virtual machine and see if the hostname is changed or run vagrant.

157
00:12:07,660 --> 00:12:12,010
S-sh.

158
00:12:12,160 --> 00:12:17,910
Now you can see the prompt reads vagrant at test the box so once our configuration worked.

159
00:12:18,250 --> 00:12:23,470
Let's go ahead and exit out of this virtual machine with exit that will log out and places back on our

160
00:12:23,470 --> 00:12:25,140
host system.

161
00:12:25,150 --> 00:12:27,530
Let's move back over to the vagrant file.

162
00:12:27,850 --> 00:12:31,750
During this course you're going to create virtual machines that will be able to communicate with each

163
00:12:31,750 --> 00:12:35,500
other as well as your local desktop or laptop.

164
00:12:35,500 --> 00:12:42,190
Let's give this virtual machine the IP address of ten nine dot 8.7 and to do that what we need to do

165
00:12:42,190 --> 00:12:45,560
is insert some configuration into the vagrant file.

166
00:12:45,610 --> 00:12:49,180
So continuing here I'll just started on the next line will do config.

167
00:12:49,420 --> 00:12:56,370
VM network space a quotation mark private underscore network.

168
00:12:57,040 --> 00:13:05,380
And then after the closing quotation mark we need a comma space I.P a colon space Leweni quotation marks

169
00:13:05,380 --> 00:13:16,030
ten nine eight seven and then we'll go ahead and save our file a common issue I see people have here

170
00:13:16,240 --> 00:13:19,240
is that they simply do something like leave out this comma.

171
00:13:19,660 --> 00:13:25,270
So again make sure that you're following the syntax and what's in the project instructions.

172
00:13:25,270 --> 00:13:30,370
Now let's move back to our command line section and make vagrant reload that configuration so we'll

173
00:13:30,370 --> 00:13:32,490
do vagrant reload.

174
00:13:32,740 --> 00:13:37,180
Since the virtual machine was running it will go ahead and stop it and then restart it with the new

175
00:13:37,180 --> 00:13:38,290
vagrant configuration

176
00:13:43,710 --> 00:13:45,230
OK our machine is reloaded.

177
00:13:45,230 --> 00:13:48,810
Let's test the network connectivity with the ping command.

178
00:13:48,880 --> 00:13:51,730
If you're on Windows you can just typing in the IP address.

179
00:13:51,820 --> 00:13:55,160
If you a Mac or Linux you're going to specify a count with that.

180
00:13:55,180 --> 00:13:56,070
So we'll just do that.

181
00:13:56,080 --> 00:14:03,930
See three dozen three packets and we'll do 10 9 8 7 which is the IP address we assign the virtual machine

182
00:14:03,940 --> 00:14:05,560
let's hit enter and see what happens.

183
00:14:08,290 --> 00:14:13,200
We were able to successfully ping the virtual machine as we had no packet loss.

184
00:14:13,210 --> 00:14:17,280
Now the ping command is just one simple way to test network connectivity.

185
00:14:17,410 --> 00:14:22,360
So if you see replies and you can just safely assume the IP addresses reachable and that the host is

186
00:14:22,360 --> 00:14:27,340
up if you see timeout messages then the system is not answering your ping requests.

187
00:14:27,340 --> 00:14:30,840
In the real world this doesn't necessarily mean the system is down.

188
00:14:30,850 --> 00:14:35,610
It just means it's not answering your ping requests which could be for a variety of reasons.

189
00:14:35,620 --> 00:14:40,810
However for our purposes here if you get a timeout message then you can safely assume that this system

190
00:14:40,810 --> 00:14:43,700
is down or there's something wrong with the configuration.

191
00:14:43,720 --> 00:14:50,050
The first thing to try is just simply reboot the VM by running vagrant reload if the ping command fails

192
00:14:50,050 --> 00:14:50,460
again.

193
00:14:50,470 --> 00:14:56,160
Double check the contents of the vagrant file and pay very special close attention to the config that

194
00:14:56,360 --> 00:14:57,940
the network line.

195
00:14:57,970 --> 00:15:03,070
If you've made a typing mistake no big deal just fix your changes save the vagrant file restart the

196
00:15:03,070 --> 00:15:05,100
virtual machine and try again.

197
00:15:05,560 --> 00:15:10,870
The final step is to reboot the host operating system or your physical computer come back and try it

198
00:15:10,870 --> 00:15:11,670
again.

199
00:15:11,980 --> 00:15:16,630
If you're done with the virtual machine or you want to start over with a fresh copy of the virtual machine

200
00:15:16,870 --> 00:15:18,320
run vagrant destroy.

201
00:15:18,340 --> 00:15:19,250
Well do that now.

202
00:15:23,400 --> 00:15:27,630
It'll prompt you to confirm that you actually want to delete the machine and will just say why for yes

203
00:15:27,630 --> 00:15:32,080
and hit enter.

204
00:15:32,110 --> 00:15:37,360
Now if we look back in the virtual box application that machine is gone it's been destroyed it's been

205
00:15:37,420 --> 00:15:38,160
removed.

206
00:15:38,260 --> 00:15:40,210
It's like it never existed.

207
00:15:40,210 --> 00:15:46,180
So if we had any work that was saved inside to the local disk that work is gone because we totally destroyed

208
00:15:46,180 --> 00:15:47,500
that virtual machine.

209
00:15:47,500 --> 00:15:53,200
So when you run into story be sure that you're done with the contents inside of that virtual machine.

210
00:15:53,530 --> 00:15:59,170
Let's create another vagrant project but this time let's define multiple virtual machines in that one

211
00:15:59,170 --> 00:16:00,550
project.

212
00:16:00,550 --> 00:16:06,100
First let's return to our shell class directory and the easiest way to do that is CD space.

213
00:16:06,130 --> 00:16:06,550
Period.

214
00:16:06,550 --> 00:16:07,200
Period.

215
00:16:07,360 --> 00:16:08,630
And press enter.

216
00:16:08,770 --> 00:16:14,120
That command changes to the parent directory which is represented by dot dot or period period.

217
00:16:14,230 --> 00:16:20,290
By the way dot represents this directory dot dot represents the parent directory or the directory above

218
00:16:20,290 --> 00:16:22,600
your current location in the file system.

219
00:16:22,600 --> 00:16:26,770
Now let's go ahead and create a vagrant project folder and change into that folder.

220
00:16:26,800 --> 00:16:32,080
Will do that with make sure multi test and will change into that directory.

221
00:16:32,140 --> 00:16:39,240
CD multi test and the next step is to initialize the vagrant project which creates our vagrant file

222
00:16:39,620 --> 00:16:41,390
vagrant and knit Jason.

223
00:16:41,520 --> 00:16:45,700
Jason see Ford slash Sentosa 7 and press enter.

224
00:16:45,780 --> 00:16:49,510
Now open up the vagrant file with your favorite text editor.

225
00:16:49,530 --> 00:16:55,230
Now what we want to do is to define two virtual machines.

226
00:16:55,240 --> 00:17:02,690
Let's give the first one the name of test one and give it an IP address of 10 that nind at a dot five.

227
00:17:03,010 --> 00:17:08,500
And so we're going to do is leave any of the common configuration amongst all the machines that we're

228
00:17:08,500 --> 00:17:10,890
creating at the top of the file.

229
00:17:10,900 --> 00:17:16,030
So the box we're going to use for each of our virtual machines is going to be this box we just leave

230
00:17:16,030 --> 00:17:20,440
that there and it will apply to all the virtual machines that we create.

231
00:17:20,440 --> 00:17:26,700
So how we create a virtual machine instance here is config dot VM define.

232
00:17:27,010 --> 00:17:31,180
And then what we're going to do is place the virtual machine name in quotation marks.

233
00:17:31,180 --> 00:17:34,250
So we'll call this test one next.

234
00:17:34,270 --> 00:17:37,650
We need the word do fall by the pipe.

235
00:17:37,780 --> 00:17:39,610
And then again the name of the virtual machine.

236
00:17:39,610 --> 00:17:44,420
Test one followed by closing pite.

237
00:17:44,470 --> 00:17:47,330
Now we use the name of that machine to perform our configuration.

238
00:17:47,340 --> 00:17:54,300
So Will do test one that VM hostname and we'll give it a hostname of test 1.

239
00:17:54,700 --> 00:18:01,050
We also want to configure the network on this one so we'll do test one dot VM dot net work

240
00:18:04,600 --> 00:18:09,770
private network.

241
00:18:09,970 --> 00:18:15,500
We're going to give it an IP address of 10 9 8 and 5.

242
00:18:15,570 --> 00:18:22,010
Now we can in this block of code with end and that is our first virtual machine definition.

243
00:18:22,170 --> 00:18:24,690
Let's go ahead and configure the second virtual machine.

244
00:18:24,690 --> 00:18:25,960
Very similar process.

245
00:18:28,890 --> 00:18:30,190
To test to

246
00:18:36,630 --> 00:18:38,130
the host name to test to

247
00:18:48,890 --> 00:18:56,270
will give us an IP address of 10 that Nonda 8.6 and we'll end with it and key word for that block of

248
00:18:56,270 --> 00:18:59,990
code which configures the test to virtual machine.

249
00:18:59,990 --> 00:19:06,310
Now we just save our changes know what started the virtual machines up by going back to our command

250
00:19:06,310 --> 00:19:13,420
line section and running vagrant up by the way if you only wanted to bring one of the systems up then

251
00:19:13,420 --> 00:19:15,690
you would specify it after having grown up.

252
00:19:15,700 --> 00:19:21,610
For example if you only wanted to bring up the test two system you would run vagrant tests too.

253
00:19:21,820 --> 00:19:27,580
But if you don't specify a system or virtual machine vagrant up will bring up every machine that is

254
00:19:27,580 --> 00:19:29,100
defined in the vagrant file.

255
00:19:41,010 --> 00:19:44,260
Ok big run has brought up both of the virtual machines that we defined.

256
00:19:44,270 --> 00:19:49,050
Now let's check the status with vagrant status OK.

257
00:19:49,050 --> 00:19:54,420
It says both of them are running tests one is running in Virtual Box test 2 is also running in virtual

258
00:19:54,420 --> 00:19:55,830
box.

259
00:19:55,840 --> 00:20:00,010
Let's go ahead and connect to the test to one virtual machine to confirm that it's working correctly

260
00:20:00,010 --> 00:20:02,290
and then we'll just quickly log out of it.

261
00:20:02,530 --> 00:20:09,700
We'll use vagrant S-sh and this time we have to specify a name of a virtual machine because we've defined

262
00:20:09,730 --> 00:20:12,450
more than one virtual machines in our configuration.

263
00:20:12,520 --> 00:20:16,960
So vagrant won't be able to tell which box we're trying to connect to unless we give it a name that

264
00:20:16,990 --> 00:20:21,630
will give a name of the VM here which is Test 1 and hit enter.

265
00:20:21,670 --> 00:20:27,130
If you look at the prompters vagrant at Test 1 so that's the correct TOSed we're on that looks OK we

266
00:20:27,130 --> 00:20:27,730
can get in it.

267
00:20:27,730 --> 00:20:30,900
Now let's log out of the system with exit.

268
00:20:31,210 --> 00:20:38,010
Let's do the same thing with the test 2 system so we'll do vagrant S-sh test 2.

269
00:20:38,050 --> 00:20:42,760
Again notice the prompt it reads vagrant at Test 2 so that's another confirmation that we're connected

270
00:20:42,760 --> 00:20:44,710
to the test to VM.

271
00:20:44,770 --> 00:20:50,410
Now while you're logged into the test to VM Let's see if we can ping the test one VM to prove that the

272
00:20:50,410 --> 00:20:53,770
two virtual machines can communicate with each other over the network.

273
00:20:53,950 --> 00:21:01,600
So we can do this with ping to see three ten nine eight dot five which is the IP address of the test

274
00:21:01,600 --> 00:21:05,050
one system and hit enter OK.

275
00:21:05,140 --> 00:21:08,380
No packet loss we can connect to the test one system over the network.

276
00:21:08,500 --> 00:21:09,850
So that looks good.

277
00:21:10,730 --> 00:21:15,890
While were connected to this VM I want to show you one more thing you might have noticed some messages

278
00:21:16,220 --> 00:21:20,640
about mounting shared folders when the vagrant up command was executed.

279
00:21:20,870 --> 00:21:26,810
Well you can access the files in the vagrant project directory that resides on your local machine inside

280
00:21:26,810 --> 00:21:28,080
the virtual machine.

281
00:21:28,250 --> 00:21:33,710
The vagrant project directory is mounted or shared via the forward slash vagrant directory the only

282
00:21:33,710 --> 00:21:38,740
fallen or local directory is the vagrant file and you can look at that file from within the VM.

283
00:21:39,020 --> 00:21:47,120
So let's run the following commands inside the test to VM will run LS for flash a vagrant and you can

284
00:21:47,120 --> 00:21:49,640
see that there is a vagrant file there.

285
00:21:49,720 --> 00:21:52,590
And let's look at the contents of that file with a cat command.

286
00:21:52,600 --> 00:21:57,030
Or do cat vagrant vagrant file and press enter.

287
00:21:57,900 --> 00:22:03,150
OK so now you can see how you can access files that reside on your local machine while you're logged

288
00:22:03,390 --> 00:22:05,460
into the virtual machine.

289
00:22:05,460 --> 00:22:10,170
This is also a convenient way to get files inside the virtual machine without having to do SEPs and

290
00:22:10,170 --> 00:22:11,480
those types of things.

291
00:22:11,790 --> 00:22:16,020
OK we're done for today so let's go ahead and exit out of this VM.

292
00:22:16,020 --> 00:22:20,730
By the way in the upcoming project she'll be working a lot more with vagrant virtual machines and IP

293
00:22:20,730 --> 00:22:22,020
addresses and so on.

294
00:22:22,200 --> 00:22:27,450
So feel free to explore the Linux system if you'd like or keep playing around with virtual box when

295
00:22:27,450 --> 00:22:29,320
you're ready to stop or take a break.

296
00:22:29,340 --> 00:22:33,540
Halt the virtual machine or virtual machines that you're working with and then remember that you can

297
00:22:33,540 --> 00:22:35,250
always pick up where you left off.

298
00:22:35,370 --> 00:22:38,250
As long as you don't destroy the virtual machine.

299
00:22:38,250 --> 00:22:43,610
Since I'm done I'm just going to halt these virtual machines with a vagrant halt command.

300
00:22:43,860 --> 00:22:48,870
Again remember if you only want to operate on one of the virtual machines specify that virtual machine

301
00:22:48,870 --> 00:22:50,660
name at the end of the vagrant command.
