1. automatically install MongoDB
Java code
Sudo apt-get install mongodb
After the installation of sudo apt-get install mongodb is complete, we found that the version 1.4 is installed, which is very out. Now MongoDB has: MongoDB shell version: 2.0.1
MongoDB only releases the replica set and sharding function after version 1.6.
2. Install the latest MongoDB
A. Modify the Ubuntu download package path: www.2cto.com
Sudo vim/etc/apt/sources. list
Sudo vim/etc/apt/sources. list
Add the following to the last line:
Code
Deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen B. Add GPG Key:
Code
Sudo apt-key adv -- keyserver keyserver.ubuntu.com -- recv 7F0CEB10
Sudo apt-key adv -- keyserver keyserver.ubuntu.com -- recv 7F0CEB10 c. Execute the automatic installation command:
First Update the installation package path
Code
Sudo apt-get update
Sudo apt-get update performs Automatic Installation
Java code
Sudo apt-get install mongodb-10gen
Sudo apt-get install mongodb-10gen
OK! Now we can use the latest version of MongoDB.
From ihuangweiwei