您的位置:首页 > 运维架构 > Linux

Linux下安装Monogodb-3.2.4

2016-04-07 15:15 543 查看

1.首先下载安装包

在Mongodb官方网站现在最新的tar包。
https://www.mongodb.org/downloads
这里下载的是mongodb-linux-x86_64-3.2.4.tgz

2.传送到服务器上去

[root@Mongodb Csong]# ls
<strong>mongodb-linux-x86_64-3.2.4.tgz</strong>  mongo-r3.3.4  mongo-r3.3.4.zip  tar-1.23-11.el6.x86_64.rpm  unzip-6.0-1.el6.x86_64.rpm

3.解压mongodb-linux-x86_64-3.2.4.tgz

[root@Mongodb Csong]# tar -zxvf mongodb-linux-x86_64-3.2.4.tgz
mongodb-linux-x86_64-3.2.4/README
mongodb-linux-x86_64-3.2.4/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-3.2.4/MPL-2
mongodb-linux-x86_64-3.2.4/GNU-AGPL-3.0
mongodb-linux-x86_64-3.2.4/bin/mongodump
mongodb-linux-x86_64-3.2.4/bin/mongorestore
mongodb-linux-x86_64-3.2.4/bin/mongoexport
mongodb-linux-x86_64-3.2.4/bin/mongoimport
mongodb-linux-x86_64-3.2.4/bin/mongostat
mongodb-linux-x86_64-3.2.4/bin/mongotop
mongodb-linux-x86_64-3.2.4/bin/bsondump
mongodb-linux-x86_64-3.2.4/bin/mongofiles
mongodb-linux-x86_64-3.2.4/bin/mongooplog
mongodb-linux-x86_64-3.2.4/bin/mongoperf
mongodb-linux-x86_64-3.2.4/bin/mongod
mongodb-linux-x86_64-3.2.4/bin/mongos
mongodb-linux-x86_64-3.2.4/bin/mongo
[root@Mongodb Csong]# ls
mongodb-linux-x86_64-3.2.4  mongodb-linux-x86_64-3.2.4.tgz  mongo-r3.3.4  mongo-r3.3.4.zip  tar-1.23-11.el6.x86_64.rpm  unzip-6.0-1.el6.x86_64.rpm

4.重命名文件夹

[root@Mongodb Csong]# mv mongodb-linux-x86_64-3.2.4 /usr/local/mongodb
[root@Mongodb Csong]# cd /usr/local/mongodb/
[root@Mongodb mongodb]# ls
bin  GNU-AGPL-3.0  MPL-2  README  THIRD-PARTY-NOTICES
[root@Mongodb mongodb]# mkdir data  --需要创建data文件夹
[root@Mongodb mongodb]# mkdir logs
[root@Mongodb mongodb]# ls
bin  data  GNU-AGPL-3.0  logs  MPL-2  README  THIRD-PARTY-NOTICES
[root@Mongodb mongodb]# cd data/
[root@Mongodb data]# ls
[root@Mongodb data]# mkdir db
[root@Mongodb data]# cd ../bin
[root@Mongodb bin]# ls
bsondump  mongo  mongod  mongodump  mongoexport  mongofiles  mongoimport  mongooplog  mongoperf  mongorestore  mongos  mongostat  mongotop

5.启动mongodb

这里使用后台运行mongodb,使用--logpath和--fork参数

[root@Mongodb bin]# ./mongod --dbpath=/usr/local/mongodb/data/db/ --logpath=/usr/local/mongodb/logs/mongodb.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 1195
child process started successfully, parent exiting
现在mongodby已经在后台运行了,现在可以使用bin目录下的mongo登入了。

6.登入mongodb

[root@Mongodb bin]# ./mongo
MongoDB shell version: 3.2.4
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-04-07T07:06:19.661+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-04-07T07:06:19.661+0800 I CONTROL  [initandlisten]
> x=20
20
>
至此全部完成。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: