In this section, you'll see how to install, configure, and run MongoDB on all the major operating systems—Mac OS X, Windows, and Linux.
Open a web browser and visit: https://www.mongodb.org/downloads.
The following steps explain how to install, configure, and run MongoDB on Mac OS X:
Applications
folder in my home directory where I install apps like this.sudo mkdir data
chown
command:chown your_user_name:proper_group data
./mongod
The following steps explain how to install, configure, and run MongoDB on Windows:
When asked which setup type you want, select Complete
C:datadb. MongoDB
needs this directory in order to run. This is where, by default, Mongo is going to store all its database files.cd C:Program FilesMongoDBServer3.0in Mongod.exe
The easiest way to install MongoDB in Linux is by using apt
. At the time of writing, there are apt
packages for 64-bit long-term support Ubuntu releases, specifically 12.04 LTS and 14.04 LTS. Since the URL for the public key can change, please visit the Mongo Installation Tutorial to ensure that you have the most recent one: https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/.
Install Mongo as follows:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 -- recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
apt:
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
/var/log/mongodb/mongod.log
for a line that looks like this: [initandlisten] waiting for connections on port 27017
mongod
command:sudo service mongod stop
sudo service mongod restart
MongoDB's document data model makes it easy for you to store data of any structure and to dynamically modify the schema. In layman's terms, MongoDB provides a vast amount of flexibility when it comes to storing your data. This comes in very handy when we import our data. Unlike with an SQL database, we won't have to create a table, set up a scheme, or create indexes—all of that will happen automatically when we import the data.