Installing and configuring Mongodb on Ubuntu 16.04


Posted On: Nov 26, 2022

Installing and configuring Mongodb on Ubuntu 16.04


Follow the below steps to install MongoDB on Ubuntu 16.04.

Step 1: Import the MongoDB public key

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

Step 2: Generate a file with the MongoDB repository URL

echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

Step 3: Refresh the local database with the packages

sudo apt-get update

Step 4: Install the last stable MongoDB version and all the necessary packages on our system

sudo apt-get install mongodb-org


sudo apt-get install -y mongodb

Step 5: Create a new MongoDB service file 'mongod.service'.

cd /lib/systemd/system/
sudo nano mongod.service
Description=High-performance, schema-free document-oriented database

ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf


Save and exit

Step 6: Updating system services

sudo systemctl daemon-reload

Step 7: Start service and schedule service to be started at boot time.

sudo systemctl start mongod
sudo systemctl enable mongod

Read the Latest MongoDB interview questions

    Please Login or Register to leave a response.

    Related Articles

    Node Js Tutorials

    How to enable cors in Node js

    In this article, we are going to see how to enable CORS ( Cross-Origin Resource Sharing ) in Node JS. CORS essentially means cross-domain requests. Cross-Origin Resource Sharing (CORS) is a mechanism ..

    Node Js Tutorials

    Scheduling CRON Jobs on Node js using node schedule

    Cron Jobs are used for scheduling tasks to run on the server.CRON Jobs are the most commonly used method to automate tasks on Server. In this article, we will see how to schedule Jobs in Node.js. We a..

    Node Js Tutorials

    Uploading image from url using Node js

    In this tutorial, we are going to see how to Upload an image from URL using Node Js. We have written a simple function In Node.js to save an image from URL to local disk/ server. Whenever we use login..