Install MongoDB under Mac
Background: Read the online n tutorials, all kinds of not reliable, forget to step on the pit
1. Download
Https://www.mongodb.com/dr/fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.6.2.tgz/download
Https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.6.2.tgz
2. Unzip
/opt/soft/mongo/
3. Add Environment variables
vi ~/.bash_profile
Add to
export MONGO_PATH=/opt/soft/mongo/mongodb-osx-x86_64-3.6.2export PATH=$PATH:$MONGO_PATH/bin
Effect
source ~/.bash_profile
4. Add MONGO DB
mkdir /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/data/mkdir /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/data/dbchmod -R 777 /opt/soft/mongo/
5. Add the MONGO configuration file
mkdir /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/etc
cd etc && touch mongod.conf
#mongodb config filedbpath=/opt/soft/mongo/mongodb-osx-x86_64-3.6.2/data/dblogpath=/opt/soft/mongo/mongodb-osx-x86_64-3.6.2/logs/mongodb/mongod.loglogappend = truebind_ip = 127.0.0.1journal=trueport = 27017fork = trueauth = false
6. Add a log file
mkdir /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/logsmkdir /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/logs/mongodb/touch mongod.log
7. Start
mongod --config /opt/soft/mongo/mongodb-osx-x86_64-3.6.2/etc/mongod.conf
Install MongoDB under Mac