Before we start MongoDB for the first time, we need to create a directory in which the mongod process will write the data:
- By default, the mongod process uses the /data/db directory. To create this folder, you can use the following command:
mkdir -p /data/db
- Now we need to set permissions for the data directory:
chmod -R 777 /data
- In a new terminal (or tab) you need to run the following:
mongod
- If you didn't get an error, you could start the Mongo shell on the same host machine as mongod (in a new terminal or tab):
mongo --host 127.0.0.1:127017
- Finally, if ...