-1

I follow this tutorial: enter link description here To install mongodb on Ubuntu 16.04 amazon ec2.

But when i check if the service is ok, i found this:

enter image description here

Why? How to solve?

3

2 Answers 2

1

You need to create this (/data/db) directory as root

Either you need to use sudo , e.g. sudo mkdir -p /data/db

Or you need to do su - to become superuser, and then create the directory with mkdir -p /data/db

Note:

MongoDB also has an option where you can create the data directory in another location, but that's generally not a good idea, because it just slightly complicates things such as DB recovery, because you always have to specify the db-path manually.

1

create data/db directory in root and give read and write permission

cd /
sudo mkdir data
sudo mkdir data/db
sudo chown -R $USER /data/db
sudo chown -R $USER /tmp/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.