<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Matheus Alves dos Santos Freitas - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Matheus Alves dos Santos Freitas - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 23 May 2026 14:10:18 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/matheus4lvesfcc/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Install MongoDB with OpenSSL 3 Support on Fedora 39 ]]>
                </title>
                <description>
                    <![CDATA[ In this tutorial, you will learn how to install MongoDB with support for the latest version of OpenSSL on the Fedora Linux operating system.  If you already have it installed, this tutorial will help you fix the mongosh OpenSSL configuration error. T... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-install-mongodb-with-openssl-3-support-on-fedora-39/</link>
                <guid isPermaLink="false">66b9ef18fbdfcf519c5e1a99</guid>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ MongoDB ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Matheus Alves dos Santos Freitas ]]>
                </dc:creator>
                <pubDate>Mon, 11 Dec 2023 18:52:50 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/Post-image.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this tutorial, you will learn how to install MongoDB with support for the latest version of OpenSSL on the Fedora Linux operating system. </p>
<p>If you already have it installed, this tutorial will help you fix the mongosh OpenSSL configuration error.</p>
<p>To follow along, you will need a terminal with root access and an internet connection to download the packages.</p>
<p>Here's what we'll cover:</p>
<ul>
<li><a class="post-section-overview" href="#heading-the-core-of-the-problem-1">The Core of the Problem</a></li>
<li><a class="post-section-overview" href="#heading-workaround-for-installing-mongodb-1">Workaround for Installing MongoDB</a></li>
<li><a class="post-section-overview" href="#heading-understanding-the-mongosh-openssl-error">Understanding the Mongosh OpenSSL Error</a></li>
<li><a class="post-section-overview" href="#work-around-for-fixing-the-error-on-existing-mongodb-installations">Work-Around for Fixing the Error on Existing MongoDB Installations</a></li>
<li><a class="post-section-overview" href="#heading-how-to-install-mongodb-with-openssl-3-support-from-scratch">How to Install MongoDB with OpenSSL 3 Support From Scratch</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-the-core-of-the-problem">The Core of the Problem</h2>
<p>If you visit the official MongoDB documentation and look for instructions on how to install it on the Fedora Workstation OS, you won't find anything. But you can find instructions on how to install it on the Red Hat Enterprise Linux OS.</p>
<blockquote>
<p>"The Fedora project is the upstream, community distro of Red Hat® Enterprise Linux." (<a target="_blank" href="https://www.redhat.com/en/topics/linux/fedora-vs-red-hat-enterprise-linux">Source: Red Hat</a>)</p>
</blockquote>
<p>In other words, Fedora and Red Hat Enterprise Linux are very similar.</p>
<blockquote>
<p>"The primary difference between community and enterprise distros is who decides what’s important to users. A community distro’s direction is set by contributors, who choose and maintain packages from the wide variety of open source options. The direction of an enterprise distro is set by a vendor, based on the needs of their customers." (<a target="_blank" href="https://www.redhat.com/en/topics/linux/fedora-vs-red-hat-enterprise-linux">Source: Red Hat</a>)</p>
</blockquote>
<p>Now, you may think that you can install MongoDB on Fedora by following the tutorial for installing it on Red Hat. By the way, thattutorial is available at <a target="_blank" href="https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/#install-mongodb-community-edition-on-red-hat-or-centos">Install MongoDB Community Edition on Red Hat or CentOS</a>.</p>
<p>The problem is that it will not work – and to prove that, I will try to install it and show you what happens.</p>
<p><strong>Note</strong>: I use the Node.js MongoDB Driver which, at the time I am writing this article, does not support the current MongoDB version (7.0). So I will try to install its previous version (6.0).</p>
<p>The required steps to install MongoDB on Fedora are as follows:</p>
<ol>
<li>Configure the package management system</li>
<li>Install the MongoDB packages</li>
</ol>
<p>To perform the first step, open your terminal, get root access, and type the following:</p>
<pre><code class="lang-text"># touch /etc/yum.repos.d/mongodb-org-6.0.repo
</code></pre>
<p>Now, open the file using your preferred text editor (I am using the Gnome Text Editor, because it's shipped with Fedora):</p>
<pre><code class="lang-text"># gnome-text-editor /etc/yum.repos.d/mongodb-org-6.0.repo
</code></pre>
<p>And paste in these lines:</p>
<pre><code class="lang-text">[mongodb-org-6.0]
name=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
</code></pre>
<p>Save the file and close it.</p>
<p>The second step can be performed by running the following command:</p>
<pre><code class="lang-text"># dnf install -y mongodb-org
</code></pre>
<p>After running the command you will get an error similar to this:</p>
<pre><code class="lang-text">Fedora 39 - x86_64 - Updates                     34 kB/s |  46 kB     00:01    
MongoDB Repository                               63  B/s | 391  B     00:06    
Errors during 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 download metadata for repo 'mongodb-org-6.0': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Ignoring repositories: mongodb-org-6.0
Last metadata expiration check: 0:00:02 ago on Thu 30 Nov 2023 09:15:21 AM -03.
No match for argument: mongodb-org
Error: Unable to find a match: mongodb-org
</code></pre>
<p>This is a <code>404</code> error, which means you need to change the <code>baseurl</code> of the file that configures the repo.</p>
<p>If you try to open the <code>baseurl</code> in your browser you will get a <code>404</code> error as well:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-from-2023-11-30-17-05-28.png" alt="Screenshot of the 404 error you will get if you visit the baseurl on a browser." width="600" height="400" loading="lazy">
<em><code>baseurl</code> <code>404</code> error</em></p>
<p>This is the core of the problem.</p>
<h2 id="heading-workaround-for-installing-mongodb">Workaround for Installing MongoDB</h2>
<p>You can infer that in order to fix the problem you need to change the value assigned to the <code>baseurl</code>. The question becomes: what is the URL that leads to the page containing the packages?</p>
<p>The answers is offered by the official MongoDB documentation:</p>
<blockquote>
<p>"You can also download the <code>.rpm</code> files directly from the MongoDB repository. Downloads are organized by Red Hat / CentOS version (e.g. <code>7</code>), then MongoDB release version (e.g. <code>6.0</code>), then architecture (e.g. <code>x86_64</code>)." (<a target="_blank" href="https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-red-hat/#install-mongodb-community-edition">Source: MongoDB</a>)</p>
</blockquote>
<p>Now, visiting the <a target="_blank" href="https://repo.mongodb.org/yum/redhat/">MongoDB repository</a> will take you to this page:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-from-2023-11-30-17-20-57.png" alt="Screenshot of the MongoDB repository page. The title of the page reads &quot;Index of RedHat&quot;. The page lists repositories with old versions of MongoDB, as well as repositories with newer versions for different RedHat OS versions." width="600" height="400" loading="lazy">
<em>MongoDB repository page</em></p>
<p>From here I navigated to the proper repo, selecting my preferred MongoDB version and system architecture. You should do the same.</p>
<p>I ended up with the following URL:</p>
<pre><code class="lang-text">https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/6.0/x86_64/RPMS/
</code></pre>
<p>This URL leads to the repo where the packages of MongoDB 6.0 can be found for systems based on an x86_64 architecture.</p>
<p>This is what I found there:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-from-2023-11-30-17-27-37.png" alt="Screenshot of the MongoDB repo that contains the packages of its sixth version for systems based on an x86_64 architecture." width="600" height="400" loading="lazy">
_MongoDB 6.0 packages for x86<em>64 systems</em></p>
<p>After being sure the packages could be found, I updated the file that configures the repo. But the <code>baseurl</code> should point to the parent of <code>RPMS</code> directory, which resulted in the following URL:</p>
<pre><code class="lang-text">https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/6.0/x86_64/
</code></pre>
<p>I ran:</p>
<pre><code class="lang-text"># gnome-text-editor /etc/yum.repos.d/mongodb-org-6.0.repo
</code></pre>
<p>Updated the <code>baseurl</code>:</p>
<pre><code class="lang-text">[mongodb-org-6.0]
name=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
</code></pre>
<p>And installed the packages:</p>
<pre><code class="lang-text"># dnf install -y mongodb-org
</code></pre>
<p>These are the packages that that were installed:</p>
<pre><code class="lang-text">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
</code></pre>
<h2 id="heading-understanding-the-mongosh-openssl-error">Understanding the Mongosh OpenSSL Error</h2>
<p>To confirm the installation of the database server, run this command:</p>
<pre><code class="lang-text"># mongod --version
</code></pre>
<p>You will get a message similar to this:</p>
<pre><code class="lang-text">db version v6.0.12
Build Info: {
    "version": "6.0.12",
    "gitVersion": "21e6e8e11a45dfbdb7ca6cf95fa8c5f859e2b118",
    "openSSLVersion": "OpenSSL 3.1.1 30 May 2023",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "rhel90",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}
</code></pre>
<p>To confirm the installation of the shell, run this command:</p>
<pre><code class="lang-text"># mongosh --version
</code></pre>
<p>And this is the message you will get:</p>
<pre><code class="lang-text">mongosh: OpenSSL configuration error:
00899523A67F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:../deps/openssl/openssl/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes
</code></pre>
<p>Oops! There was an error.</p>
<p>I checked the installed OpenSSL version by running this command:</p>
<pre><code class="lang-text"># openssl version
</code></pre>
<p>And got this result:</p>
<pre><code class="lang-text">OpenSSL 3.1.1 30 May 2023 (Library: OpenSSL 3.1.1 30 May 2023)
</code></pre>
<p>With that, I discarded a possible mismatch between the installed and the required OpenSSL versions.</p>
<p>After some research, I discovered that:</p>
<blockquote>
<p>"There are two new PPA packages created from the mongosh source: In addition to mongodb-mongosh, mongodb-mongosh-shared-openssl11 and mongodb-mongosh-shared-openssl3 are also provided. These link against a system-installed dynamic OpenSSL library." (<a target="_blank" href="https://jira.mongodb.org/browse/MONGOSH-1231?jql=text%20~%20%22mongodb-mongosh-shared-openssl3%22">Source: MongoDB Jira</a>)</p>
</blockquote>
<p>When I looked at the packages that were installed, I saw the <em>mongodb-mongosh</em> package. So I knew I need to replace it with the <em>mongodb-mongosh-shared-openssl3</em>.</p>
<p>By the way,</p>
<blockquote>
<p>"The package name denotes that it’s the cut of mongosh compiled against openssl3." ― Jack Woehr</p>
</blockquote>
<p>Now that we understand the problem, let's fix it.</p>
<h2 id="heading-workaround-for-fixing-the-error-on-existing-mongodb-installations">Workaround for Fixing the Error on Existing MongoDB Installations</h2>
<p>If you already have MongoDB installed, these are the steps required to fix the problem:</p>
<ol>
<li>Stop MongoDB</li>
<li>Remove the <em>mongodb-org</em> package</li>
<li>Remove the <em>mongodb-mongosh</em> package</li>
<li>Install the <em>mongodb-mongosh-shared-openssl3</em> package</li>
<li>Enable MongoDB</li>
</ol>
<p>You have to perform these steps in the correct order. If you try to install the <em>mongodb-mongosh-shared-openssl3</em> package without uninstalling the <em>mongodb-mongosh</em> package first, you will get a conflict error:</p>
<pre><code class="lang-text">Error: Transaction test error:
  file /usr/bin/mongosh from install of mongodb-mongosh-shared-openssl3-2.1.0-1.el8.x86_64 conflicts with file from package mongodb-mongosh-2.1.0-1.el8.x86_64
</code></pre>
<p>If you try to uninstall the <em>mongodb-mongosh</em> package without uninstalling the <em>mongodb-org</em> package first, you will get a dependency error:</p>
<pre><code class="lang-text">error: Failed dependencies:
    mongodb-mongosh is needed by (installed) mongodb-org-6.0.12-1.el9.x86_64
</code></pre>
<p>To stop MongoDB, run this command:</p>
<pre><code># systemctl stop mongod
</code></pre><p><strong>Note</strong>: The command will output nothing if everything goes well.</p>
<p>To remove the <em>mongodb-org</em> and the <em>mongodb-mongosh</em> packages, run:</p>
<pre><code class="lang-text"># rpm -e mongodb-org mongodb-mongosh
</code></pre>
<p><strong>Note</strong>: I am not using the <code>dnf</code> command as it would remove <em>mongodb-org</em> and all of its dependencies.</p>
<p>You can also confirm that only the two packages were removed by running:</p>
<pre><code class="lang-text"># rpm -qa | grep mongodb-*
</code></pre>
<p>The output should be:</p>
<pre><code class="lang-text">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
</code></pre>
<p>To install the <em>mongodb-org</em> and the <em>mongodb-mongosh-shared-openssl3</em> packages, run:</p>
<pre><code># dnf install -y mongodb-org mongodb-mongosh-shared-openssl3
</code></pre><p>Finally, to start MongoDB with your operating system, run:</p>
<pre><code class="lang-text"># systemctl start mongod
</code></pre>
<p>If you want to be sure the workaround worked, run:</p>
<pre><code class="lang-text"># mongod --version
</code></pre>
<p>And then this:</p>
<pre><code class="lang-text"># mongosh --version
</code></pre>
<p>Now, if you are concerned about destroying data, know that logs and databases will only be removed if you run the following commands:</p>
<pre><code class="lang-text"># rm -r /var/log/mongodb
</code></pre>
<p>And this:</p>
<pre><code class="lang-text"># rm -r /var/lib/mongo
</code></pre>
<p>One more thing: if you run <code>mongosh</code> and get the following error:</p>
<pre><code class="lang-text">MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
</code></pre>
<p>restart your machine. It will solve the problem.</p>
<h2 id="heading-how-to-install-mongodb-with-openssl-3-support-from-scratch">How to Install MongoDB with OpenSSL 3 Support From Scratch</h2>
<p>If you are installing MongoDB for the first time, you only have to perform two steps:</p>
<ol>
<li>Configure the package management system</li>
<li>Install the MongoDB packages specifying them individually</li>
</ol>
<p>You can perform the first step by following what I did on the <a class="post-section-overview" href="#heading-the-core-of-the-problem-1">The Core of the Problem</a> and <a class="post-section-overview" href="#heading-workaround-for-installing-mongodb-1">Workaround for Installing MongoDB</a> sections of this article.</p>
<p>However, to install the right packages you should replace this command:</p>
<pre><code class="lang-text"># dnf install -y mongodb-org
</code></pre>
<p>with this one:</p>
<pre><code class="lang-text"># dnf install -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
</code></pre>
<p>You can confirm that all packages have been installed by running:</p>
<pre><code class="lang-text"># rpm -qa | grep mongodb-*
</code></pre>
<p>Which should output something similar to this:</p>
<pre><code class="lang-text">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
</code></pre>
<p>Keep in mind that the previous command will only output <em>mongodb-related</em> packages. To confirm OpenSSL installation, run:</p>
<pre><code class="lang-text"># openssl version
</code></pre>
<p>You should get something like this:</p>
<pre><code class="lang-text">OpenSSL 3.1.1 30 May 2023 (Library: OpenSSL 3.1.1 30 May 2023)
</code></pre>
<p>The packages will be updated with your system as you can see in the screenshot below.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-from-2023-12-05-01-26-14.png" alt="Screenshot of the mongodb-mongosh-shared-openssl3 package being automatically updated with the operating system." width="600" height="400" loading="lazy">
<em><code>mongodb-mongosh-shared-openssl3</code> update</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Package updates are important, because they bring in new functionality and/or increase applications security. But they can also cause headaches when they case errors like the one we dealt with in this article.</p>
<p>Although you might be tempted to roll back the update to get rid of the problem, don't do that. Try to solve it instead.</p>
<p>Paying attention to error messages, reading official documentation, and researching the Web will most likely be enough for solving the majority of the problems you come across.</p>
<p>Besides, knowing how different commands affect the way packages are installed/uninstalled on your operating system can salve you time and data (if you are on a metered connection).</p>
<p>If this article was useful to you, bookmark it and share it with your friends. You can can also follow me on <a target="_blank" href="https://twitter.com/matheus4lvesfcc">Twitter</a>.</p>
<p>See you in the next one!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
