The following details the steps to deploy MongoDB on a CentOS using .rpm packages and basic configuration following deployment.
For deploying MongoDB on alternative platforms, check http://docs.mongodb.org/manual/installation/ for deployment steps.
First of all we will need to configure the package management system to hold the configuration information for the MongoDB repository: by creating the following file ‘/etc/yum.repos.d/mongodb.repo ‘.
If you are installing MongoDB on a 64-bit architecture (which is recommended) add the below for the MongoDB repository:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.ord./repo/redhat/os/x86_64/ gpgcheck=0 enabled=1
If you looking to install 32-bit version (which is not recommended for production environments) use the below:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.ord./repo/redhat/os/i386 gpgcheck=0 enabled=1
Once the MongoDB repository has been configured, install the MongoDB daemon and tools packages.
yum install mongo-10gen mongo-10gen-server
By default, the install package configures MongoDB to use /etc/mongod.conf and the control script at /etc/rc.d/init.d/mongod. The instance will configure data files at ‘/var/lib/mongo’ and its log files in ‘/var/log/mongo’ and run using the security context of the mongod user account.
In order to control the mongod process, run the following:
service mongod start service mongod stop service mongod restart
You can verify that the mongod process has started successfully by checking f the log file /var/log/mongo/mongod.log.
If you require to ensure that MongoDB starts automatically following a reboot, run the following command:
chkconfig mongod on