1. 安装软件:
yum  -y  install  mongodb  mongodb-devel  mongodb-server
  1. 修改配置文件: vim /etc/mongod.conf
fork = true
pidfilepath = /var/run/mongodb/mongod.pid
logpath = /var/log/mongodb/mongod.log
unixSocketPrefix = /var/run/mongodb
dbpath = /var/lib/mongodb
port=27017
  1. 启动服务:
systemctl  start  mongod
  1. 连接数据库:
mongo
  1. 测试: