Full steps for installing MongoDB in Ubuntu

Source: Internet
Author: User
I. the dumbest steps in Ubuntu (the following operations are performed under the root user): 1. run "apt-getinstallmongo". If the installation package cannot be found, Run "apt-getupdate" 2. after installation, the mongod program should be automatically run. Run "pgrepmongo-l" to check whether the process has been started. 3. enter "mongo" on the terminal and press enter to enter the database (

1. the dumbest steps in Ubuntu (The following areRootPerform operations under the user):

1. Run"Apt-get install mongo"

If the installation package cannot be found, run"Apt-get update"

2. After installation, the mongod program should be automatically run"Pgrep mongo-l"Check whether the process has been started

3. Enter"Mongo"And press enter to enter the database.

(Over)

The following describes how to start the mongodb program on your own.

2. After the system is restarted, the mongo program needs to be manually started. The steps are as follows:

1. Run"Locate mongo"Command to check where mongo is installed by default. Here, we mainly focus on three things.

(1) One is named"MongodThe location of the Program (which is equivalent to the Server of the mongo database and must be running in the background all the time. My path:/Usr/bin/mongod);

(2) The location of the log file of the mongo database (Log FilesTo view the specific file name, The specific usage will be introduced later, my path:/Var/log/mongodb. log);

(3) The location of the mongo log (my path:/Var/log/mongodb. log).

2. first enter the directory where mongod is located (/Usr/bin/mongod), And then run"./Mongod -- dbpath/var/lib/mongodb/-- logpath/var/log/mongodb. log -- logappend &"

-- Dbpath:Specifies the folder in which mongo database files are stored.

-- Logpath:Specify the log of mongo. Here, the log must specify the specific file name.

-- Logappend:Indicates that the log is written in an additional way. By default, the previous file is overwritten.

&:Indicates that the program runs in the background

Note:If the system is shut down abnormally, an error will be reported during startup. Because mongodb is automatically locked, This is the directory where the mongodb database file is located (/Var/lib/mongodb/), DeleteMongodb. lockFile, and then perform the preceding operations.

After installation, you can write a C ++ program to perform database operations, write a simple C ++ program to connect to mongo and introduce it in another article if mongo dynamic library link fails, see http://www.linuxidc.com/Linux/2011-12/48834.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.