This applies to Fedora/CentOS/RedHat distributions of Linux.
Log in to the instance is as root
Add the 10gen MongoDB repository for yum, by creating the file /etc/yum.repos.d/10gen-mongodb.repo
For 64-bit version of MongoDB, add the following
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0
For 32-bit version of MongoDB, add the following
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0
Install MongoDB by running the following command
yum install mongo-10gen mongo-10gen-server
Modify the file /etc/mongod.conf Change the location of DB, logs files, ports as necessary
logpath=/var/log/mongo/mongod.log port=27017 dbpath=/var/lib/mongo
If you have changed the location of the db or log files, make sure that mongod has write permissions at the new locations. If not assign persmission
chown mongod:mongod /newlocation/mongodbfiles
Start MongoDB server
service mongod start or /etc/init.d/mongod start
To start MongoDB on server reboot
chkconfig --levels 235 mongod on