Yum error while installing MongoDB on CentOS?

The error is pretty clear from yum:

http://repo.mongodb.org/yum/redhat/%24releaserver/mongodb-org/3.0/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

There isn't a file at the other end of that URL for yum to download, hence the 404. Put that URL in your browser and start to navigate to see what files are actually there.

This is the correct URL when I browse their repo:

  • http://repo.mongodb.org/yum/redhat/6/mongodb-org/3.0/x86_64/repodata/repomd.xml

I suspect they moved things but didn't regenerate the repomd.xml file. You can work around the issue by downloading the packages manually and then using yum install .. to install things.

Typo

But I think there's a typo in your repo file:

baseurl=https://repo.mongodb.org/yum/redhat/$releaserver/mongodb-org/3.0/x86_64/

Should be this:

baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/


It happens if your repo configurations are dirty.

Try this

sudo rm -rf /etc/yum.repos.d/mongod*
sudo yum clean all

Then create repo again

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

Then add this:

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

Then run the following command:

sudo yum install -y mongodb-org