First: Introduce the public key in the local system
sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv EA312927
Two: Then add a MONGO address from the local source.
ubuntu12.04
Echo "Deb Http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse" | sudo tee/etc/apt/ Sources.list.d/mongodb-org-3.2.list
Ubuntu 14.04
Echo "Deb Http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee/etc/apt/ Sources.list.d/mongodb-org-3.2.list
Ubuntu 16.04
Echo "Deb Http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee/etc/apt/ Sources.list.d/mongodb-org-3.2.list
Three: Update the source file
sudo apt-get update
Four: Installing MongoDB
If you want to install the default version directly, simply
sudo apt-get install-y mongodb-org
If you want to install a build, you need to
sudo apt-get install-y mongodb-org=3.2.8 mongodb-org-server=3.2.8 Mongodb-org-shell=3.2.8 Mongodb-org-mongos=3.2.8 mongodb-org-tools=3.2.8
After the = sign, follow the version number you specified.
Five: After the installation is complete, you can modify the path of the data storage and the path of the log file in the corresponding configuration file section of MONGO
Vi/etc/mongodb.conf
DBPATH Specifies the directory where your default data is stored
You can first create a folder, and then make this folder for you to store the data in the directory
Six: we can pass
sudo service Mongod start to start MONGO services
Seven: see if it starts
Netstat-antup
Eight: Start the client
Mongo
Install MongoDB under Ubuntu