Tuesday, November 7, 2017

How to install MongoDB on Lubuntu 17.10

How to install MongoDB on Lubuntu 17.10

MongoDB is the most popular noSQL type database out there, high performance schema free database, totally different from the regular relationship database that use SQL. In this article i will guide you on how to install MongoDB on lubuntu 17.10 artful. 

How to install MongoDB 3.2 on Lubuntu 17.10
  • open command line or terminal on lubuntu by pressing CTRL + ALT + T
  • add MongoDB 3.2 to the source.list
  • echo "deb http://repo.mongodb.org/apt/ubuntu artful/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
    
  • run update command
  • sudo apt-get update
  • install mongodb
  • sudo apt-get install -y mongodb-org

Pin MongoDB specific version
The apt-get command will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin the version of MongoDB at the currently installed version, issue the following command sequence:

echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

How to start, stop and restart MongoDB service
start MongoDB service
sudo service mongod start
stop MongoDB service
sudo service mongod stop
restart MongoDB service
sudo service mongod restart
check status MongoDB service
sudo service mongod status

How to use MongoDB?
I already create separate tutorial for beginner to learn basic MongoDB commands, i recommend check it out if this your first time using MongoDB.

No comments:

Post a Comment