MongoDB: installation error on amazon linux 2
Asked Answered
C

3

7

I am trying to install mongodb 4 into an amazonlinux:2018.03 docker container. I followed these instructions. I managed to install only one package: mongodb-org, but I failed to install the rest of it: mongos, server, shell, tools.

The error I am give is the following:

Error: Package: mongodb-org-mongos-4.0.2-1.amzn2.x86_64 (mongodb-org-4.0) Requires: libc.so.6(GLIBC_2.18)(64bit)

There is a libc.so.6 in /lib64 pointing to /lib64/libc-2.17.so

Any help would be appreciated. Thank you.

Commit answered 28/9, 2018 at 17:14 Comment(0)
T
4

It looks like you're using an AmazonLinux 2 MongoDB package within an AmazonLinux 1 container. You should try using the MongoDB 4.0.2 package for AmazonLinux 1.

Transnational answered 28/9, 2018 at 18:23 Comment(7)
I changed my container to amazonlinux:2 and now it only fails with mongodb-org-server: Error in PREIN scriptlet in rpm package mongodb-org-server-4.0.2-1.amzn2.x86_64Commit
A container is an isolated process, so I'm not even sure what you mean by "installing MongoDB in a container". Are you just running a shell within an existing container and then trying to install the MongoDB RPM in the ephemeral directory assigned as the FS for that container? The what, why, and how is not clear to me.Transnational
I am building a docker container and trying to install mongodb on it.Commit
You're trying to create a new container image, which adds another layer on top of the base AmazonLinux container image and which contains the MongoDB 4.0 binaries? A container is not a VM, so you don't have a separate RPM database to install the package into -- a container has a filesystem diff that gets laid down on the virtual FS that gets created when running a container. You should just open a shell within that container (bash process with the same cgroups and netfilters applied), lay down the mongo* binaries you want there, and then save that container state as a new container image.Transnational
I would recommend simply using the official MongoDB container from Docker: hub.docker.com/_/mongo shell> docker run mongo Or if you want a specific version you can use the tag: shell> docker run mongo:4.0.2-xenial If you really need to make your own custom container image, then the way to add the MongoDB RPMs to the base container image is within your Dockerfile that you're using for the new image you're making. Examples: 1) github.com/docker-library/mongo/blob/master/4.0/Dockerfile 2) hub.docker.com/r/mysql/mysql-server/~/dockerfileTransnational
If that is in fact what you're doing, then you'll need to examine the specific error messages for the cause of the RPM install failure and address the underlying issue. For an example: access.redhat.com/solutions/62728Transnational
No problem. Best of luck! It’s a fun rabbit hole to go down if you have the time. :-)Transnational
C
1

Cloud9 runs on the old Amazon linux instance, so you may run into this problem using the IDE. This is how I got it working for myself on Cloud9 running in an Amazon Linux instance:

File named "mongodb-org-4.2.repo"

[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

Then I ran the following in the same directory as that file:

sudo cp ./mongodb-org-4.2.repo /etc/yum.repos.d/mongodb-org-4.2.repo
sudo yum install -y mongodb-org
Chenab answered 21/2, 2020 at 23:33 Comment(0)
C
0

I had a similar issue but I followed this installation guide here; https://www.attosol.com/how-to-install-mongodb-in-aws-linux-step-by-step

You can get a more appropriate repo on this link https://www.mongodb.org/dl/linux/x86_64-amazon . My suggestion is that you experiment with the two most recent ones and see what works.

Carroll answered 29/7, 2020 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.