Mongodb-org The package is a metadata package, the following 4 package packages will be installed automatically when installed
Mongodb-org-server The package contains the Mongod daemon, the associated configuration, and the initial script Mongodb-org-mongos the package contains the MONGOs daemon Mongodb-org-shell The package contains MONGO shell Mongodb-org-tools The package contains the following MongoDB tools: Mongoimport bsondump, Mongodump,mongoexport, Mongofiles, Mongooplog, Mongoperf, Mongorestore, Mongostat, Andmongotop.
1. Create a Yum source Repository file:
Vi/etc/yum.repos.d/mongodb-org-3.0.repo
[Mongodb-org-3.0]name=mongodb repositorybaseurl=http://repo.mongodb.org/yum/redhat/6/mongodb-org/3.0/x86_64/ Gpgcheck=0enabled=1
2. Install MongoDB packages and related tools:
Yum Install-y mongodb-org
If you install the specified version of MongoDB, you should specify each component package separately and the version number appended to the package name, such as:
sudo yum install-y mongodb-org-3.0.2 mongodb-org-server-3.0.2 mongodb-org-shell-3.0.2 mongodb-org-mongos-3.0.2 mongodb-org-tools-3.0.2
You can also define any available MongoDB version, and Yum will automatically update the MONGODB package when there is an updated version. To prevent inadvertent updates, you can use the Exclude directive in/etc/yum.conf, such as:
Exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
3. Related configuration:
If the firewall is turned on, SELinux must be configured to allow MongoDB to run on the Red Hat system or CentOS Linux. An administrator should set the following 3 options: 1. Allow port 27017 access (without the first download tool semanage): yum-y install policycoreutils-pythonsemanage port-a-T mongod_port_t-p TCP 270172. In configuration file/etc/selinux/config, set the SELinux mode to Permissive:vi/etc/selinux/configselinux=enforcing to Selinux=permissive3. Completely disable selinux:selinux=disabled
The default data file path for MongoDB instance storage is/var/lib/mongo, and the storage log file path is/var/log/mongodb and runs with the Mongod account. You can also configure the directory of data files and log files in the file/etc/mongod.conf.
vi/etc/ Mongod.conf
# Mongod.conf#where to loglogpath=/var/log/mongodb/mongod.loglogappend=true# Fork and run in backgroundfork=true#port= 27017dbpath=/var/lib/mongo# location of pidfilepidfilepath=/var/run/mongodb/mongod.pid# Listen to local interface only . Comment out to listen on all interfaces.bind_ip=127.0.0.1# disables Write-ahead journaling# nojournal=true# enables period IC Logging of CPU Utilization and I/O wait#cpu=true# Turn on/off security. OFF is currently the default#noauth=true#auth=true# Verbose logging output. #verbose =true# Inspect All client data for Vali Dity on receipt (useful for# developing drivers) #objcheck =true# Enable db quota management#quota=true# Set oplogging level where n is# 0=off (default) # 1=w# 2=r# 3=both# 7=w+some reads#diaglog=0# Ignore query hints#nohints=true# enabl E The HTTP interface (Defaults to Port 28017). #httpinterface =true# Turns off server-side scripting. This would result in greatly limited# functionality#noscripting=true# Turns off table scans. AnyQuery that would does a table scan fails. #notablescan =true# Disable data file preallocation. #noprealloc =true# specify. NS fi Le size for new databases.# nssize=<size># Replication options# in replicated MONGO databases, specify the replica s Et name here#replset=setname# maximum size in megabytes for replication operation log#oplogsize=1024# Path to a key file s Toring Authentication info for connections# between replica set Members#keyfile=/path/to/keyfile
4. Running MongoDB
Set up MongoDB with system self-boot: chkconfig mongod on enable MongoDB Service: Service Mongod Start Verify MongoDB started successfully: (View log for information waiting for connection) tail-5/var/log/ Mongodb/mongod.log[initandlisten] Waiting for connections on port <port>
You also see that the data has been generated:
Enter MONGO directly on the command line to enter the database:
At this point, complete! ~
Official reference: Install MongoDB on Red Hat Enterprise or CentOS Linux
MongoDB Basics (iv) Red Hat Enterprise 6.4 x64 Installation MONGDB 3.0 and configuration