Skip to content

Instantly share code, notes, and snippets.

@tejasbubane
Last active December 28, 2015 23:39
Show Gist options
  • Save tejasbubane/7580971 to your computer and use it in GitHub Desktop.
Save tejasbubane/7580971 to your computer and use it in GitHub Desktop.
Instructions for setting up mongo server on Amazon EC2 instance with CentOS(x86_64)
nano /etc/yum.repos.d/mongodb.repo
Paste the following code in this file:
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
yum install mongo-10gen mongo-10gen-server
service mongod start
If you get error in the above command as command service not found, create an alias:
alias service="/sbin/service"
Now change the mongodb directory to /mnt since it requires a lot of space:
service mongod stop
mkdir /mnt/mongo
nano /etc/mongod.conf
change the dbpath variable with /mnt/mongo
chwon mongod /mnt/mongo
service mongod start
Lastly install gems so that the ruby script runs:
gem install mongo bson_ext
Check by starting the mongo shell with `mongo` command
References:
[1] http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/
[2] http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/
[3] http://www.flaviogambardella.com/ruby-on-rails/configure-rails-to-use-mongodb-without-mongomapper/
See [3] for using mongodb with rails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment