MongoDB for Developers with Python Transcripts
Chapter: Setting up your computer to follow along
Lecture: Setting up MongoDB on macOS
0:01 Here we are on a relatively new Mac, you can see that this is MacOS seirra,
0:06 so relatively new, and if I come over here and I type Mongo,
0:10 no there is no MongoDB installed here.
0:13 So what are we going to do— we're going to install and set up MongoDB,
0:17 so those of you who use MacOS, like I do, you'll see that this is actually
0:21 the easiest of all the various operating systems to set up. Let's do it.
0:25 So we're actually going to start out at Homebrew,
0:30 now you may have Homebrew installed which is awesome,
0:32 and you can just run brew update, but if you don't
0:34 then you're going to need to run this command;
0:37 so we're going to run a script pass it off the ruby,
0:40 this is going to install Homebrew and if I hit enter,
0:43 it's going to go do this, this one time it needs my password
0:46 to make changes to the system, but in general,
0:51 you should not sudo run Homebrew, it even warns you if you do that I believe.
1:00 Okay, I get the little ding, it looks like everything is all set up.
1:04 So now if I type brew, yeey, stuff happens.
1:07 So the next thing that I want to do is actually install MongoDB,
1:10 so brew install mongodb,
1:21 and just like that, after 15 seconds, 20 seconds something to this effect,
1:25 it says MongoDB is all set up.
1:28 Now before I clear this and just run it, notice there's a couple of things,
1:31 it tells us right away, right here how we get started,
1:34 we can either run MongoDB as a service,
1:36 and if I do this without sudo, it's going to run this as a service any time I log in,
1:42 if I do it with sudo, it's going to basically do this
1:44 as part of the machine startup, shut down,
1:47 or I can just run MongoDB like so.
1:49 So let's go ahead and set this as a service,
1:52 it takes a moment and now it's up and running.
1:58 So how do we know whether it's running?
2:01 Well first of all, if I type mongo, it has something there, it has an app there right
2:04 you can see 3.4.4 is the one at the time of this recording,
2:08 and now it's connected and there's a few warnings here about access control,
2:11 this is worth considering, if this was a production machine
2:16 I would be quite concerned about this, it's my developer machine, so I'm not.
2:22 Let me show you why I'm not.
2:24 Okay, so if we exit out of here, the other way that we could run MongoDB
2:28 it's already running, so this isn't going to work again,
2:31 but we could run it passing this config file,
2:33 but what's interesting is, check out this config file
2:36 so if we go look at that, it has just a few things for us,
2:39 it tells us where the log file is going, good for system services,
2:43 where the data is going, and most importantly,
2:48 it's listening only one local host, 127.0.0.1.
2:53 I don't know what my public ip address is or I have both the ipv6 and ipv4,
2:57 MongoDB is not listening to either of them,
3:00 moreover, I also have my firewall turned on as much as possible,
3:04 believe it or not, it is not turned on on MacOS by default
3:08 that is super, super suspicious to me.
3:10 But anyway, firewall's on, and we're not even listening on the public network interface.
3:15 So do not change that, make sure that you are listening on only local host
3:20 or that authentication warning, that's going to have a whole different meaning.
3:23 When we get to the actual deployment section, where we deploy to production
3:27 we're going to set up users, we're going to set up ssl,
3:29 we're going to set up authentication, all of those kinds of things, among others,
3:32 but for now, for the devmachine, I think listening on local host
3:36 is probably sufficient for what we're doing.
3:39 So this MacOS is ready to take the class.
3:43 The other things we would need to do, is install PyCharm, install RoboMongo,
3:47 and do we have Python 3— we do, we have Python 3 installed,
3:53 I believe I actually already installed that earlier on this virtual machine.
3:58 So you're going to want to make sure you have Python 3 installed,
4:00 RoboMongo, and PyCharm, they all have super simple installers
4:03 that's basically either drag and drop or double click
4:06 and follow the next button and you'll be all done.
4:08 Then the machine will be completely ready to take this class.