Setup Vagrant
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
I welcome back to module three. This is less than 3.4 set up a vagrant. And this. Listen, we're going to set up our vag to quickly deploy a my sequel development environment and and a boon to Lennox
00:13
operating system.
00:15
So there are a couple of key things we need to keep track of during this lesson. One is my sequel uses Port 33 06 So we will need to make sure that Port 33 06 is being Florida to our vagrant box. Otherwise we won't be able to connect to my sequel,
00:32
and that will just pretty much ruin the rest of our development. So we're gonna make sure we avoid that
00:37
so you can see that I've noted that is critical to connecting to my sequel.
00:42
We're also going to supply a deployment script. Now, this is where some of that bag Grint Magic comes into play.
00:49
Baghran is going to run this script against the host during the provisioned process so that host script is actually going to update and its stall my sequel for us
01:00
Now, the provisioned command is used to repre vision. If you have the need
01:04
to run again. So when you first bring up your Bagram box, the vagrant will proficient automatically the first time. But there is a command to do it again. If for some reason you needed to edit your script and then repre vision and you didn't want to reinstall the whole of Agron boxy in
01:23
again, this is a major strength and is the key to making our future deployments easy. There is some work when you are initially setting up that script.
01:30
Now, something to keep in mind here is that some script knowledge is necessary for effective use, and a lot of developers do get comfortable using some form of script so that they could speed up the development process with tools like Bagram. And these language script languages can vary by host. For example, on Lennox, you see
01:51
Bash, Corn, seashell and some other ones
01:55
and I'm Windows. You will primarily see
01:57
Power Shell and the command line terminal,
02:00
and the last note on there is that we need to acquire are vibrant boxes at the following link, which I'll show you when we are getting this all established. With that said, let's move into our virtual machine environment and get started with this stuff.
02:15
I welcome back to my virtual machine and let's get started with a vagrant box set up.
02:23
Now this link is available in the slideshow. But if, uh,
02:27
you want to copy it from the screen or look at the slasher, that's perfectly fine again, the girls Not too bad. It's app dot vagrant up dot com slash boxes slash search
02:38
And the box that we're going to look for is one that I've become more familiar with just cause I end up using it
02:46
more often than a lot of the other ones.
02:49
And General, you'll find that to be The case is that you'll start using a specific tool that you'll just get used to that and that is ah boon to. And we're gonna go with a newer distribution of the boon to 18 04 So I'm gonna go ahead and click on that,
03:01
and I'm going to select the new option.
03:06
So these are the commands that I need to run. The place I need to run them
03:12
is I'm gonna create a new folder, a new location. I'm gonna go into documents. I'm gonna right click
03:16
and select new folder
03:20
And I would call this folder Sai Buri.
03:23
I'm gonna click into Sai Buri
03:25
and I'm a click a again, a new folder. I'm just call this one of blue two because that's the operating system I'm using.
03:34
Click Into that when a right click, I'm gonna slick git bash here
03:39
and this becomes available cause of that Get bash that We installed a couple lessons back And now I'm just going to copy this
03:52
a copy,
03:53
go back to my terminal,
03:54
paste that into the terminal and enter,
03:59
and that's gonna communicate over the Internet. And Bagram is going to say it is going to identify the box that I'm looking for and prep the setting file for that box
04:10
and we will see the setting file show once it finishes
04:13
doing what it's doing. There it is. I'm going to right click this. I'm gonna select at it with note pad plus plus,
04:20
and that's gonna open this file.
04:24
And there isn't a lot that we have to do in this file because we're not doing too much. We're just setting up my sequel.
04:30
But we do need to set up the port fording for this.
04:34
So there should you should see a commented out line that says config dot b m dot network
04:42
for port.
04:43
So I'm gonna uncommon that
04:46
and I'm gonna change this to in my sequel Port, which is 33 06
04:51
and then for the host. I'm gonna set it to the same thing, which is 33 06
05:00
The next line we need in this file
05:02
and this this fall as well as the script file that I will show you after this will all be available as a resource for download. So you don't have to recreate them all. You'll be able to, uh, copy them if needed.
05:15
But it's always a good idea to understand what the commands are doing. And again, a good way to look at a lot of these settings files Is that its command setting? So we're given the command to use a shell, so it helps to know what a shell is, and that's gonna be our scripting language. And the path to that is script dot s H,
05:33
which means it's gonna look in the
05:35
parent directory for a file named script dot Shh.
05:40
Well, let me going to save that.
05:44
Now, let's take a look at that script. That s H file again. This file will be available for download, so you don't have to copy it.
05:50
Exactly. You build the copy it from a resource that will be available.
05:57
Okay, let's go ahead and walk through the script and briefly discuss everything that is happening at the very top. We have two very variables being declared. That's user and password. And we're setting those to the values of route and cyber Re I t. Respectfully.
06:11
Now, when working with scripting languages or any languages, it's important to know the the syntax rules in place for those languages. For example,
06:18
if I put a space here like might occur and many other languages, the Shell script will fail. It won't set password correctly, so I have to make sure there's no spaces there.
06:30
Okay, so this script gets run on our Bagram machine as a provisioning process,
06:35
so these commands are being run against the machine when it first and Stan Shih eights are any time you run the provisional command, so apt. Get
06:45
dash Y update is telling is a command to go get your updates This isn't in Boone to go get your updates. And if you have a yes, no question automatically select. Yes,
06:57
so it's a fresh installation. Let's go ahead and update, and let's just say yes to all those updates.
07:01
The next is a W get command. And what I was saying is that stands for Web Begin and we're gonna get the resource at this u R l and that's gonna be the My Sequel eight configuration file.
07:15
The next command is the Export Debian Front and equal Non Interactive. And what this command is doing is this is indicating that when we run this installation, we don't want to interact with it. So for this automation to work and to correctly automatically deployed my sequel on this operating system for us,
07:32
you have to make sure that it doesn't come back and try to ask those questions
07:36
during that installation. Otherwise, it's not automatic. It requires manual intervention to set up
07:43
the next command is a pipe. They call this piping yes to this command, which means we're running the D. P. K G command, which is deep packaging
07:55
the BoE file that we downloaded
07:58
and installing it and we're automatically again saying yes to questions affiliated with that process.
08:07
We run the update command again, and the reason we do that is that makes a boon to aware of the new configuration
08:13
with respect to my sequel. Eight. If you don't run this command again, what will end up happening is you'll end up installing
08:20
an old version of my sequel. I believe 5.6, which is the default one.
08:26
But we want the new one. We want my sequel. Eight. So we're making sure we get that update command in there, and the next few commands are automatically answering questions that my sequel needs to know during its installation process.
08:39
It needs to know the root password
08:41
so that's being supplied,
08:45
and that variable is indicated indicated by the dollar sign password.
08:50
So this password key word and this is represented by this dollar sign password. This is not.
08:56
This is just part of the command,
08:58
and the way you tell if it's a variable or not is this Dollar dollar son.
09:03
So that password gets confirmed.
09:07
The next one is important. It's telling my civil we want the legacy authentication method that so we don't have to go through the trouble setting up SSL certificates, which can be a headache by itself.
09:18
The next man is the installation of my sequel server and then following that are commands against my sequel to create the user identified by the password, which are listed at the top,
09:31
and to give that user all the privileges that we need in that database because its development We're just going across the board and saying, Give us everything
09:39
now with that said,
09:41
we're going and save that, make sure we have saved it into the right directory
09:46
script dot Shh.
09:48
And make sure that your operating system Windows is correct, showing you the correct extension.
09:54
Some installations of Windows will hide the extension by default. And you might actually have something along these lines
10:03
like dot shh
10:05
dot texts, and it's hiding the text. So you actually think you haven't S H file, but in reality, you don't you have a text file that Windows has hidden from you.
10:16
And if you have that issue, you have to go into the control panel
10:20
and tell it to show you
10:22
the extensions,
10:24
which is in the File Explorer options.
10:28
A little bit of an extra headache. Sometimes show hidden files, folders and drives
10:33
and
10:35
the high extensions for known file types. Make sure that's not selected.
10:39
You shouldn't have that issue, and that's how you solve it. If you are
10:43
with that said, you make sure you have this stuff saved in the correct directory again, these files will be available for download
10:50
and next you just go. And I had an old command here, so go ahead and
10:54
destroy what I had going on.
10:58
And now everything's gone. So
11:01
just type the fragment up
11:05
and thats going. Teoh run through the download and installation of everything the first time you run it. It will take a few minutes to run because it has to go and get the boot to operating system. Download it to In Stan. She ate it, so we'll go ahead and fast forward this to the end.
11:24
Okay, it looks like that process has finished. Let's go ahead and give it a test to make sure we can connect to the My sequel database. I have D Beaver Open,
11:33
and if everything went well, I should be able to connect to that. My sequel instance. Running on that. A boon to installation that's running in Bagram and virtual box, someone a right click
11:45
or, um, something clicked in new database connection.
11:48
Gonna find my sequel,
11:52
Not the version indicator. This one will have an issue. So I'm just used my sequel with no version indicating
12:00
next, and we used the user name route and I leave the password for this video. Starbury I t
12:07
go ahead and test that connection
12:09
and it looks like a successful someone. Go ahead and finish
12:15
and there we go.
12:18
There's our my sequel insulation running on our
12:22
guest virtual machine. And if we open virtual box,
12:30
we'll actually see that that machine is running
12:33
right there.
12:35
You can see that Bagram has given in a unique system identify her and that it's running.
12:43
Now let's say you have some issue you needed to reconfigure something you wanted to start over. What would you do? Well, it's actually pretty easy you do Vagrant Halt!
12:52
That'll stop your machine.
12:54
Okay, we can see that it's powered off the machine. And now if we wanted to just destroy it because something went horribly wrong during that during that insulation, we just type in vagrant. Destroy.
13:07
Now that's going Teoh, come back with a question of our re certain that we want to destroy the machine and we will go ahead and select yes,
13:16
following the destruction of that machine, you could always just reinstall it by Bagram up. So I'm gonna go ahead and select. Yes,
13:26
Now that machine is completely gone. And if I wanted to go through the whole process again, I would just
13:30
type in, vagrant up, run it and it would run through the entire installation again.
13:35
And that brings us to the 34 set up Vagrants summary. So what are the things that we did in this? Listen, while we identify the vibrant box that we needed, it was the generic a boon to 18 04 In our case, we made sure to provisioned to correct Port Fording. My sequel needs Port 33 06
13:52
to ah correctly function as faras network connections ago. So we had to make sure we set that up. Otherwise we wouldn't be able to connect to my sequel and that would have been a problem.
14:01
We created and utilized a shell script. Now this was part of that vagrant magic and allowed us to set up
14:09
commands that would automatically update set up and install my sequel.
14:13
And this really prepared us for future my sequel environments. We could just reuse our script and settings to deploy additional violent environments. For example, perhaps you have another my sequel programmer on the team, and you want to just quickly get them up. Well, you just make sure they have vagrant.
14:28
Then you give them the two files they need and you say, Go ahead and bag, ring up these files and you'll be ready to go.
14:35
So that completes this lesson and I hope to see you in the next thank you, bye.
Up Next
Instructed By
Similar Content