mongoDB Installation - Process (MacOS)
https://www.mongodb.com/dr/fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-4.0.9.tgz/download https://www.mongodb.com/download-center/community (Click on download button by selecting OS from list)
- Open Terminal
- Check mongodb file name like mongodb-osx-ssl-x86_64-4.0.9.tgz
- Unzip the file like mongodb-osx-ssl-x86_64-4.0.9.tgz (
tar -zxvf mongodb-osx-ssl-x86_64-4.0.9.tgz
) - Check the directory after unzip and file may be like mongodb-osx-x86_64-4.0.9
- Move mongodb-osx-x86_64-4.0.9 directory into local directory (sudo mv mongodb-osx-x86_64-4.0.9 /usr/local/mongodb)
- Reach in directory /usr/local/mongodb by using the command
cd /usr/local/mongodb
and check the filels -l
- Create some other required directory data, and db inside data directory (
sudo mkdir -p data/db
) - Set permission sudo chown -R
id -un
/data/db (and it may ask Enter your password)
- Closes terminal window
- Open two termonal window
- In one termonal window, run
mongod
(And during start, if you face data/db directory related error or exception then runmongod --dbpath=/usr/local/mongodb/data/db
) - In 2nd window ], run
mongo
(now mongo shell will be start)