创建data这个文件夹 结构如下
|--data
|---data
|---log
|---conf
|---bin
在bin下复制已安装的mongod执行文件,然后在conf文件夹下面创建一个start.conf的文件内容如下
port = 1234
dbpath = data
logpath = log/mongo.log
fork = true // 后台运行
然后在主目录下创建一个start.sh的shell文件 内容很简单
#! /bin/bash
./bin/mongod -f conf/start.conf
然后启动 服务器
$ sh start.sh
然后他有这么一段提示 说明启动成功
about to fork child process, waiting until server is ready for connections.
forked process: 19284
child process started successfully, parent exiting
然后在服务器上访问你的linux主机的ip:1234 出现下面的提示 说明成功
It looks like you are trying to access MongoDB over HTTP on the native driver port.