Installing MongoDB on CentOS

Create a Repo File

touch /etc/yum.repos.d/mongodb.repo

And append the following to the file.

name=MongoDB Repository

The base URL in the above will change to if you need to install Mongo on 32 bit. But then, why would you run Mongo on 32 bit. It is supposed to process humongous amounts of data and 32 bit will be bad choice.

now, go ahed and run this -

sudo yum install -y mongodb-org

Start mongodb

sudo service mongod start

And boom! you are up and running. To verify whether it is has successfully started, you may check the mongodb log

cat /var/log/mongodb/mongod.log | grep 'waiting for connections on'

You should see this line: [initandlisten] waiting for connections on port 27017

Also, it may be a good idea to enable service at the startup.

sudo chkconfig mongod on
# stop and restart
sudo service mongod stop
sudo service mongod restart


comments powered by Disqus