0

I am attempting to install MongoDB on my RedHat 8 | AWS EC2 instance ...

/etc/yum.repos.d/mongodb-org-4.0.repo

[mongodb-org-4.0]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

Then ... yum repolist

MongoDB Repository                                                                                                                                                                 366  B/s | 390  B     00:01
Error: Failed to synchronize cache for repo 'mongodb-org-4.0'

...

Possibly RHEL 8 being a new release is causing issues?

2
  • 1
    Check these things 1. your server able to communicate to repo(check for others too). 2. if url given in repo is correct and having correct information. 3. try to clean repo and retry like sudo dnf clean all sudo dnf rm -r /var/cache/dnf sudo dnf upgrade
    – asktyagi
    Jun 15, 2019 at 14:55
  • Run with --verbose as it may show you something. Also, the config online now uses HTTPS.
    – cEz
    Nov 20, 2019 at 11:21

3 Answers 3

1

Many, many things built for RHEL also require EPEL, but EPEL 8 is not yet available.

One of those things is mock, a package which orchestrates building RPM packages for distribution, which is itself in EPEL, and which doesn't yet have a usable configuration for RHEL 8.

It is probably going to be several months before this is resolved, and EPEL and mock are available. In the meantime you should deploy on RHEL 7.

5
  • @micheal-hampton why do you refer to EPEL regarding a cache syncronisation error?
    – cEz
    Nov 20, 2019 at 11:27
  • @Cez Because that is the tool with which third parties build their repos, such as the missing repo in the question. Nov 20, 2019 at 17:14
  • OK, but you can get that error other ways too. Right now, there is still no 4.0 package for el8, but there is a 4.2 one
    – cEz
    Nov 20, 2019 at 17:30
  • @Cez That's another issue entirely, though. Nov 20, 2019 at 17:34
  • sudo dnf makecache --disablerepo="*" --enablerepo=mongodb-org-4.0 MongoDB Repository 4.0 354 B/s | 390 B 00:01 Error: Failed to synchronize cache for repo 'mongodb-org-4.0' seems like it produces the error as per OP
    – cEz
    Nov 20, 2019 at 17:39
1

Some other possible reasons may be, url is wrong or repo url is not for RHEL8 at all. If that is not the case try to clean the yum cache(may be corrupted).

Running in verbose mode to make the cache may show you something, e.g.

sudo dnf makecache --verbose --disablerepo="*" --enablerepo=mongodb-org-4.0
1

Whilst the accepted answer by Michael Hampton may have been accurate at the time of answering, EPEL has been available for EL8 for a while:

$ sudo rpm -q --changelog epel-release | awk '/8-7/,/8-1/'
* Thu Oct 10 2019 Stephen Smoogen <[email protected]> - 8-7.el8
- Remove failovermethod from EPEL8 tree. It is no longer needed.

* Mon Sep 16 2019 Stephen Smoogen <[email protected]> - 8-6.el8
- Change gpg key to use -8 versus -$releasever. This fixes bash problem

* Tue Aug 06 2019 Stephen Smoogen <[email protected]> - 8-5.el8
- Fix playground release to have os/ on its name [Kevin Fenzi]
- Make sure all values of $release are $releasever

* Thu Aug 01 2019 Pablo Greco <[email protected]> - 8-4
- Use the correct var for dnf to expand
- Update playground source url
- Remove epel-modules repo
- Use https in baseurl

* Thu Aug 01 2019 Stephen Smoogen <[email protected]> - 8-3
- Make sure that the key name is named correctly

* Thu Aug 01 2019 Stephen Smoogen <[email protected]> - 8-2
- Make baseurl paths match dl.fedoraproject.org
- Add draft of epel8 packaging
- Fix docs

* Thu Jul 18 2019 Stephen Smoogen <[email protected]> - 8-1

If you use the MongoDB YUM repository then you will have 4.2 available for EL8 (note this adds in version numbering to the repo ID):

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

[mongodb-org-4.0]                                                                               
name=MongoDB Repository 4.0                                                                     
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/                 
gpgcheck=1                                                                                                        
enabled=0                                                                                                         
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

If you attempt to use the repo file with EL8 for 4.0 then you will see:

$ sudo dnf makecache --disablerepo="*" --enablerepo=mongodb-org-4.0
MongoDB Repository 4.0                                                                                                                                                             369  B/s | 390  B     00:01    
Error: Failed to synchronize cache for repo 'mongodb-org-4.0'

Using verbose mode you can see a hint of what is wrong (there is no 4.0 repo for EL8):

$ sudo dnf makecache --verbose --disablerepo="*" --enablerepo=mongodb-org-4.0
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.0.9
cachedir: /var/cache/dnf
Unknown configuration value: failovermethod=priority in /etc/yum.repos.d/puppet5.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Making cache files for all metadata files.
mongodb-org-4.0: has expired and will be refreshed.
repo: downloading from remote: mongodb-org-4.0
MongoDB Repository 4.0                                                                                                                                                             367  B/s | 390  B     00:01    
Cannot download 'https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.0/x86_64/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
Error: Failed to synchronize cache for repo 'mongodb-org-4.0'

According to MongoDB's Jira (SERVER-37772), marked as resolved at Jul 29 2019 05:48:23 PM GMT+0000, backports have been requested for EL8 packages for earlier versions on MongoDB, but they are not showing in the repo yet:

Note that from the MongoDB download page, selecting rhel80x64 produces:

So, you can use EL8 with 4.2, or you need to use EL7 for a previous MongoDB release version, at least for now, or you can use Percona's distribution:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .