1. Download the corresponding version at http://www.mongodb.org/downloads
2. Create a folder structure such as/data/DB/in the root directory. By default, MongoDB stores data in this folder. Create a folder:
Sudo mkdir-P/data/DB
Modify folder permissions:
# Enter The sudo chmod 777 data directory of data # Enter The sudo chmod 777 dB directory of the database
3. decompress the downloaded file, put it in a specific directory, go to the MongoDB bin directory in the console, and enter:
./Mongod
If "dbexit: really exiting now" is displayed, the startup fails because the port is occupied or the/data/db operation permission is insufficient. If "waiting for connections on port 27017" is displayed, the instance is successfully started. You can enter http: // 127.0.0.1: 28017/in the browser to obtain the database management information.
4. Use shell to interact with MongoDB
Run on the console
./Mongo
Select database:
Use testdb