In the previous article, I started MongoDB development and talked about how to install MongoDB in windows. In this article, I will introduce how to install MongoDB in Linux.
First, download the MongoDB database, address: http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.1.tgz. Download whatever method you use, you can use wget, or you can download it in a browser. After the download is decompressed the compressed file: tar-xvf mongodb-linux-i686-1.8.1.tgz. Create the mongodb directory under the/usr/local/directory and the data and log directories under the mongodb directory. Copy all the stuff in the bin directory of the decompressed file to the/usr/local/mongodb directory (or you can execute or manually execute these steps ).
Then, run the MongoDB database server.
[root@localhost mongodb]# mongod --dbpath databash: mongod: command not found[root@localhost mongodb]# ./mongod --dbpath dataWed Jan 18 11:06:41 [initandlisten] MongoDB starting : pid=8859 port=27017 dbpath=data 32-bit ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data** see http://blog.mongodb.org/post/137788967/32-bit-limitations** with --dur, the limit is lowerWed Jan 18 11:06:41 [initandlisten] db version v1.8.1, pdfile version 4.5Wed Jan 18 11:06:41 [initandlisten] git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04Wed Jan 18 11:06:41 [initandlisten] build sys info: Linux bs-linux32.10gen.cc 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37Wed Jan 18 11:06:41 [initandlisten] waiting for connections on port 27017Wed Jan 18 11:06:41 [websvr] web admin interface listening on port 28017Wed Jan 18 11:06:59 [initandlisten] connection accepted from 127.0.0.1:55098 #1Wed Jan 18 11:11:05 [initandlisten] connection accepted from 127.0.0.1:40233 #2Wed Jan 18 11:11:05 [conn2] end connection 127.0.0.1:40233Wed Jan 18 11:11:05 [initandlisten] connection accepted from 127.0.0.1:40234 #3Wed Jan 18 11:11:05 [conn3] end connection 127.0.0.1:40234
Next, run the MongoDB database client (which can use javascript shell ).
[root@localhost mongodb]# lsbsondump mongo mongofiles mongosniffdata mongod mongoimport mongostatGNU-AGPL-3.0 mongodump mongorestore READMElog mongoexport mongos THIRD-PARTY-NOTICES[root@localhost mongodb]# ./mongoMongoDB shell version: 1.8.1connecting to: test> show dbsadmin (empty)local (empty)
Finally, we can play http: // localhost: 27017/in the browser/
You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number.
That's all!