WEBVTT

00:00.150 --> 00:03.240
Hey, did everyone they share your programming friend from YouTube?

00:03.240 --> 00:06.300
And now let's continue the CDs of MongoDB.

00:06.600 --> 00:12.210
Now, in case you are from the world of Windows operating system, I wanted to say two things to you.

00:12.420 --> 00:17.730
First and foremost, videos for the installation of Windows is actually the next video.

00:17.730 --> 00:19.800
So in case you are from feature, you can go there.

00:19.800 --> 00:24.000
In case you are with the same timeline, make sure you hit that subscribe button so that you can know

00:24.210 --> 00:30.780
when I'm uploading that video to tip number two is make sure you watch the installation for both Mac

00:30.780 --> 00:35.940
and Windows and now Windows guys will say, Hey, why I want to watch the Windows one or the Mac one.

00:36.210 --> 00:40.890
The point is, my dear friend, you never know on what system you'll be working, when you'll be working

00:40.890 --> 00:42.870
for a company or maybe for a project.

00:42.870 --> 00:48.180
Sometimes things change and it's very awkward situation that you don't know how to install the exact

00:48.180 --> 00:51.960
same thing on which you call yourself an amazing master on a different operating system.

00:51.960 --> 00:57.090
It should not be the case, so make sure you watch both the videos, just have a feel, maybe watch

00:57.090 --> 01:01.410
it in two weeks and understand how things are installed here on the Mac environment.

01:01.410 --> 01:05.070
If you are from Windows, if you're from Mac, obviously you have to watch it.

01:05.130 --> 01:08.490
So let's go ahead and install this thing here.

01:08.490 --> 01:13.350
And yes, you notice the new screen here in the wallpaper because the entire screen is new.

01:13.350 --> 01:15.810
This is big, gigantic old screen died.

01:16.050 --> 01:18.300
So let's go ahead and install that.

01:18.330 --> 01:23.120
Now, in case you are thinking to go on to MongoDB slash download center and want to download this star

01:23.130 --> 01:24.270
dot zip file.

01:24.390 --> 01:25.830
No, please don't do that.

01:25.830 --> 01:30.510
We have a better solution and better approach of installing things on a macintosh.

01:30.870 --> 01:35.310
And I would like to introduce you one thing which in case you are a developer, you might be already

01:35.310 --> 01:36.090
aware of it.

01:36.090 --> 01:38.070
So it is known as Blue Dot.

01:38.910 --> 01:45.090
Now Blue is a service which is package manager and they call it proudly as the missing package manager

01:45.090 --> 01:50.610
of Mac OS just like we have yum and apt get exactly similar to that.

01:50.610 --> 01:55.260
So this video can be helpful for all those people who are on the Linux environment as well because the

01:55.260 --> 01:58.530
problems are exactly the same as on Mac as on Linux.

01:58.530 --> 01:59.850
It's not that much problematic.

01:59.850 --> 02:00.420
By the way.

02:00.660 --> 02:06.450
The first thing you have to do is copy this and this entire line and this is the way how you install

02:06.480 --> 02:07.830
Bru on your system.

02:07.830 --> 02:08.970
Now open up your terminal.

02:08.970 --> 02:15.270
We can just zoom it a little bit and this is terminal just hit command space type terminal and this

02:15.270 --> 02:20.910
is the one just paste it up there and it's going to install the bru mine is already installed.

02:20.910 --> 02:26.880
That's why it says, hey, we don't want to do that again and probably want to update some things and

02:26.880 --> 02:27.750
stuff like that.

02:27.750 --> 02:30.990
Mine brew is already very up to date, I believe so.

02:31.110 --> 02:36.510
In case it wants to take some time, we definitely want to give it that time, make sure it's all updated

02:36.510 --> 02:37.530
and all these things.

02:37.920 --> 02:39.240
And there we go.

02:39.240 --> 02:41.010
It's all done very quickly.

02:41.010 --> 02:42.510
So this is the step number one.

02:42.510 --> 02:47.310
In case you are making the notes, the step number two is optional, but I highly recommend you to do

02:47.310 --> 02:47.910
so.

02:48.120 --> 02:53.040
We are going to use Node in the very far from in the cities.

02:53.040 --> 02:57.330
We will be using mocha and mocha works really fine with the Node.js.

02:57.330 --> 02:59.610
So now we would like to install Node GSI.

02:59.610 --> 03:04.140
I highly recommend to follow me along here and we can ask the Bru to install it for us.

03:04.140 --> 03:07.500
So we are going to say brew install and we can just say node.

03:07.620 --> 03:11.130
Now this is going to install almost the latest version for us.

03:11.130 --> 03:12.180
You can just hit enter.

03:12.180 --> 03:18.150
I believe Node is already installed on my system and it said yes, brew is already node is already installed.

03:18.150 --> 03:24.480
In case yours is not installed, just go ahead and let it do its thing in case you want to check the

03:24.480 --> 03:25.500
node version.

03:25.590 --> 03:29.190
That is all fine and mine is ten .5.0.

03:29.190 --> 03:32.640
In case you are watching from future, you might be having latest version than this one.

03:32.640 --> 03:34.050
That is fine, my dear friend.

03:34.050 --> 03:39.660
You don't need to do exact same version as long as you are having somewhere around like more than five

03:39.660 --> 03:40.530
version of the node.

03:40.560 --> 03:42.150
That is also totally fine.

03:42.270 --> 03:43.620
Okay, that's very stable.

03:43.770 --> 03:44.340
Okay.

03:44.760 --> 03:50.940
Now it comes to installing the hero of the video, which is brew, brew, brew, install, and we want

03:50.940 --> 03:52.110
to install Mongo.

03:52.110 --> 03:55.170
Now, it's not MongoDB, it's just Mongo.

03:55.170 --> 04:00.390
Now this is going to take some while to just download and install all these things indirectly.

04:00.390 --> 04:08.280
Just visit the GitHub of that or probably wherever the repositories are and just gathers it and install

04:08.280 --> 04:09.210
it on the system.

04:09.210 --> 04:14.850
The problem is not the installation problem is what comes after the installation, the configuration

04:14.850 --> 04:16.050
part of the node.

04:16.050 --> 04:19.470
So don't worry, I will be walking you through with the configuration part.

04:19.470 --> 04:24.870
Actually, there are two errors that we have to face in order to properly understand where we are lagging

04:24.870 --> 04:25.230
it.

04:25.230 --> 04:26.640
So we're going to face both the errors.

04:26.640 --> 04:31.230
I'm going to manually fall into that error and we'll show you how you can come back from those errors.

04:31.380 --> 04:33.810
So I guess it's going to take a little bit while.

04:34.080 --> 04:40.140
And what I can do is I can hit a quick pause on this video so that that magic video editing can happen.

04:40.140 --> 04:43.170
And you don't have to see this bar just filling up till 100.

04:46.000 --> 04:52.030
So now that MongoDB is installed and you might have seen these things, MongoDB, whenever we install

04:52.030 --> 04:57.940
any kind of server on a Linux, whether that's RedHat one or anything as a given fact, they always

04:57.940 --> 05:00.400
are run using these d ds.

05:00.550 --> 05:07.690
This D actually means daemon and yes, it exactly spells the same as daemon from any horror movie,

05:07.690 --> 05:08.320
by the way.

05:08.770 --> 05:12.250
So we have to start this MongoDB Daemon server.

05:12.730 --> 05:18.100
So let me hit control l first of all, so that I can clean my screen and I'm going to fall into my very

05:18.100 --> 05:18.640
first error.

05:18.640 --> 05:22.930
So hit the mongo dx to start the demon and we are going to see some errors.

05:22.930 --> 05:26.290
Now, this is a classic error of MongoDB.

05:26.290 --> 05:31.510
I hope I can see some of the things here and can mention what exactly is the problem.

05:31.510 --> 05:32.740
Otherwise, I have to tell you.

05:33.250 --> 05:35.920
So I guess they are not able.

05:35.920 --> 05:36.400
There we go.

05:36.430 --> 05:38.680
This is this is really hard to find.

05:38.680 --> 05:41.950
This is exactly the reason of the very first error.

05:42.100 --> 05:48.550
Whenever you install the MongoDB on a Linux or on a mac, it just looks up for a default data directory.

05:48.550 --> 05:52.390
Here in our system, the default directory is not ever present.

05:52.390 --> 05:58.930
Whether that's a flavor of debian ubuntu, any given flavor of the Linux Mac including.

05:58.930 --> 06:02.890
So we have to create this directory and we're going to solve our very first issue, but we are going

06:02.890 --> 06:03.880
to fall into the next one.

06:03.880 --> 06:06.880
So how we can do that, it's actually really simple.

06:07.300 --> 06:11.890
We're going to create a directory, make sure you use the sudo command because it requires administrative

06:11.890 --> 06:14.350
purposes, administrative privileges here.

06:14.350 --> 06:17.290
And we're going to use a shortcut of hyphen B here.

06:17.290 --> 06:19.840
So we're going to say slash data, slash DB.

06:20.050 --> 06:27.280
Now make sure make sure this is warning, make sure the slash is there before the data.

06:27.280 --> 06:31.750
If you are not going to be putting a slash here, that means you are doing absolutely wrong.

06:31.750 --> 06:35.920
I know even after telling this one, so many people will in the comments will be saying it.

06:35.920 --> 06:42.370
So make sure you hit the slash data slash DB and I'm going to hit enter it sometime.

06:42.370 --> 06:45.850
Asks a password, but I guess it's not asking me.

06:47.260 --> 06:50.560
I guess the p command is not recognized here.

06:50.740 --> 06:52.240
I guess it's the capital p.

06:52.480 --> 06:53.140
My bad.

06:54.010 --> 06:54.640
There we go.

06:54.640 --> 06:56.560
So we're going to hit the cooler.

06:56.560 --> 06:57.310
There we go.

06:57.310 --> 06:59.080
So sudo okay.

06:59.260 --> 06:59.770
My bad.

06:59.770 --> 07:03.550
I forgot the main command which is my dear.

07:03.580 --> 07:04.180
Come on.

07:04.180 --> 07:05.710
That was unacceptable.

07:05.830 --> 07:11.230
Mkdir to make a directory and hopefully now we have a data directory.

07:11.230 --> 07:11.890
My bad.

07:11.890 --> 07:12.940
Totally my bad.

07:12.940 --> 07:14.590
I wanted to create a directory.

07:14.590 --> 07:15.070
Okay.

07:15.190 --> 07:16.510
We don't need to verify that.

07:16.510 --> 07:18.190
I believe it has done its task.

07:18.190 --> 07:19.210
So there we go.

07:19.210 --> 07:20.980
So the directory is done.

07:20.980 --> 07:27.190
So now we are expecting to run this MongoDB command, but it's going to still fall into one mode error

07:27.190 --> 07:28.990
one or one more gotchas.

07:29.500 --> 07:30.100
There we go.

07:30.100 --> 07:33.190
And I hope I will be able to show you the error again.

07:34.300 --> 07:37.780
It says again, this error is still here.

07:38.350 --> 07:43.450
But actually the problem is not this one, because we can see that the directory is there to confirm

07:43.450 --> 07:43.600
it.

07:43.600 --> 07:47.440
We can just do a CD slash and I can write D A and hit the tab.

07:47.440 --> 07:48.400
That means data is there.

07:48.400 --> 07:51.430
If I had the tab again we can see that the DB is here.

07:51.430 --> 07:53.530
So the problem is not the directory.

07:54.220 --> 07:59.950
If I can see that it is really hard to find that error again.

07:59.950 --> 08:01.000
And there we go.

08:01.120 --> 08:08.110
It says attempted to create a log file on a read only directory and the directory is there, but it's

08:08.110 --> 08:09.250
still terminating.

08:09.250 --> 08:13.600
So this is a classic problem of the privileges are also known as permissions.

08:13.960 --> 08:16.330
What I mean by that you have created that.

08:16.330 --> 08:20.530
But in the Linux system there are so many permissions we have to figure it out as well.

08:20.530 --> 08:21.880
So follow this command here.

08:21.880 --> 08:24.790
Again, it's actually really, really simple to change the permissions.

08:24.790 --> 08:27.130
I will not forget the operation command again.

08:27.130 --> 08:28.750
So we're going to do a pseudo.

08:28.780 --> 08:30.820
We want to change the ownership of that.

08:30.820 --> 08:36.790
So it's command is C, o, w n and to whom we want to give the permission.

08:36.790 --> 08:38.620
That's also an interesting question.

08:38.620 --> 08:42.670
In order to answer that, first, we have to ask the system, who am I right now?

08:42.670 --> 08:44.110
So if I say, who am I?

08:44.140 --> 08:45.700
My system name is Studio.

08:45.700 --> 08:50.080
That's my computer name and you will get your name a little bit different.

08:50.080 --> 08:55.750
So make sure you get that first and then we can use Sudo and change the ownership of that directory.

08:55.750 --> 09:01.720
We're going to use the shortcut commands of R and V and now we're going to write the name of our computer,

09:01.720 --> 09:02.140
whatever.

09:02.140 --> 09:02.620
Who am I?

09:02.620 --> 09:07.540
Return us back and now we're going to change the permission of data slash DB.

09:07.540 --> 09:09.400
So both of them, I want to change it.

09:09.550 --> 09:10.570
There we go.

09:10.600 --> 09:15.580
Now, finally we can run the mongo dx here Mongo dx and hit that enter.

09:15.610 --> 09:19.150
Now you're going to see a lot of things here, but these are not error.

09:19.150 --> 09:24.550
This is how server runs and we cannot verify it right now.

09:24.550 --> 09:29.950
We will be doing it verification a little bit later, but as long as you get something like this, it

09:29.950 --> 09:31.750
is all good and it is all working.

09:31.750 --> 09:36.700
What we can do is we can just go and open up the new terminal.

09:36.700 --> 09:41.410
So I'm going to just hit the shell and a new tab and there we go.

09:41.410 --> 09:45.010
We got a new tab here and I can run a simple mongo here.

09:45.010 --> 09:45.400
Mongo.

09:45.500 --> 09:47.510
Go and hit enter.

09:47.810 --> 09:52.370
As long as you get this ticky arrow thing, that means your mango is working.

09:52.370 --> 09:52.540
Good.

09:52.550 --> 09:55.880
Make sure you open this into the new terminal.

09:56.030 --> 10:00.590
Not in this one, because this needs to keep up and running whenever we want to go.

10:00.590 --> 10:04.700
That if you're getting this one here, that means everything is awesome and fine.

10:04.700 --> 10:08.960
But here are a couple of gotchas for you for the future as well.

10:10.100 --> 10:10.670
Now.

10:10.670 --> 10:13.830
MongoDB We have installed it as a service.

10:13.850 --> 10:17.990
Our database is running as a service whenever we want to work with it.

10:17.990 --> 10:19.940
This service should be up and running.

10:19.940 --> 10:21.650
So there are a couple of options.

10:21.860 --> 10:27.380
The first one is a little bit not so good, which is every time you want to watch my tutorials or want

10:27.380 --> 10:32.900
to work with the MongoDB, just come up and write MongoDB on the terminal, leave it up and running

10:32.900 --> 10:33.560
all the time.

10:33.560 --> 10:38.990
You want to work it and just open up another shell where you just want to work or do whatever you want

10:38.990 --> 10:39.470
to do.

10:39.620 --> 10:45.740
So this is not so good approach because I know many times you'll be forgetting to, uh, and starting

10:45.740 --> 10:48.350
this mongo daemon here and will be complaining.

10:48.350 --> 10:50.120
Hey, my code is not working.

10:50.450 --> 10:51.530
Not a good approach.

10:51.530 --> 10:53.000
Not a good approach, honestly.

10:53.000 --> 10:54.590
So we're going to hit the control.

10:54.590 --> 10:57.620
See here to quit the this mongo here.

10:57.620 --> 10:58.640
I'm going to hit control.

10:58.640 --> 11:03.650
See to close down this here as well so that we can work on a different solution here.

11:03.650 --> 11:06.400
So we have shut down the MongoDB for a moment here.

11:06.410 --> 11:08.210
Now type this command along with me.

11:08.210 --> 11:10.690
These are something which is related to brew.

11:10.700 --> 11:18.950
So what I want you to do is brew services, start mongo, okay, and hit the enter one.

11:18.950 --> 11:20.270
It's not going to do much.

11:20.270 --> 11:22.220
It's going to just do a few fancy stuff.

11:22.220 --> 11:27.380
What it is doing, it is installing MongoDB on your system as a default service.

11:27.380 --> 11:33.530
What it will do whenever the next time you'll restart your computer automatically a mongo service is

11:33.530 --> 11:39.590
going to be running on your computer again after you restart your computer next time when you come up.

11:39.590 --> 11:43.730
You don't need to do MongoDB on the one terminal and then Mongo on to another terminal.

11:43.730 --> 11:46.130
You don't need to do that if you have run this command.

11:46.220 --> 11:52.400
Otherwise, in case you don't want to use that bunch of resources, you can just use the previous method.

11:52.400 --> 11:57.530
Hit the MongoDB on the terminal and on the next one just go ahead to the regular mongo stuff.

11:57.530 --> 11:59.840
Again, restart is compulsory here.

12:00.170 --> 12:00.700
Okay.

12:01.460 --> 12:08.630
So this was a quick installation of mongo on a macintosh as well as the same thing works on your ubuntu,

12:08.630 --> 12:09.320
on your linux.

12:09.340 --> 12:13.130
All the flavors of that because it is exactly the same there.

12:13.130 --> 12:18.320
We don't have bru we have apt get and yum in case whatever the flavor of linux you are installing and

12:18.320 --> 12:19.220
working on it.

12:19.280 --> 12:23.750
So that's it for this video in case you are new here, make sure you hit that subscribe button, you

12:23.750 --> 12:25.640
know the regular stuff stuff blah blah blah.

12:25.670 --> 12:27.080
I subscribe and all of that.

12:27.080 --> 12:31.640
In case you are on a Windows World, make sure you watch the next video where we're going to install

12:31.640 --> 12:34.250
the MongoDB on a Windows environment.

12:34.250 --> 12:35.060
That's it.

12:35.060 --> 12:37.340
And I'm going to catch you up in the next video.
