Thursday, April 7, 2011

Install MongoDB on RHEL or CentOS

Edit /etc/yum.repos.d/10gen-mongodb.repo and add the appropriate repo.

32bit:
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0

64bit:
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0

Install MongoDB client and server
yum install mongo-10gen mongo-10gen-server

Check the settings in /etc/mongod.conf . To bind mongod to a specific ip, add something like:
bind_ip = 127.0.0.1

Ensure correct permissions on /var/lib/mongo
chown -R mongod:mongod /var/lib/mongo/

Start mongodb with the init script:
/etc/init.d/mongod start

No comments: