1.下载地址:wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.4.tgz
2.解压安装
tar -zxvf mongodb-linux-x86_64-3.0.4.tgz
mv mongodb-linux-x86_64-3.0.4 mongodb
cd mongodb
export PATH=<mongodb-install-directory>/bin:$PATH
mkdir -p data/db
mkdir logs
vim ./bin/mongodb.conf</mongodb-install-directory>
内容如下:
port=27017
dbpath=/opt/mongodb/data/db
logpath=opt/mongodb/log/mongodb.log
logappend=true
fork=true
:wq保存退出
3. 启动
mongod -f ./bin/mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 30406
child process started successfully, parent exiting
- ERROR: child process failed, exited with error number 1
尝试给dbpath和logpath绝对路径,确保子进程有权限写入。