[Rhel or CentOS Linux environment] Install MongoDB Tutorial

Source: Internet
Author: User
Tags documentation install mongodb mongodb tutorial mongo shell

Disclaimer: Translation Official documents: http://docs.mongodb.org/master/tutorial/install-mongodb-on-red-hat/?_ga=1.146202678.362433698.1425911361

Overview:

Learn how to install MongoDB RPM packages under Rhel or CentOS with this tutorial.

Packages that need to be installed:

MongoDB provides an official support package embedded in its private repository. The warehouse provides the following packages:

· mongodb-org

This package is an original package that automatically installs the following four RPM packages

· Mongodb-org-server

Contains Mongod daemon, related configuration, init script

· Mongodb-org-mongos

This package contains MONGO daemon

· Mongodb-org-shell

This package contains the MONGO shell

· Mongodb-org-tools

This package contains the following toolkits:

Mongoimport Bsondump,Mongodump,Mongoexport,Mongofiles,Mongooplog,Mongoperf,Mongorestore,Mongostat, andMongotop.

Control scripts

In mongodb-org This original package contains a variety of control scripts, including initialization scripts:/etc/rc.d/init.d/mongod. These scripts are used to stop, start, and restart threads.

This package uses/etc/mongod.conf to configure MongoDB. To view a reference document for a profile: configuration file

After the 3.0.0 version, there is no MONGOs control script. The MONGOs process is used only when the sharding is in use. You can use the Mongod init script to export your own MONGOs control scripts for use. View the reference documentation for the MONGOs configuration: mongos

OK, here's the beginning, go to the installation, so easy, divided into two steps:

1. Configure Yum:

In order to use Yum to install MongoDB directly, you need to create a/etc/yum.repos.d/mongodb-org-3.0.repo file:

 [mongodb-org-3.0]name=mongodb Repository< Span class= "NA" >baseurl=http://repo.mongodb.org/yum/redhat/$releasever/ Mongodb-org/3.0/x86_64/gpgcheck=0enabled< Span class= "o" >=1              

The above configuration is for 3.0, if you want to configure a different version, such as 2.4.2.6, to change the configuration file to/etc/yum.repos.d/mongodb-org-2.6.repo, the configuration information is also changed to:
[mongodb-org-2.6] name=MongoDB 2.6 Repositorybaseurl=http://downloads-distro.mongodb.org/repo/redhat/os/ x86_64/Gpgcheck=0Enabled=1          

2. Installing the MongoDB package and related toolkit
Install the latest stable version: sudo yum install-y mongodb-org
If you want to make a version installation, for example, version 3.0, the following:
sudo yum install-y mongodb-org-3.0.0 mongodb-org-server-3.0.0 mongodb-org-shell-3.0.0 mongodb-org-mongos-3.0.0 mongodb-org-tools-3.0.0

As above, you just need to make a version. Add the following configuration to the/etc/yum.conf file:
Exclude=Mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools 


OK, to this mongodb installation is complete, the rest is to start MongoDB.
1.start:
sudo service Mongod start

2. Verify that MongoDB started successfully:
View the log file to verify that the log file is in/var/log/mongodb/mongod.log and that the start is successful if the following appears:
[Initandlisten] Waiting for connections on port <port>
Where <port> is the listening port configured in/etc/mongod.conf, the default 27017

Use sudo chkconfig mongod on to configure the Mongod boot

3.stop MongoDB off MongoDB Service
sudo service Mongod stop

4.restart mondodb Restart MongoDB Service
sudo service mongod restart
Examine the processing errors and important information by looking at the log output in the/var/log/mongodb/mongod.log file,

5. Get started, learn the documentation

Official tutorial: Getting Started with MongoDB


[Rhel or CentOS Linux environment] Install MongoDB Tutorial

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.