Install MongoDB – Ubuntu, CentOS, Debian

mongodb

This tutorial covers steps to install MongoDB in CentOS 6.4, Ubuntu or Debian Operating System.

Install MongoDB

Requirements

  • Centos / Debian / Ubuntu installed on your server or your computer
  • root privileges
  • SSH access
  • Basic Linux Working Skills

MongoDB is a NoSQL open-source document database written in C++. Structure of MongoDB differs from the standard table-based relational one using JSON-like documents with dynamic schemas. In many applications, this is useful for easier and faster data manipulation.

Install MongoDB

You can use default package manager which is included inside the corresponding Linux distribution:

CentOS 6.4

To install MongoDB with yum we will first add the “epel” repository to the system:

 

 

 

After that we can start mongoDB installation:

 

Ubuntu/Debian

First thing first, we will add 10gen repository to the system

Ubuntu
 

Debian:

 

Followed by:

 

After this we can start the installation:

 

You will be asked to confirm the installation.

You may have to start the service manually after the installation in CentOs:

 

 

In fact, In Debian/Ubuntu, service is started automatically by the system.


Test MongoDB service is working

The default port for MongoDB is 27017. However, default port and other settings can be changed in the configuration file of MongoDB:

 

One must restart the MongoDB service after making any changes to the configuration file

 

In order to check its functionality you can run the following command:

 

This opens a new screen which starts with “>”.Type “help” inside the MongoDB terminal and you will get full command list.

To access MongoDB from a remote server, you should make sure that the default port 27017 or any new customized port is allowed inside the server’s firewall:

 


Automatically start MongoDB on server Boot:

To start MongoDB automatically on server boot, you must run the following commands

CentOS 6.4

 

Ubuntu/Debian

 

You can install MongoDB in both VPS and Dedicated Servers Provided by TNP HOST

Was this post helpful?

Leave A Comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.