Lab - Configuration File (Unable to modify and create mongod.conf)

Hello All,

I am facing issue while completing Lab - Configuration file in chapter 1 of M103 course. I have launched mongod instance in the vagrant environment with the required settings ( run on port 27000, * data files are stored in /data/db/ etc…). Please find below screenshot of the question.

I am trying to launch config file using command mongod --config /etc/mongod.conf and

mongod -f "/etc/mongod.conf"

As mentioned in lecture, default configuration file is located in etc/mongod.conf. I am unable to edit or copy this file to home directory.

Kindly help me how to modify this file or how to create new mongo.conf file in home directory.


Thanks in advance !

You are unable to edit /etc/mongod.conf as it is owned by root
You need sudo privs.This is a master file.So don’t modify it

Try to prepare your own config file
cat /etc/mongod.conf
Open a vi editor and paste the contents of master file and save it with somename.conf

cd /home/vagrant
cp /etc/mongod.conf mymongo.conf
This will create copy of original file which is owned by vagrant
edit the file and remove the parameters not needed and correct the parameters you need as per your lab requirement
Save the file and kick off mongod
mongod -f /home/vagrant/mymongo.conf
Make sure you have r/w privileges on the dirs you mention in your config file(dbpath,logpath etc)