DEV Community

bobStrange
bobStrange

Posted on • Updated on

Install mongodb 4.4 to arm64 amazon Linux 2

Recently I've tried to install mongodb to the arm64 amazon linux.
Because AWS Graviton 2 instances are cheaper than the other architecture instances.

Here is how you install mongodb community to the arm64 amazon linux.

The problem

According to the official document, MongoDB Community Edition on Amazon Linux supports the arm64 architecture but there aren't any instruction how you install it 😭

I modified a bit of /etc/yum.repos.d/mongodb-org-4.4.repo from their document and see if it works, but it doesn't work...

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

The solution

You first need to have installed mongodb-database-tools as the mongodb-org package depends on it.
Then you'll be able to install mongodb-org package.
Here is the way how you do that.

Add mongodb-database-tools yum repo

Create a /etc/yum.repos.d/mongodb-database-tools-4.4.repo file.

[mongodb-database-tools-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.4/arm64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
Enter fullscreen mode Exit fullscreen mode

Add mongodb-org yum repo

Create a /etc/yum.repos.d/mongodb-org-4.4.repo file.

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

Install both packages

You just need to run yum install command:

sudo yum install -y mongodb-database-tools mongodb-org
Enter fullscreen mode Exit fullscreen mode

Then you'll have installed mongodb on your server.

Discussion (1)

Collapse
networkangelapp profile image
Cloud Infrastructure Services

Its even easier to setup the latest version of MongoDB Server now straight from the AWS marketplace, there is a MongoDB image available: aws.amazon.com/marketplace/pp/prod...

It fully installs on Ubuntu 20.04, Post configuration steps are on: cloudinfrastructureservices.co.uk/...