Monday, August 9, 2021

Installing Mongo on Linux2

To verify which Linux distribution you are running by running the following command on the command-line:


grep ^NAME  /etc/*release


 This gave like this below 


/etc/os-release:NAME="Amazon Linux"



Below setting in the /etc/yum.repos.d/mongodb-org-5.0.repo  had to be made 


[mongodb-org-5.0]

name=MongoDB Repository

baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/5.0/x86_64/

gpgcheck=1

enabled=1

gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc



And then sudo yum install -y mongodb-org


Installed the mongo package. 


By default, a MongoDB instance stores:

its data files in /var/lib/mongo

its log files in /var/log/mongodb


To run and manage your mongod process, you will be using your operating system's built-in init system. Recent versions of Linux tend to use systemd (which uses the systemctl command), while older versions of Linux tend to use System V init (which uses the service command).


ps --no-headers -o comm 1


This actually starts the mongo 


sudo systemctl start mongod


This shows whether it is running 


sudo systemctl status mongod



To enable at the system boot, do the below 


sudo systemctl enable mongod


To stop mongo


sudo systemctl stop mongod


To restart mongo


sudo systemctl restart mongod



References:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/

No comments:

Post a Comment