CentOS 7 Server Configuration--Install MongoDB

Source: Internet
Author: User
Tags create mongodb install mongodb

#下载MongoDB源文件: wgethttps://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.4.7-tgzNote: wget download is slow here, it is recommended to use FTP upload after downloading with other clients#解压下载的文件tar-zxvf mongodb-linux-x86_64-rhel70-3.4.7.tgz# Rename the extracted files mv mongodb-linux-x86_64-rhel70-3.4.7 mongodb# Create a data file and log file directory for MongoDB mkdir-p/data/dbmkdir-p/data/logsNote: The file directory created here is in the root directory#进入mongodb的bin目录cd mongodb/bin# Create MongoDB configuration file Vi./mongodb.conf# Add the following information DBPath =/data/db #数据文件存放目录logpath =/data/logs/ Mongodb.log #日志文件存放目录port = 27017   #端口fork = True   #以守护程序的方式启用, that is, run in the background nohttpinterface = true# Save, start mongodb./ Mongod--config mongodb.conf   Setup mongodb Boot # create Mongodb.service file under/lib/systemd/system folder vi/lib/systemd/ system/mongodb.service# Add the following [unit]    description=mongodb   after= Network.target remote-fs.target nss-lookup.target    [service]  type= forking  execstart=/home/mongodb/bin/mongod --config /home/mongodb/bin/mongodb.conf   ExecReload=/bin/kill -s HUP  $MAINPID   execstop=/home/mongodb/bin/mongod -- shutdown --config /home/mongodb/bin/mongodb.conf  privatetmp=true       [Install]  WantedBy=multi-user.target    #为mongodb. Service Set Permissions chmod  754 mongodb.service  #设置开机启动systemctl enable mongodb.service# to open the service systemctl restart Mongodb.service Note: If it has been started after the installation of MongoDB, starting the service here may be an error, since Port 27017 is already in use, as long as the server is restarted, and the MongoDB service will start automatically  

CentOS 7 Server Configuration--Install MongoDB

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.