How To Install Mongodb On Ubuntu




MongoDB is an open source database-driven documents (Document-Oriented Databases) that were originally created with C++ language. MongoDB itself already developed by 10gen since October 2007, but recently published in February 2009. In addition because their performance is 4 times faster than MySQL; MongoDB is also easily applied, because it has been incorporated as a PHP module.

In MongoDB concept there is no such thing as a table, column or line only collection (the allusion table), document (proverbial record). The data model of his own called BSON with structures similar to JSON, until the structure is fairly easy to read.

This tutorial the author discusses about how to installation of MongoDB on Ubuntu Server version 14.04 and 16.04. I need to know for your Ubuntu user 16.04, because Ubuntu 16.04 Systemd, while using mongoDB is not in the repository, so the special Ubuntu user 16.04 later we need to create scripts for Systemd.



This Stage Of The Installation
First we need to import PGP key from MongoDB:
Ubuntu users: 14.04
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

Ubuntu user 16.04:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

Then add to the list of repositories:
Ubuntu users: 14.04
$ 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

Ubuntu user 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

We then updates its repository:
$ sudo apt-get update

After that, we put MongoDB:
$ sudo apt-get install -y mongodb-org

Stage Setting
After pairing, the next step i.e. make MongoDB can be running at the time the "startup".

For those of you Ubuntu users 14.04 already automatically direct running on the "startup" the MongoDB, because he uses upstart, to check it out you can do the following command:
$ sudo service mongod status

For those of you Ubuntu users 16.04, which we know that it uses Systemd. So we need to create the scripts Systemdnya. As for the skripnya as follows:

Create a file in:
$ sudo nano /etc/systemd/system/mongodb.service

And fill in as the script below:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

Thus you can instantly run MonggoDB using "Systemd" i.e.:
To run it
$ sudo systemctl start mongodb

To make it run in "startup".
$ sudo systemctl enable mongodb



Next
Previous
Click here for Comments

0 comments: