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上