Because the server uses the source provided by Alibaba Cloud, the MongoDB version installed is too low (it seems to be MongoDB 2.0.4). MongoDB 3.0 has been out for a while. The following describes how to upgrade MongoDB from http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu /. (Original prawns and Tigers)
Import public GPG Key:
Import the public key used by the package management system: The Ubuntu package management tools (I. e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. issue the following command to import the MongoDB public GPG Key:
Sudo apt-key adv -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv 7F0CEB10
Add the MongoDB source address to the source
Create a list file for MongoDB: Create the/etc/apt/sources. list. d/mongodb-org-3.0.list list file using the following command:
Echo "deb http://repo.mongodb.org/apt/ubuntu" $ (lsb_release-SC) "/mongodb-org/3.0 multiverse" | sudo tee/etc/apt/sources. list. d/mongodb-org-3.0.list
Update source
Issue the following command to reload the local package database: Reload local package database
Sudo apt-get update
Install MongoDB
Install the MongoDB packages: You can install either the latest stable version of MongoDB or a specific version of MongoDB.
Install the latest stable version of MongoDB
Sudo apt-get install-y mongodb-org
Install a specific version of MongoDB
Specify each component package individually and append the version number to the package name, as in the following example
Sudo apt-get install-y mongodb-org = 3.0.1 mongodb-org-server = 3.0.1 mongodb-org-shell = 3.0.1 mongodb-org-mongos = 3.0.1 mongodb-org-tools = 3.0.1
Finally, you can run the mongo -- version command to view the MongoDB version.