Install MongoDB in SentOS Linux

Source: Internet
Author: User
Tags install mongodb

Step 1: Download MongoDB from the website to the local machine, prepare for installation curl-O linux/mongodb-linux-i686-1.8.1.tgz "> SLAVE ~] $ Mkdir-p/Apps when running this command, the following error may be reported: mkdir: the directory "/Apps" cannot be created ": the preceding problem is that the Linux user does not have the permission to create a directory. You can switch to the root user and execute this command.
2. Switch to the MongoDB running directory/Apps under [root @ localhost chhbloud] # cd/Apps 3. decompress the mongodb-linux-i686-1.8.1.tgz to the running directory [root @ localhost Apps] # tar-zxvf/home /chhbloud/mongodb-linux-i686-2.0.0.tgz tar is the decompression command, parameter description:-z: If the gzip attribute is available at the same time, use gzip to compress-x: To uncompress a file, run the command-v: shows the file-f: use the file name. Note that the file name should be followed immediately after f. Do not add any parameters! For example, if "tar-zcvfP tfile sfile" is used as an error, you must write it as "tar-zcvPf tfile sfile 」
4. Set the data file storage directory [root @ localhost Apps] # mkdir-p mogodb/db Step 3: start the MongoDB service [root @ localhost bin] #/Apps/mongodb-linux-i686-2.0.0/bin/mongod -- dbpath =/Apps/mongodb/db after the service is started listening to port 27017 Step 4: start MongoDB as a Linux service at random. 1. Create/Apps/mongodb/logs/mongodb. log File, used to store MongoDB log files 2. Configure MongoDB to start at random.
Vi/etc/rc. local: Use the vi editor to open the configuration file, add the following line of code/Apps/mongodb/bin/mongod -- dbpath =/data/db -- logpath =/Apps/mongodb/logs/mongodb. log and then run the command [root @ localhost bin] #/sbin/reboot NOW! Restart the system for testing.
Step 5: view MongoDB log records [root @ localhost logs] # pwd/Apps/mongodb/logs [root @ localhost logs] # ll total 8-rw-r -- 1 root 1483 09-25 mongodb. log to this step. Congratulations! You have installed the MongoDB database server.

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.