Linux下安装Monogodb-3.2.4

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
> 
至此全部完成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值