CentOS6.5 install mongodb

Source: Internet
Author: User
Tags install mongodb
To install mongodb on centOS6.5, I found many methods on the internet. it seems that many of them compile mongodb directly. I feel a little trouble. I have read the installation method on the official mongodb website. it is very simple on the linux system (I don't know the differences between these installation methods). for the installation method on the official website, refer: installMongoDB is simply the following command: # cd/usr/local/src # I am used to installing it here and can change it by myself # c

To install mongodb on centOS6.5, I found many methods on the internet. it seems that many of them compile mongodb directly. I feel a little troublesome. I have read the installation method on the mongodb official website and it is very simple on linux (I don't know what the differences are between these installation methods)

For how to Install MongoDB on the official website, see Install MongoDB.

To put it simply, run the following command:

# Cd/usr/local/src # I used to install here, you can change # curl-O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz# mkdir-p mongodb # cp-R-n mongodb-linux-x86_64-3.0.6/mongodb # export PATH =
  
   
/Bin: $ PATH # Modify the PATH and add the mongodb execution file to the PATH.
   
    
Modify the directory of your installed mongodb, my is/usr/local/src/mongodb/mongodb-linux-x86_64-3.0.6
   
  

In the last step, if you want to write the command ~ /. In the bashrc fileNote:Your current user is the root user or your own user. the. bashrc files of different users are different. After modification, usesource ~/.bashrcTo make the configuration take effect.

The/data/db folder will be created later. Otherwise, an error will occur when running mongod, prompting you not to create the folder.

Because all the execution file permissions in bin are 755 and can be executed on any user, the common user should be able to run mongod at the beginning, but I ran it once with root, at this time, the owner of the file initialized by mongodb is root rather than a common user, and then an error occurs.Because the command has been run by the root user, the owner and group of the mongodb bin file are both root. I run mongod once on the root user and can run (). When running mongod on a common user98 Unable....: 13 Permission denied....Refer to the sf issue and enter the command on the terminal:$ sudo chown -R /data/db Then, the common user can run mongod.

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.