MongoDB Source Installation

Source: Internet
Author: User

System environment: CENTOS-7 64-bit

: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.5.tgz

Upload location:/usr/local/src

Software Installation Location:/usr/local/mongodb

Data storage location:/usr/local/mongodb/data

Log storage location:/usr/local/mongodb/logs

Installation

Extract

[Email protected]/]# CD/USR/LOCAL/SRC

[Email protected] src]# tar-zxv-f mongodb-linux-x86_64-rhel70-3.2.5.tgz

[Email protected] src]# MV Mongodb-linux-x86_64-rhel70-3.2.5.tgz/usr/local/mongodb

[Email protected] src]# Cd/usr/local/mongodb

Create a database directory and log directory

[[email protected] MongoDB] #mkdir-P/usr/local/mongodb/data

[[email protected] MongoDB] #mkdir-P/usr/local/mongodb/logs

Configuring firewalls

# Vi/etc/sysconfig/iptables

Insert

-A input-p tcp-m state--state new-m TCP--dport 27017-j ACCEPT

# Service Iptables Restart

Start MongoDB

MongoDB default database directory is/data/db, changing directory needs to add path configuration at startup

[Email protected]/]# Cd/usr/local/mongodb

[Email protected] mongodb]#/bin/mongod--dbpath=/usr/local/mongodb/data--logpath/usr/local/mongodb/logs/log.txt --logappend--fork

See the following information stating that the installation has completed and started successfully:

35828 ChildProcess started successfully, parent exiting

Stop MongoDB

[Email protected]/]# Cd/usr/local/mongodb

[Email protected] mongodb]#/bin/mongod--shutdown--dbpath/usr/local/mongodb/data/

Add CentOS Start-up entry

[Email protected] src]# VI +/etc/rc.d/rc.local
Append the MongoDB Start command to this file:
/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data–logpath/usr/local/mongodb/logs/log.txt-- Logappend--fork

MongoDB Source Installation

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.