tar xf mongodb-linux-x86_64-rhel70-7.0.21.tgz
cp mongodb-linux-x86_64-rhel70-7.0.21/bin/mongo* /usr/local/bin/
tar xf mongosh-2.5.3-linux-x64.tgz
cp mongosh-2.5.3-linux-x64/bin/mongosh /usr/local/bin/
創建啟動文件
vi /etc/mongod.conf
systemLog:destination: filelogAppend: true#每次啟動使用追加方式記錄到mongod.logpath: /var/log/mongodb/mongod.log# Where and how to store data.
storage:dbPath: /var/lib/mongo #數據存儲目錄# how the process runs
processManagement:fork: truepidFilePath: /var/run/mongodb/mongod.pid # location of pidfiletimeZoneInfo: /usr/share/zoneinfo# network interfaces
net:port: 27017#服務端口默認27017bindIp: 0.0.0.0 #端口監聽在0.0.0.0上