Installing MongoDB under CENTOS7 environment

Source: Internet
Author: User
Tags mongodb

1. Download

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.6.3.tgz

2. Decompression

Tar zxvf mongodb-linux-x86_64-amazon-3.6. 3. tgz

3. Mobile

MV mongodb-linux-x86_64-amazon-3.6. 3 /usr/local/mongodb

Note: Do not compile, itself is compiled binary execution file

4. Adding configuration Files

Vim/usr/local/mongodb/bin/mongodb.conf

Copy the following code

# Database file path DBPath=/usr/local/mongodb/data/db/# log file path LogPath=/usr/local/mongodb/data/log/  mongodb.log# whether to append log logappend=true# ports Port=27017# Whether the daemon starts fork=true  # Whether to start authorization authentication auth=true

Note: You need to create a database, log directory

5. Configure MongoDB Service

Vim/lib/systemd/system/mongodb.service

Copy the following code

[Unit]description=mongodbafter=network.target remote-fs.target nss-Lookup.target[service] Type=forkingexecstart=/usr/local/mongodb/bin/mongod--config/usr/local/mongodb/bin/  Mongodb.confexecreload=/bin/kill-s HUP $MAINPIDExecStop=/usr/local/mongodb/bin/mongod--shutdown-- config/usr/local/mongodb/bin/mongodb.confprivatetmp=true[Install]wantedby= Multi-user.target

6. Boot start

# boot Systemctl enable mongodb.service# start service Systemctl start mongodb.service# stop service Systemctl stop Mongodb.service

Installing MongoDB under CENTOS7 environment

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.