Thursday, January 18, 2018

Install MongoDB using YUM Installer – Linux

Install MongoDB using YUM Installer – Linux

Here am gonna show you an example to install MongoDB 3.2 version using YUM installer UNIX

Configure the package management system (yum)

Create a /etc/yum.repos.d/mongodb-org-3.2.repo file so that you can install MongoDB directly, using yum.

For the latest stable release of MongoDB - Use the following repository file,

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

# sudo vi /etc/yum.repos.d/mongodb-org-3.2.repo
Copy and paste the repo file here

# :wq



Install the MongoDB packages and associated tools.

To install the latest stable version of MongoDB, issue the following command:

# sudo yum install -y mongodb-org

Just trigger this command, after successful completion you can see the below screen –


By default, after the installation the below mentioned files will be created –

/var/log/mongodb/mongod.log
/etc/mongod.conf – Configuration File

When we start the server, the server will start according to the configuration mentioned in /etc/mongod.conf file.

Configuration File – by default

Dbpath - /var/lib/mongo
Logpath - /var/log/mongodb/mongod.log
Port – 27017

To start the server

# sudo service mongod start


You can check the mongo service by using the command,
# ps aux | grep mongo

To Start the client

Just type mongo in the same terminal, as we forked the process which is mentioned in the config file.

# mongo


Done...

No comments:

Post a Comment