简体   繁体   中英

Install mongodb-3.6 amazon ec2 Ubuntu issue

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:

在此处输入图片说明

Why? How to solve?

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

Either you need to use sudo , eg 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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM