How to Install MongoDB on Amazon Linux 2

Steps to follow

sudo vi /etc/yum.repos.d/mongodb-org-4.4.repo

Then paste this content into that file

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

After that, run this

sudo yum install -y mongodb-org

Start MongoDB server by running this command.

sudo systemctl start mongod

Check status by running this command

sudo systemctl status mongod

Everything that is mentioned above is also displayed in this video as well.

Spread the love