下载解压:
# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.6.tgz
# tar zxvf mongodb-linux-x86_64-ubuntu1404-3.2.6.tgz
新建数据文件夹和日志文件:
root@wang:/usr/local/mongodb# mkdir data
root@wang:/usr/local/mongodb# touch logs
dbpath:制定存放mongodb的库数据
logpath:制定mongodb的日志记录文件
fork:后台执行
root@wang:/usr/local/mongodb/bin# ./mongod --dbpath=/usr/local/mongodb/data/ --fork --logpath=/usr/local/mongodb/logs
about to fork child process, waiting until server is ready for connections.
forked process: 2959
child process started successfully, parent exiting
使用mongodb:
root@wang:/usr/local/mongodb/bin# ./mongo
MongoDB shell version: 3.2.6
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten]
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten]
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten]
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-05-27T13:11:03.006+0800 I CONTROL [initandlisten]
> show dbs
local 0.000GB
> ^C
bye
另:HTTP interface for MongoDB Deprecated since version 3.2