Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to Linux, I followed this tutorial provided by the official 10gen documentation, as far I see I'm able to run mongoDB db in the console but I'd like to run it as a service.

this is what I got so far:

enter image description here

I've been searching on the web but most of the tutorials seems to be outdated, the linux distro is centOS Linux version 2.6.32-279.14.1.el6.openlogic.x86_64

any advice on this will be appreciated

share|improve this question
up vote 1 down vote accepted

You can install mongodb-server for CentOS using the command

yum install mongodb-server.

Once it's installed you can control the mongod service with the service command

service mongod start

for example.

share|improve this answer
I was looking at this document and it says exactly the same!… thanks! – jack.the.ripper Dec 28 '13 at 21:29
minor follow up here - the OS repos tend to get out of date, and give you older versions (freezing on the major version for example). If you use the 10gen/MongoDB repos and packages instead (as described in the guide you linked) you will get the latest versions – Adam C Dec 30 '13 at 1:33

If you are not familiar with writing simple custom init script (stored in /etc/init.d/rc.d) I would recommend you to install MongoDB from official rpm packages which contain it. The script itself is responsible for starting the MongoDB service at system start-up. There is MongoDB yum repository with up-to-date packages. The procedure how to use it is described here.

Furthermore, the /etc/rc.d/rc.local script is executed by the init command at boot time. Adding commands to the bottom of this script is an easy way to start services instead of writing own scripts.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.