1. MongoDB Installation:
The steps for installing MongoDB under the Ubuntui system can be found in the website manual:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Also or here:
Http://www.runoob.com/mongodb/mongodb-linux-install.html
The following are common issues that occur during MongoDB startup :
2. After the installation is complete, additional database directories need to be created:
Reason:
MongoDB data is stored in the DB directory in the database directory, but this directory is not created automatically during the installation process, so you need to manually create the data directory and create the DB directory in the data directory.
I created the data directory under the root directory (/)
Note:/data/db is the default startup database path for MongoDB (--dbpath).
-/data/db
2.1 If you do not create a database directory, the following error will be reported when you start the server Mongod:
2.2 After you create the database directory, you may also encounter the following error when you turn on the Mongod server:
Reason:
When the database was created, the directory was created as root and the server was logged on with insufficient permissions to access the file.
Workaround:
- To view the permissions for the/data/db file:
-/data/db
- Modify Permissions:
-R go+/data/-/data/db
3. Start the MongoDB server:
sudo service mongod start
4. Connect to the server using terminal:
mongo
Successful connection displays the following information:
MongoDB installation and common errors