WEBVTT

00:06.320 --> 00:12.690
We can manage vagrant boxes using the vagrant box sub commands.

00:12.710 --> 00:20.560
Let's run that with the help flag by typing dash dash help and see what sub commands are available.

00:20.570 --> 00:22.740
So let's type vagrant box.

00:22.760 --> 00:23.720
Dash, dash.

00:23.720 --> 00:24.440
Help.

00:24.440 --> 00:26.380
And we get this output.

00:26.390 --> 00:31.840
As you can see with this version of Vagrant, I've got seven sub commands.

00:31.850 --> 00:36.170
The available sub commands are at least outdated.

00:36.170 --> 00:39.920
Prune, remove, repackage and update.

00:39.920 --> 00:48.080
With each of these commands we can provide the dash dash help flag to see what additional arguments

00:48.080 --> 00:49.150
are available.

00:49.160 --> 00:51.520
Now let's review this in detail.

00:51.530 --> 00:54.350
Let's start with list in vagrant boxes.

00:54.350 --> 01:02.330
The list sub command will be list in the boxes installed within vagrant along with the provider that

01:02.330 --> 01:03.620
backs the box.

01:03.620 --> 01:11.150
So let's type vagrant box list and the output will show all the boxes available within vagrant.

01:11.150 --> 01:15.050
We can remove the box with the remove sub command.

01:15.050 --> 01:19.760
We need to provide the name of the box and the provider that backs it.

01:19.760 --> 01:26.630
For example Vagrant box remove hashicorp slash precise 64.

01:26.660 --> 01:30.890
You could also add the provider for example virtual box.

01:30.890 --> 01:32.540
So let's see it in action.

01:32.540 --> 01:41.900
I'll type vagrant box remove hashicorp slash precise 64 and the output will be the message that the

01:41.900 --> 01:46.600
vagrant is removing box with provider virtual box.

01:46.610 --> 01:52.610
Now let's power up the virtual machine using the Vagrant app command.

01:52.610 --> 01:59.930
If the environment was not previously suspended, Vagrant then checks to see if the base box has already

01:59.930 --> 02:02.840
been downloaded onto the machine.

02:02.840 --> 02:05.810
If it hasn't, it will download it.

02:05.810 --> 02:08.690
Vagrant will then perform the following.

02:08.720 --> 02:10.460
Copy the base box.

02:10.460 --> 02:14.720
Create a new virtual machine with the relevant provider.

02:14.720 --> 02:18.470
Remember that the default being virtual box.

02:18.470 --> 02:23.120
Then it will forward any configured ports by default.

02:23.120 --> 02:32.720
It'll forward port 22, which is SSH on the VM to port 2222 on the host.

02:32.720 --> 02:41.480
This will allow us to connect to to the VM, then it will boot or power up the VM and configure and

02:41.480 --> 02:46.130
enable networking so that we can communicate with the VMM.

02:46.130 --> 02:51.440
Then Vagrant will map shared folders between the host and the guest.

02:51.440 --> 03:00.440
By default it will map the folder containing the vagrant project to slash vagrant on the guest machine,

03:00.440 --> 03:09.650
and after that it will run any provisioning tools that are set up such as Puppet and Ansible share for

03:09.830 --> 03:12.350
SSH SSH provisioning.

03:12.380 --> 03:18.710
After powering up the virtual machine, the output will look something like mine.

03:18.710 --> 03:27.170
As you can see, lots of informational messages from Vagrant like search the name of the VM Forward

03:27.170 --> 03:30.680
and ports button, VM and so on.
