MongoDB
on
EC2
Instance
Get Started
qualityworkscg.com
@loveagileqa
$ sudo yum update to update the yum installer. Wait couple minutes for update to complete.
$ sudo nano /etc/yum.repos.d/mongodb.repo to create a repo file so that you can install MongoDB directly, using yum. Add the repository below to the file.
Installing MongoDB
Step 1
[mongodb]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
$ sudo yum install -y mongodb-org to Download and install mongo.
$ sudo mkdir -p /data/db/
$ sudo nano /etc/mongod.conf to change the path as you wish.
Installing MongoDB
Step 2
Installing MongoDB
Step 3
$ sudo mongod
By default MongoDB stores its data files in /var/lib/mongo and its log files in /var/log/mongodb. You can specify different log and data file location by altering /etc/mongod.conf. (see screenshot in step 2).
Also If you switch user then you must modify the access control rights to the /var/lib/mongo and /var/log/mongodb directories to give this user access to these directories.
$ sudo chown <username> /path_to_new_directory/
Installing MongoDB
Step 4
If you run $ sudo mongod and you get an error saying an instance of mongodb is already running then do a $ ps wuax | grep mongo
Identify the process number of mongodb then $ sudo kill [process number] to kill the process.
$ sudo mongod to start mongo DB Server
Step 5. Common Error
Once again we have reach the end of a wonderful tutorial. It has been fun teaching you, be sure to have fun with MongoDB.
And work with Quality in mind, Until next time.
Learn about Node.js
Learn about Node.js