Installing and Running MongoDB on a Linux Server

MongoDB is a free, open-source document-oriented database which stores data in JSON-like documents with a flexible schema. This "NoSQL" database is a popular alternative to traditional relational databases like MySQL. Learn how to install MongoDB on a Cloud Server with CentOS 7, Ubuntu 14.04, or Ubuntu 16.04.

There are two options for installing MongoDB:

  • On a new server: 
    MongoDB is available as a ready-to-use application which can be automatically installed on the server when it is built.
     
  • On an existing server:
    MongoDB can be manually installed and configured on an existing server.

Requirements

  • A Cloud Server with Linux (CentOS 7, Ubuntu 14.04, or Ubuntu 16.04).

Free Cloud Server Trial from IONOS

Try out a Cloud Server for free now - test your IONOS Cloud Server for 30 days!

REST API
Unlimited traffic
VMware virtualization

Install MongoDB on a New Server

Log in to the Cloud Panel then go to Infrastructure > Servers.

  • Click + Create to create a new server.
  • Set a name for the server, and click the server configuration you wish to use.
  • Click the Applications tab.
  • Click the Search icon, and search for MongoDB.
  • Click MongoDB.
  • Click Create to build the server.

Install MongoDB on an Existing Server

CentOS 7

To add the repository, create a mongodb-org-3.6.repo file and open it for editing:

sudo nano /etc/yum.repos.d/mongodb-org-3.6.repo

Add the following content to this file:

[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

Save and exit the file.

Update the system:

sudo yum update

Install MongoDB with the command:

sudo yum install -y mongodb-org

Controlling the MongoDB Service

Start MongoDB:

sudo systemctl start mongod

Stop MongoDB:

sudo systemctl stop mongod

Restart MongoDB:

sudo systemctl restart mongod

SSL certificates from IONOS

Protect your domain and gain visitors' trust with an SSL-encrypted website!

Easy activation
Proven safety
24/7 assistance

Ubuntu 14.04

Import the MongoDB public GPG key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

Create a mongodb-org-3.6.list file:

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

Update the package database:

sudo apt-get update

Install MongoDB:

sudo apt-get install -y mongodb-org

Controlling the MongoDB Service

Start MongoDB:

sudo service mongod start

Stop MongoDB:

sudo service mongod stop

Restart MongoDB:

sudo service mongod restart

Web hosting with a personal consultant

Fast and scalable, including a free domain for the first year and email address, trust web hosting from IONOS!

Domain
Wildcard SSL
24/7 support

Ubuntu 16.04

Import the MongoDB public GPG key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

Create a mongodb-org-3.6.list file:

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

Update the package database:

sudo apt-get update

Install MongoDB:

sudo apt-get install -y mongodb-org

Controlling the MongoDB Service

Start MongoDB:

sudo systemctl start mongod

Stop MongoDB:

sudo systemctl stop mongod

Restart MongoDB:

sudo systemctl restart mongod

Wait! We’ve got something for you!
Discover our special deals at IONOS!
Our most popular products, including cloud storage, hosting,
domains and more - now on sale.