On the last post described to install mongoDB 3.0.X version, the following steps are install 3.2.6 with easy way,
First need to import the public key,
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Create a list file for MongoDB.
# 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
Now, update the resources using below command
# sudo apt-get update
By default the repo. get to install the latest stable version of MongoDB.
# sudo apt-get install -y mongodb-org
If you want to install specific version like mongodb-org=3.2.6 perform the command.
# sudo apt-get install -y mongodb-org=3.2.6 mongodb-org-server=3.2.6 mongodb-org-shell=3.2.6 mongodb-org-mongos=3.2.6 mongodb-org-tools=3.2.6
To start the MongoDB service
# sudo service mongod start
To stop the MongoDB service
# sudo service mongod stop
To restart the MongoDB service
# sudo service mongod restart
To status the MongoDB service
# sudo service mongod status
Remove Packages.
It's very simple to remove MongoDB server,
# sudo apt-get purge mongodb-org*
Also, want remove Data Directories and logs
# sudo rm -r /var/log/mongodb
# sudo rm -r /var/lib/mongodb
Comments (0)