Saturday, January 27, 2018

Install MongoDB from Tarball - Linux

Install MongoDB from Tarball - Linux

Here we gonna install MongoDB 3.2.18 using tarball approach, where we can give our own binary path and config file path.

Download the binary files



It will get downloaded in the home directory,


Extract the file from the downloaded archive

# tar -zxvf mongodb-linux-x86_64-3.2.18.tgz


Prerequisite to run mongo server

Create a data directory where the data should get stored,

# mkdir -p data/db
# cd data/db
# pwd

/home/ec2-user/data/db


Copy the binary path, where we extracted –

/home/ec2-user/mongodb-linux-x86_64-3.2.18/bin


Run the mongo server

# /home/ec2-user/mongodb-linux-x86_64-3.2.18/bin/mongod --dbpath /home/ec2-user/data/db

When click on enter, the server starts running listening to the default port  27017 as shown below –


As soon as you start the mongo server, the default files will get generated as shown below in the data directory.


Start the Mongo Client

Keep the server running in one command line and open another command line, run the below commands –

# /home/ec2-user/mongodb-linux-x86_64-3.2.18/bin/mongo


Done...








No comments:

Post a Comment