Skip to content

Instantly share code, notes, and snippets.

@v0lkan
Last active September 11, 2022 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v0lkan/01431f72f079cf05fcf9b55db07fbf6a to your computer and use it in GitHub Desktop.
Save v0lkan/01431f72f079cf05fcf9b55db07fbf6a to your computer and use it in GitHub Desktop.
Install MongoDB Community Edition on Amazon EC2 Linux

First, getthe name of the distribution:

grep ^NAME  /etc/*release

It will say something like “Amazon Linux” or “Amazon Linux AMI”.

sudo vim /etc/yum.repos.d/mongodb-org-4.2.repo

Then add this to the file:

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

Now, you can install MongoDB:

sudo yum install -y mongodb-org

Then, start MongoDB:

sudo systemctl start mongod

For additional info, check the official MongoDB documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment