Home » How to Install MongoDB with OpenSSL 3 Support on Fedora 39

How to Install MongoDB with OpenSSL 3 Support on Fedora 39

by Icecream
0 comment

In this tutorial, you’ll learn to set up MongoDB with assist for the most recent model of OpenSSL on the Fedora Linux working system.

If you have already got it put in, this tutorial will assist you repair the mongosh OpenSSL configuration error.

To comply with alongside, you will want a terminal with root entry and an web connection to obtain the packages.

Here’s what we’ll cowl:

The Core of the Problem

If you go to the official MongoDB documentation and search for directions on find out how to set up it on the Fedora Workstation OS, you will not discover something. But yow will discover directions on find out how to set up it on the Red Hat Enterprise Linux OS.

“The Fedora undertaking is the upstream, group distro of Red Hat® Enterprise Linux.” (Source: Red Hat)

In different phrases, Fedora and Red Hat Enterprise Linux are very related.

“The main distinction between group and enterprise distros is who decides what’s essential to customers. A group distro’s course is ready by contributors, who select and preserve packages from the big variety of open supply choices. The course of an enterprise distro is ready by a vendor, based mostly on the wants of their prospects.” (Source: Red Hat)

Now, chances are you’ll suppose you can set up MongoDB on Fedora by following the tutorial for putting in it on Red Hat. By the way in which, thattutorial is offered at Install MongoDB Community Edition on Red Hat or CentOS.

The drawback is that it’s going to not work – and to show that, I’ll attempt to set up it and present you what occurs.

Note: I take advantage of the Node.js MongoDB Driver which, on the time I’m writing this text, doesn’t assist the present MongoDB model (7.0). So I’ll attempt to set up its earlier model (6.0).

The required steps to put in MongoDB on Fedora are as follows:

  1. Configure the package deal administration system
  2. Install the MongoDB packages

To carry out step one, open your terminal, get root entry, and kind the next:

# contact /and so forth/yum.repos.d/mongodb-org-6.0.repo

Now, open the file utilizing your most popular textual content editor (I’m utilizing the Gnome Text Editor, as a result of it is shipped with Fedora):

# gnome-text-editor /and so forth/yum.repos.d/mongodb-org-6.0.repo

And paste in these traces:

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

Save the file and shut it.

The second step might be carried out by working the next command:

# dnf set up -y mongodb-org

After working the command you’ll get an error much like this:

Fedora 39 - x86_64 - Updates                     34 kB/s |  46 kB     00:01    
MongoDB Repository                               63  B/s | 391  B     00:06    
Errors throughout downloading metadata for repository 'mongodb-org-6.0':
  - Status code: 404 for https://repo.mongodb.org/yum/redhat/39/mongodb-org/6.0/x86_64/repodata/repomd.xml (IP: 65.8.214.17)
Error: Failed to obtain metadata for repo 'mongodb-org-6.0': Cannot obtain repomd.xml: Cannot obtain repodata/repomd.xml: All mirrors have been tried
Ignoring repositories: mongodb-org-6.0
Last metadata expiration test: 0:00:02 in the past on Thu 30 Nov 2023 09:15:21 AM -03.
No match for argument: mongodb-org
Error: Unable to discover a match: mongodb-org

This is a 404 error, which suggests you should change the baseurl of the file that configures the repo.

If you attempt to open the baseurl in your browser you’ll get a 404 error as properly:

Screenshot of the 404 error you will get if you visit the baseurl on a browser.
baseurl 404 error

This is the core of the issue.

Workaround for Installing MongoDB

You can infer that with the intention to repair the issue you should change the worth assigned to the baseurl. The query turns into: what’s the URL that results in the web page containing the packages?

The solutions is obtainable by the official MongoDB documentation:

“You also can obtain the .rpm recordsdata instantly from the MongoDB repository. Downloads are organized by Red Hat / CentOS model (e.g. 7), then MongoDB launch model (e.g. 6.0), then structure (e.g. x86_64).” (Source: MongoDB)

Now, visiting the MongoDB repository will take you to this web page:

Screenshot of the MongoDB repository page. The title of the page reads "Index of RedHat". The page lists repositories with old versions of MongoDB, as well as repositories with newer versions for different RedHat OS versions.
MongoDB repository web page

From right here I navigated to the right repo, choosing my most popular MongoDB model and system structure. You ought to do the identical.

I ended up with the next URL:

https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/6.0/x86_64/RPMS/

This URL results in the repo the place the packages of MongoDB 6.0 might be discovered for programs based mostly on an x86_64 structure.

This is what I discovered there:

Screenshot of the MongoDB repo that contains the packages of its sixth version for systems based on an x86_64 architecture.
MongoDB 6.0 packages for x86_64 programs

After being certain the packages might be discovered, I up to date the file that configures the repo. But the baseurl ought to level to the dad or mum of RPMS listing, which resulted within the following URL:

https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/6.0/x86_64/

I ran:

# gnome-text-editor /and so forth/yum.repos.d/mongodb-org-6.0.repo

Updated the baseurl:

[mongodb-org-6.0]
identify=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc

And put in the packages:

# dnf set up -y mongodb-org

These are the packages that that have been put in:

Installed:
  mongodb-database-tools-100.9.3-1.x86_64                                       
  mongodb-mongosh-2.1.0-1.el8.x86_64                                           
  mongodb-org-6.0.12-1.el9.x86_64                                               
  mongodb-org-database-6.0.12-1.el9.x86_64                                     
  mongodb-org-database-tools-extra-6.0.12-1.el9.x86_64                         
  mongodb-org-mongos-6.0.12-1.el9.x86_64                                       
  mongodb-org-server-6.0.12-1.el9.x86_64                                       
  mongodb-org-tools-6.0.12-1.el9.x86_64                                         
  openssl-1:3.1.1-4.fc39.x86_64 

Understanding the Mongosh OpenSSL Error

To affirm the set up of the database server, run this command:

# mongod --version

You will get a message much like this:

db model v6.0.12
Build Info: {
    "model": "6.0.12",
    "gitVersion": "21e6e8e11a45dfbdb7ca6cf95fa8c5f859e2b118",
    "openSSLVersion": "OpenSSL 3.1.1 30 May 2023",
    "modules": [],
    "allocator": "tcmalloc",
    "setting": {
        "distmod": "rhel90",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

To affirm the set up of the shell, run this command:

# mongosh --version

And that is the message you’ll get:

mongosh: OpenSSL configuration error:
00899523A67F0000:error:030000A9:digital envelope routines:alg_module_init:unknown choice:../deps/openssl/openssl/crypto/evp/evp_cnf.c:61:identify=rh-allow-sha1-signatures, worth=sure

Oops! There was an error.

I checked the put in OpenSSL model by working this command:

# openssl model

And bought this end result:

OpenSSL 3.1.1 30 May 2023 (Library: OpenSSL 3.1.1 30 May 2023)

With that, I discarded a potential mismatch between the put in and the required OpenSSL variations.

After some analysis, I found that:

“There are two new PPA packages created from the mongosh supply: In addition to mongodb-mongosh, mongodb-mongosh-shared-openssl11 and mongodb-mongosh-shared-openssl3 are additionally offered. These hyperlink towards a system-installed dynamic OpenSSL library.” (Source: MongoDB Jira)

When I appeared on the packages that have been put in, I noticed the mongodb-mongosh package deal. So I knew I would like to exchange it with the mongodb-mongosh-shared-openssl3.

By the way in which,

“The package deal identify denotes that it’s the minimize of mongosh compiled towards openssl3.” ― Jack Woehr

Now that we perceive the issue, let’s repair it.

Workaround for Fixing the Error on Existing MongoDB Installations

If you have already got MongoDB put in, these are the steps required to repair the issue:

  1. Stop MongoDB
  2. Remove the mongodb-org package deal
  3. Remove the mongodb-mongosh package deal
  4. Install the mongodb-mongosh-shared-openssl3 package deal
  5. Enable MongoDB

You must carry out these steps within the right order. If you attempt to set up the mongodb-mongosh-shared-openssl3 package deal with out uninstalling the mongodb-mongosh package deal first, you’ll get a battle error:

Error: Transaction take a look at error:
  file /usr/bin/mongosh from set up of mongodb-mongosh-shared-openssl3-2.1.0-1.el8.x86_64 conflicts with file from package deal mongodb-mongosh-2.1.0-1.el8.x86_64

If you attempt to uninstall the mongodb-mongosh package deal with out uninstalling the mongodb-org package deal first, you’ll get a dependency error:

error: Failed dependencies:
	mongodb-mongosh is required by (put in) mongodb-org-6.0.12-1.el9.x86_64

To cease MongoDB, run this command:

# systemctl cease mongod

Note: The command will output nothing if every part goes properly.

To take away the mongodb-org and the mongodb-mongosh packages, run:

# rpm -e mongodb-org mongodb-mongosh

Note: I’m not utilizing the dnf command as it might take away mongodb-org and all of its dependencies.

You also can affirm that solely the 2 packages have been eliminated by working:

# rpm -qa | grep mongodb-*

The output ought to be:

mongodb-org-database-tools-extra-6.0.12-1.el9.x86_64
mongodb-database-tools-100.9.3-1.x86_64
mongodb-org-tools-6.0.12-1.el9.x86_64
mongodb-org-server-6.0.12-1.el9.x86_64
mongodb-org-mongos-6.0.12-1.el9.x86_64
mongodb-org-database-6.0.12-1.el9.x86_64

To set up the mongodb-org and the mongodb-mongosh-shared-openssl3 packages, run:

# dnf set up -y mongodb-org mongodb-mongosh-shared-openssl3

Finally, to begin MongoDB along with your working system, run:

# systemctl begin mongod

If you wish to make sure the workaround labored, run:

# mongod --version

And then this:

# mongosh --version

Now, in case you are involved about destroying knowledge, know that logs and databases will solely be eliminated when you run the next instructions:

# rm -r /var/log/mongodb

And this:

# rm -r /var/lib/mongo

One thing more: when you run mongosh and get the next error:

MongoNetworkError: join ECONNREFUSED 127.0.0.1:27017

restart your machine. It will clear up the issue.

How to Install MongoDB with OpenSSL 3 Support From Scratch

If you’re putting in MongoDB for the primary time, you solely must carry out two steps:

  1. Configure the package deal administration system
  2. Install the MongoDB packages specifying them individually

You can carry out step one by following what I did on the The Core of the Problem and Workaround for Installing MongoDB sections of this text.

However, to put in the proper packages you must substitute this command:

# dnf set up -y mongodb-org

with this one:

# dnf set up -y mongodb-org mongodb-mongosh-shared-openssl3 openssl mongodb-org-database-tools-extra mongodb-database-tools mongodb-org-tools mongodb-org-server mongodb-org-mongos mongodb-org-database

You can affirm that each one packages have been put in by working:

# rpm -qa | grep mongodb-*

Which ought to output one thing much like this:

mongodb-org-database-tools-extra-6.0.12-1.el9.x86_64
mongodb-database-tools-100.9.3-1.x86_64
mongodb-org-tools-6.0.12-1.el9.x86_64
mongodb-org-server-6.0.12-1.el9.x86_64
mongodb-org-mongos-6.0.12-1.el9.x86_64
mongodb-org-database-6.0.12-1.el9.x86_64
mongodb-mongosh-shared-openssl3-2.1.0-1.el8.x86_64
mongodb-org-6.0.12-1.el9.x86_64

Keep in thoughts that the earlier command will solely output mongodb-related packages. To affirm OpenSSL set up, run:

# openssl model

You ought to get one thing like this:

OpenSSL 3.1.1 30 May 2023 (Library: OpenSSL 3.1.1 30 May 2023)

The packages shall be up to date along with your system as you may see within the screenshot beneath.

Screenshot of the mongodb-mongosh-shared-openssl3 package being automatically updated with the operating system.
mongodb-mongosh-shared-openssl3 replace

Conclusion

Package updates are essential, as a result of they create in new performance and/or enhance purposes safety. But they will additionally trigger complications after they case errors just like the one we handled on this article.

Although you is perhaps tempted to roll again the replace to do away with the issue, do not do this. Try to unravel it as an alternative.

Paying consideration to error messages, studying official documentation, and researching the Web will probably be sufficient for fixing nearly all of the issues you come throughout.

Besides, understanding how totally different instructions have an effect on the way in which packages are put in/uninstalled in your working system can salve you time and knowledge (in case you are on a metered connection).

If this text was helpful to you, bookmark it and share it with your pals. You can also can comply with me on Twitter.

See you within the subsequent one!

You may also like

Leave a Comment