Installing mongoDB

1. Download mongoDB:

You should place the mongoDB binaries in a central location on the file system that is easy to access and control. Consider /opt.

wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.1.tgz

Note: This is Linux 32-bit release. 32-bit builds have certain limitations. 

 

2. Once you've downloaded the release, issue the following command to extract the files from the archive:

tar -zxvf mongodb-linux-i686-2.4.1.tgz

Optional: You may use the following command to copy the extracted folder into a more generic location.

[root@Master opt]# cp -R mongodb-linux-i686-2.4.1/ mongodb

 

3. Before you start mongod for the first time, you will need to create the data directory. By default, mongod writes data to the /data/db/ directory. To create this directory, use the following command:

mkdir -p /data/db

 

4. Launch mongoDB instance:

./mongod

 

5. You can use the mongo shell to connect to your mongoDB instance by issuing the following command at the system prompt:

 ./mongo

 

6. This will connect to the database running on the localhost interface by default. At the mongo prompt, issue the following two commands to insert a record in the "test"  collection of the (default) "test" database and then retrieve that record:

db.test.save( { a: 1 } )

> db.test.find()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值