First things first. Head over to mongodb.com and we're going to click on get MongoDB to download 1
it. 2
Now you should be taken to the MongoDB download center and the first tab that's usually selected by 3
default is their cloud service 4
so the MongoDB Atlas service which we're going to explore a little bit later on when we actually deploy 5
our database. 6
But for now we want to choose the service tab. 7
And down here you should have your Windows version already pre-selected 8
and we're going to select the current version of MongoDB. 9
Now it's really important that you change this package from zip to MSI 10
because this is going to download a installation wizard and it'll make everything a lot easier for us 11
going forward. 12
So once you're done here then just go ahead and click download and now download should begin. 13
Now once download is completed you should be able to head into your Downloads folder and see this installation 14
wizard. 15
It's going to be called something like mongodb 16
something something something 17
.msi. 18
And this is going to be your installer. 19
And so now if you double click on it it will launch the installation wizard and all you have to do is 20
click next. 21
And then we're going to accept the terms of the license and we're going to choose the complete installation 22
and then you're going to select Run service as a network service user and make note of this directory 23
path that they've created here for you. 24
This is where they're going to install MongoDB. It's going to be on the C:\Program Files/MongoDB/ 25
server\4.0. 26
And I recommend keeping to this exact same file path because we'll need a little bit later on. 27
So keep it the same and keep a note of it and we're going to come back to it a little bit later on. 28
So then you're going to select next and we're going to uncheck install MongoDB compass because 29
we don't actually need it. 30
And then click next and finally click install to start the installation. 31
And once installation has complete simply click Finish and you'll exit out of the installation wizard. 32
All right. 33
So now that we've successfully installed MongoDB using the installer, if you now go into your C-drive 34
and you take a look at your program files you should see a folder called MongoDB and inside there's something 35
called server 36
and then there's the version of the MongoDB that you installed. 37
and then finally we get access to our binaries. 38
Now the next thing I want to do is I'm going to set up the data folder where MongoDB will save our 39
databases on our local system. 40
So I want you to go ahead into your C drive, 41
so make sure that up here says your C drive, and then you're going to create a new folder here and it's going 42
to be called data. 43
And then inside that data folder we're going to create a new folder called db and just make sure that 44
you've typed everything exactly as I have which is lower case data 45
and then inside data there's something called db. And we're going to leave all of that empty but just check 46
up here to see that you've got exactly the same kind of file path and directories as I have. 47
So inside your C drive you got a folder called data inside data 48
you've got something called db. 49
Now that we've successfully installed MongoDB we have to get it set up so that we can use it easily 50
through the hyper terminal. 51
And in order to do that we first have to check something. 52
So if you head into Explorer and just go into your C-drive and then scroll down until you see Program 53
Files, double click on that and we're going to scroll down until we find MongoDB. 54
Here it is. 55
And then we're going to go inside that folder and then inside the folder called server. 56
So now you should see a folder with a version number and this corresponds to the rough version of your 57
MongoDB 58
and this says 4.0. 59
And we want to set up a shortcut so that we can launch our mongo.exe and mongod.exe straight from 60
our hyper terminal using bash. 61
And now I want you to open up your hyper terminal and just change directory to your home folder by typing 62
in cd and then adding the tilde sign. 63
And once you've navigated there, I want you to go ahead and create a new file called .dash_ 64
profile and it has to be spelt exactly this way. 65
And then hit enter to create it. 66
And now that should be created if we do an ls -a we should be able to see it in a list of files 67
here and there it is .bash_profile. 68
So this is a hidden file that we've created which is going to tell our hyperterminal that when it starts 69
up and we want to access mongo and mongod we have a shortcut for it. 70
So now that we've created that file now we're going to edit it using vim. 71
So to do that we're going to type vim and then we're going to specify the file that we want to edit which 72
was .bash_profile. 73
So now if you hit enter this will now open up that file using the vim text editor which is a command 74
line based text editor. 75
Now there's a lot of memes around the vim editor and it's because it's not a graphical user interface 76
so there aren't any buttons to click on and it's a little bit more complex to get to grips with. 77
But I'm going to quickly show you how you can use it in a very simple way. 78
So firstly in order to stand actually be able to type anything in the vim editor we're going to hit 79
the i key, so 'i' for indigo on your keyboard and that will initiate the insert mode. And now you can actually 80
start typing stuff into this editor. And you can either type this out although it's kind of error prone. 81
So I would recommend that you head over to the written installations for MongoDB for Windows and there's 82
a link to this 83
in the course resources for this module. 84
And I just want you to scroll down to this part where you see there's this alias mongodb alias mongo 85
and a file path that we've specified. 86
I just want you to go ahead and copy both of those two lines and then paste it into vim. So you can 87
either use the shortcut or you can simply just navigate to it from this little menu icon at the top. 88
Now the thing you have to change here is we saw earlier on what was the version that you saw and C - program 89
files - MongoDB - server. 90
And for me it's 4.0. 91
Now if you're installing this at some point in the future that might read 4.1 or 5.0 I just want you 92
to change this part of the code to whatever it is you see there so that they match because this has 93
to be an entire file path that leads to mongo.exe and mongod.exe. 94
So if you go ahead again look inside your Explorer and you navigate from local disk C to program 95
files to MongoDB to server to 4.0 to bin, then you can see here is where our mongo.exe 96
and mongod.exe reside. 97
So this file path is going to lead to those files and we're creating simply an alias that makes it easier 98
for us to work with it inside our hyper terminal. 99
So if you need to edit this then just go ahead and change these parts to whatever it is that you see 100
in your version. 101
And then we're going to go ahead and save and exit vim which can be a little bit tricky but it's not 102
too hard. You just have to hit ESC to exit insert mode and we're going to type :wq and then 103
the !. 104
And now if you hit enter you would have saved that file and you would have exited vim. 105
So now we're ready to test and see whether if our installation has succeeded. 106
I want you to go ahead and close down your hyper terminal and you're going to simply relaunch it. 107
So now that we've restarted our hyper terminal then it's time to test and see if our installation has 108
succeeded. And we'll do that by writing mongo --version and hit enter. 109
Now if you see something that looks like this where it says MongoDB shell version 4.0.3 or a new version 110
but something that looks like this, then congratulations you have completed all of the setup and installation 111
of MongoDB and you're ready to proceed to the next lesson. 112
Now if you see something else such as bash mongo not found or something like that where it doesn't look 113
like this, then be sure to retrace your steps and maybe follow all of the instructions in the written 114
tutorials and just make sure that you haven't made any typos and anything that you're typing in looks 115
exactly the same or simply just copy and paste it from the instructions. 116
But now that we've completed installation and setup then you're ready to get started learning about 117
MongoDB.