Tags

,

1. Add the MongoDB Repository

Create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration information for the MongoDB repository:
For 64bit:

[mongodb] name=MongoDB Repository 
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ 
gpgcheck=0 
enabled=1

For 32bit:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1

2. Install MongoDB

sudo yum install -y mongodb-org

3.

semanage port -a -t mongod_port_t -p tcp 27017 
yum install policycoreutils-python 
which semanage or whereis semanage
semanage port -a -t mongod_port_t -p tcp 27017

4.

sudo service mongod start

If failed, check the log in /var/log/mongodb/mongod.log If error found that says: ERROR: Insufficient free space for journal files Please make at least 3379MB available in /var/lib/mongo/journal or use –smallfiles

Solution: Create or edit the file /etc/mongodb.conf, add this lines:

# For MongoDB version 2.6+
storage:    
   smallFiles: true
# For version 2.4 and less
   smallFiles: true

Then just execute mongod to accept your config file (here it assumes that location of the config is /etc/mongodb.conf):

sudo mongod -f /etc/mongodb.conf

Create this directory: /data/db/ > /var/log/mongodb/mongod.log

Advertisements