Installing MongoDB in Linux (CentOS)

Source: Internet
Author: User

1. Download the corresponding operating system and machine version

Website: https://www.mongodb.com/download-center?jmp=docs

My system is CentOS-6.6, 64-bit, so choose Red Hat version, because they have to say Yuanyuan.

  

2. Installation

2.1 Extracting the installation package into the/usr/local directory

TAR-ZXVF mongodb-linux-x86_64-rhel62-3.2.7.tgz

To establish a soft connection after renaming to mongodb-3.2.7:

Ln-s mongodb-3.2.7 MongoDB

2.2 Create the database folder and the log file in the/usr/local/mongodb directory.

Mkdir/usr/local/mongodb/data

Touch/usr/local/mongodb/logs 2.3 Adds the MongoDB Bin directory to path for system-wide use of the edit/etc/profile file, at the end of the add: and then through the Source Profile command      Make the changes take effect immediately. 2.4 Write a simple script to launch the MongoDB 2.4.1 no password login script start-mongodb.sh content as follows:
Mongod--dbpath/opt/mongodb-data/data--logpath/opt/mongodb-data/logs/mongodb.log--journal--fork
Execute the script to open the Mongod service and set the password by MONGO the client to establish a new user. Creating a script creates a new user with the following content: Create result:

Password Setup is complete

The startup script is modified to:

Mongod--dbpath/opt/mongodb-data/data--logpath/opt/mongodb-data/logs/mongodb.log--journal--fork--auth

After the change is over, turn off the original Mongod service and then re-open the Mongod that requires password verification with a new script:

        

Test Service Status:

    

Successfully connected to the open MongoDB with the newly created user as shown

Installing MongoDB in Linux (CentOS)

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.