one of the most foolish steps under Ubuntu ( below are the actions under the root user ):
1. Run "apt-get install MONGO"
Run "apt-get update" If the installation package is not found
2. You should automatically run the Mongod program after you install it, and see if the process has started with "pgrep mongo-l ".
3. Enter "MONGO"in terminal, then enter the database
(over)
Here's how to start your own MongoDB program.
Two. Restart the system after the MONGO program to manually restart itself, the steps are as follows:
1. Run the "locate MONGO" command to see where the system defaults to the MONGO, which focuses on three things.
(1) One is called "mongod" The location of the program (he is equivalent to the MONGO database server, need to always run in the background, my path:/usr/bin/mongod);
(2) One is the location of the log log file of the MONGO database (log log file to see the specific file name, the specific usage is described in the following, my path:/var/log/mongodb/mongodb.log);
(3) One is the location of the log log of the MONGO (my path:/var/log/mongodb/mongodb.log).
2. First enter the directory where the Mongod is located (/usr/bin/mongod), and then run "./mongod--dbpath/var/lib/mongodb/--logpath/var/log/mongodb /mongodb.log--logappend &"
--dbpath: Specifies which folder the MONGO database file is in
--logpath: Specify the log log of the MONGO, here log must be specified to the specific file name
--logappend: indicates that the log is written in an additional way, with the default overwrite of the previous file
&: indicates that the program is running in the background
Note: If the system is not properly shut down, so that the boot will be error, because MongoDB is automatically locked, it is necessary to enter the MongoDB database file directory (/var/lib/mongodb/), delete the directory Mongodb.lock file, and then do the above.
After installation, you can write a C + + program to do the corresponding database operations, write a simple connection MONGO C + + program and if the resolution of MONGO dynamic library link failure is described in another article.