Linux serverNETWORK ADMINISTRATIONS

How To Install MongoDB on CentOS 7

With the vi editor, create a .repo file for yum , the package management utility for
CentOS:
sudo vi /etc/yum.repos.d/mongodb-org.repo

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

Step 2 – Installing MongoDB
We can install the mongodb-org package from the third-party repository using
the yum utility.
sudo yum install mongodb-org
There are two Is this ok [y/N]: prompts. The first one permits the installation of the
MongoDB packages and the second one imports a GPG key. The publisher of
MongoDB signs their software and yum uses a key to confirm the integrity of the
downloaded packages. At each prompt, type Y and then press the ENTER key.
Next, start the MongoDB service with the systemctl utility:
sudo systemctl start mongod
Although we will not use them in this tutorial, you can also change the state of the
MongoDB service with the reload and stop commands.
The reload command requests that the mongod process reads the configuration
file, /etc/mongod.conf , and applies any changes without requiring a restart.
sudo systemctl reload mongod
The stop command halts all running mongod processes.
sudo systemctl stop mongod
The systemctl utility did not provide a result after executing the start command,
but we can check that the service started by viewing the end of
the mongod.log file with the tail command:
sudo tail /var/log/mongodb/mongod.log
Output
. . .
[initandlisten] waiting for connections on port 27017
An output of waiting for a connection confirms that MongoDB has started
successfully and we can access the database server with the MongoDB Shell: mongo

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *