Mit dem gridscale Partner Panel Cloudprovider werden - Das Webinar Das WebinarMit dem gridscale Partner Panel Cloudprovider werden Das Webinar

Install MongoDB on Ubuntu

Im Durchschnitt wird dieses Tutorial Install MongoDB on Ubuntu mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 739 Besucher eine Bewertung abgegeben.
739 0

Install MongoDB on Ubuntu

Datenbank NoSQL Ubuntu

MongoDB – a NO-SQL database

Like Redis and RethinkDB, MongoDB is a no-SQL DB, a database which does not correspond to the classic SQL system, but stores complete objects in strings and then provides them for querying or filtering. This new technology is not only faster and more effective than the classic SQL databases, it also offers completely new methods of data storage.

This tutorial shows how MongoDB can be installed on an Ubuntu 16.04 LTS server.
For the tutorial an average of about 4 minutes is required. Should it be tried out, but not installed on your productive system? Then it is recommended to create a new server at gridscale, which takes only a few seconds. How this works, is shown in this article (German only).

Preparing the server

As before every installation, the server should be updated. All updates and upgrades must be downloaded and installed. On Ubuntu, the package manager APT takes most of the work as soon as the process is started with the following command:

apt -y update && apt -y upgrade && apt -y dist-upgrade

As with RethinkDB (German only), MongoDB is not yet in the official Ubuntu repository. Therefore, the Developer Repository must be manually added and then loaded:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list

apt -y update

Installing MongoDB

After the server is up to date, it is possible to install all necessary tools.
APT is also doing work here. Just execute the following command and APT will take care of the rest:

apt -y install mongodb-org

Afterwards the service for SystemD has to be defined. To do this, the /etc/systemd/system/mongodb.service file must be created and edited with an editor. In this example, nano is used:

nano /etc/systemd/system/mongodb.service

The following content must be inserted into the file:

[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

After this, Nano can be terminated with the key combination Ctrl + X and the changes can be saved by answering the question with Y.

You can then use the following command to enable MongoDB to boot automatically:

sudo systemctl enable mongodb

Set up MongoDB

After MongoDB is now set up successfully, the service can be started with the following command:

service mongodb start

To display the current status, the following command can be used:

service mongodb status

Other parameters are stop to terminate the server and restart to restart the server.

Summary

With these few steps, MongoDB can be installed on a server and ready for the new generation of databases. In the long run, no-SQL DBs will certainly replace the classic SQL DBs. Therefore, it is worth looking at applications like RethinkDB, MongoDB or Redis. More information about installing RethinkDB and Redis can be found in the articles “Installing Redis on Ubuntu 16.04 LTS” and “Installing RethinkDB on Ubuntu” (both German only)

MongoDB – a NO-SQL database Like Redis and RethinkDB, MongoDB is a no-SQL DB, a database which does not correspond to the classic SQL system, but stores complete objects in strings and then provides them for querying or filtering. This new technology is not only faster and more effective than the classic SQL databases, it also […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema Install Rancher v1.3 on Ubuntu 16.04?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you