1.下载安装包:https://www.mongodb.com/download-center#community
2.tar -xzvf mongodb-linux-x86_64-rhel70-3.4.7.tgz
3.cd mongodb-linux-x86_64-rhel70-3.4.7/
4.创建data目录,logs目录,logs/mongodb.log文件
5.vi bin/mongodb.conf 下面的目录是安装目录
storage: dbPath: "/usr/mongodb/mongodb-linux-x86_64-rhel70-3.4.10/data"
systemLog: destination: file
path: "/usr/mongodb/mongodb-linux-x86_64-rhel70-3.4.10/logs/mongodb.log
net: port: 27022
http:
RESTInterfaceEnabled: true
processManagement:
fork: false
6.启动
cd bin
./mongod -f mongodb.conf //mongod是启动服务器
./mongo localhost:27022 //启动客户端,端口是自己设置在配置文件中