02-18-2020, 12:41 PM
How to get MongoDB Server on Fedora
<div><p>Mongo (from “humongous”) is a high-performance, open source, schema-free document-oriented database, which is one of the most favorite so-called <a href="https://en.wikipedia.org/wiki/NoSQL">NoSQL</a> databases. It uses JSON as a document format, and it is designed to be scalable and replicable across multiple server nodes.</p>
<p> <span id="more-30452"></span> </p>
<h2>Story about license change</h2>
<p>It’s been more than a year when the upstream MongoDB decided to change the license of the Server code. The previous license was GNU Affero General Public License v3 (AGPLv3). However, upstream wrote a new license designed to make companies running MongoDB as a service contribute back to the community. The new license is called Server Side Public License (SSPLv1) and more about this step and its rationale can be found at <a href="https://www.mongodb.com/licensing/server-side-public-license/faq">MongoDB SSPL FAQ</a>.</p>
<p>Fedora has always included only free (as in “freedom”) software. When SSPL was released, Fedora <a href="https://lists.fedoraproject.org/archives/list/[email protected]/thread/IQIOBOGWJ247JGKX2WD6N27TZNZZNM6C/">determined</a> that it is not a free software license in this meaning. All versions of MongoDB released before the license change date (October 2018) could be potentially kept in Fedora, but never updating the packages in the future would bring security issues. Hence the Fedora community decided to <a href="https://fedoraproject.org/wiki/Changes/MongoDB_Removal">remove the MongoDB server</a> entirely, starting Fedora 30.</p>
<h2>What options are left to developers?</h2>
<p>Well, alternatives exist, for example PostgreSQL also supports JSON in the recent versions, and it can be used in cases when MongoDB cannot be used any more. With JSONB type, indexing works very well in PostgreSQL with performance comparable with MongoDB, and even without any compromises from ACID.</p>
<p>The technical reasons that a developer may have chosen MongoDB did not change with the license, so many still want to use it. What is important to realize is that the SSPL license was only changed to the MongoDB server. There are other projects that MongoDB upstream develops, like MongoDB tools, C and C++ client libraries and connectors for various dynamic languages, that are used on the client side (in applications that want to communicate with the server over the network). Since the license is kept free (Apache License mostly) for those packages, they are staying in Fedora repositories, so users can use them for the application development.</p>
<p>The only change is really the server package itself, which was removed entirely from Fedora repos. Let’s see what a Fedora user can do to get the non-free packages.</p>
<h2>How to install MongoDB server from the upstream</h2>
<p>When Fedora users want to install a MongoDB server, they need to approach MongoDB upstream directly. However, the upstream does not ship RPM packages for Fedora itself. Instead, the MongoDB server is either available as the source tarball, that users need to compile themselves (which requires some developer knowledge), or Fedora user can use some compatible packages. From the compatible options, the best choice is the RHEL-8 RPMs at this point. The following steps describe, how to install them and how to start the daemon.</p>
<h3>1. Create a repository with upstream RPMs (RHEL-8 builds)</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo cat > /etc/yum.repos.d/mongodb.repo &lt;&lt;EOF<br />
[mongodb-upstream]<br />
name=MongoDB Upstream Repository<br />
baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/<br />
gpgcheck=1<br />
enabled=1<br />
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc<br />
EOF</div></div> </pre>
</p>
<h3>2. Install the meta-package, that pulls the server and tools packages</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo dnf install mongodb-org<br />
&lt;snipped><br />
Installed:<br />
mongodb-org-4.2.3-1.el8.x86_64 mongodb-org-mongos-4.2.3-1.el8.x86_64 <br />
mongodb-org-server-4.2.3-1.el8.x86_64 mongodb-org-shell-4.2.3-1.el8.x86_64 <br />
mongodb-org-tools-4.2.3-1.el8.x86_64 <br />
<br />
Complete!</div></div> </pre>
<h3>3. Start the MongoDB daemon</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo systemctl status mongod<br />
● mongod.service - MongoDB Database Server<br />
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)<br />
Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago<br />
Docs: https://docs.mongodb.org/manual<br />
Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)<br />
Main PID: 15773 (mongod)<br />
Memory: 70.4M<br />
CPU: 611ms<br />
CGroup: /system.slice/mongod.service<br />
└─15773 /usr/bin/mongod -f /etc/mongod.conf</div></div> </pre>
<h3>4. Verify that the server runs by connecting to it from the mongo shell</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ mongo<br />
MongoDB shell version v4.2.3<br />
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb<br />
Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") }<br />
MongoDB server version: 4.2.3<br />
Welcome to the MongoDB shell.<br />
For interactive help, type "help".<br />
For more comprehensive documentation, see<br />
http://docs.mongodb.org/<br />
---<br />
<br />
> _</div></div> </pre>
<p>That’s all. As you see, the RHEL-8 packages are pretty compatible and it should stay that way for as long as the Fedora packages remain compatible with what’s in RHEL-8. Just be careful that you comply with the SSPLv1 license in your use.</p>
</div>
https://www.sickgaming.net/blog/2020/02/...on-fedora/
<div><p>Mongo (from “humongous”) is a high-performance, open source, schema-free document-oriented database, which is one of the most favorite so-called <a href="https://en.wikipedia.org/wiki/NoSQL">NoSQL</a> databases. It uses JSON as a document format, and it is designed to be scalable and replicable across multiple server nodes.</p>
<p> <span id="more-30452"></span> </p>
<h2>Story about license change</h2>
<p>It’s been more than a year when the upstream MongoDB decided to change the license of the Server code. The previous license was GNU Affero General Public License v3 (AGPLv3). However, upstream wrote a new license designed to make companies running MongoDB as a service contribute back to the community. The new license is called Server Side Public License (SSPLv1) and more about this step and its rationale can be found at <a href="https://www.mongodb.com/licensing/server-side-public-license/faq">MongoDB SSPL FAQ</a>.</p>
<p>Fedora has always included only free (as in “freedom”) software. When SSPL was released, Fedora <a href="https://lists.fedoraproject.org/archives/list/[email protected]/thread/IQIOBOGWJ247JGKX2WD6N27TZNZZNM6C/">determined</a> that it is not a free software license in this meaning. All versions of MongoDB released before the license change date (October 2018) could be potentially kept in Fedora, but never updating the packages in the future would bring security issues. Hence the Fedora community decided to <a href="https://fedoraproject.org/wiki/Changes/MongoDB_Removal">remove the MongoDB server</a> entirely, starting Fedora 30.</p>
<h2>What options are left to developers?</h2>
<p>Well, alternatives exist, for example PostgreSQL also supports JSON in the recent versions, and it can be used in cases when MongoDB cannot be used any more. With JSONB type, indexing works very well in PostgreSQL with performance comparable with MongoDB, and even without any compromises from ACID.</p>
<p>The technical reasons that a developer may have chosen MongoDB did not change with the license, so many still want to use it. What is important to realize is that the SSPL license was only changed to the MongoDB server. There are other projects that MongoDB upstream develops, like MongoDB tools, C and C++ client libraries and connectors for various dynamic languages, that are used on the client side (in applications that want to communicate with the server over the network). Since the license is kept free (Apache License mostly) for those packages, they are staying in Fedora repositories, so users can use them for the application development.</p>
<p>The only change is really the server package itself, which was removed entirely from Fedora repos. Let’s see what a Fedora user can do to get the non-free packages.</p>
<h2>How to install MongoDB server from the upstream</h2>
<p>When Fedora users want to install a MongoDB server, they need to approach MongoDB upstream directly. However, the upstream does not ship RPM packages for Fedora itself. Instead, the MongoDB server is either available as the source tarball, that users need to compile themselves (which requires some developer knowledge), or Fedora user can use some compatible packages. From the compatible options, the best choice is the RHEL-8 RPMs at this point. The following steps describe, how to install them and how to start the daemon.</p>
<h3>1. Create a repository with upstream RPMs (RHEL-8 builds)</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo cat > /etc/yum.repos.d/mongodb.repo &lt;&lt;EOF<br />
[mongodb-upstream]<br />
name=MongoDB Upstream Repository<br />
baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/<br />
gpgcheck=1<br />
enabled=1<br />
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc<br />
EOF</div></div> </pre>
</p>
<h3>2. Install the meta-package, that pulls the server and tools packages</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo dnf install mongodb-org<br />
&lt;snipped><br />
Installed:<br />
mongodb-org-4.2.3-1.el8.x86_64 mongodb-org-mongos-4.2.3-1.el8.x86_64 <br />
mongodb-org-server-4.2.3-1.el8.x86_64 mongodb-org-shell-4.2.3-1.el8.x86_64 <br />
mongodb-org-tools-4.2.3-1.el8.x86_64 <br />
<br />
Complete!</div></div> </pre>
<h3>3. Start the MongoDB daemon</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo systemctl status mongod<br />
● mongod.service - MongoDB Database Server<br />
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)<br />
Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago<br />
Docs: https://docs.mongodb.org/manual<br />
Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)<br />
Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)<br />
Main PID: 15773 (mongod)<br />
Memory: 70.4M<br />
CPU: 611ms<br />
CGroup: /system.slice/mongod.service<br />
└─15773 /usr/bin/mongod -f /etc/mongod.conf</div></div> </pre>
<h3>4. Verify that the server runs by connecting to it from the mongo shell</h3>
<pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ mongo<br />
MongoDB shell version v4.2.3<br />
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb<br />
Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") }<br />
MongoDB server version: 4.2.3<br />
Welcome to the MongoDB shell.<br />
For interactive help, type "help".<br />
For more comprehensive documentation, see<br />
http://docs.mongodb.org/<br />
---<br />
<br />
> _</div></div> </pre>
<p>That’s all. As you see, the RHEL-8 packages are pretty compatible and it should stay that way for as long as the Fedora packages remain compatible with what’s in RHEL-8. Just be careful that you comply with the SSPLv1 license in your use.</p>
</div>
https://www.sickgaming.net/blog/2020/02/...on-fedora/