{"id":11147,"date":"2022-05-16T07:58:24","date_gmt":"2022-05-16T07:58:24","guid":{"rendered":"https:\/\/green.cloud\/docs\/docly-documentation\/content\/how-to-install-mongodb-on-almalinux-8\/"},"modified":"2026-01-19T00:45:46","modified_gmt":"2026-01-19T00:45:46","slug":"how-to-install-mongodb-on-almalinux-8","status":"publish","type":"docs","link":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/","title":{"rendered":"How to install MongoDB on AlmaLinux 8"},"content":{"rendered":"<p>MongoDB is a cross-platform, open-source, and document-based database management system. It facilitates users by providing full index support, high availability, replication, and auto-sharding, etc. As we mentioned earlier, MongoDB is a cross-platform database. However, the data integration process is much easier and comparatively faster than other databases. Due to the free availability of the MongoDB database, it is used in many organizations.<\/p>\n<p>This tutorial will help you to install MongoDB on AlmaLinux 8.<\/p>\n<h2>Step 1: Update the system packages list<\/h2>\n<p>Update the all system packages list by running the following \u2018dnf\u2019 command:<\/p>\n<pre>$ dnf update<\/pre>\n<h2>Step 2: Create MongoDB repository<\/h2>\n<p>MongoDB can not be directly installed on AlmaLinux 8 by using the system default repository. Create a file repository using the &#8221; vi &#8221; text editor to include the MongoDB official repository in your system. To create MongoDB repo, use the following command:<\/p>\n<pre>$ vi \/etc\/yum.repos.d\/mongodb.repo<\/pre>\n<p>Paste the following content in this repository file:<\/p>\n<pre>[mongodb-org-4.4] \nname=MongoDB Repository\nbaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/4.4\/x86_64\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-4.4.asc<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png\" alt=\"\" \/><\/p>\n<p>To check that the MongoDB repository has been added to your system, use the following &#8216;repolist&#8217; command:<\/p>\n<pre>$ dnf repolist<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_5-1.png\" alt=\"\" \/><\/p>\n<h2>Step 3: Install MongoDB on AlmaLinux 8<\/h2>\n<p>You can install the MongoDB by using the following command.<\/p>\n<pre>$ dnf install mongodb-org mongosh<\/pre>\n<p>Now,\u00a0<strong>to prevent unattended upgrades<\/strong>\u00a0with the upgrade of yum, pin the package by adding this package in the exclude directive &#8216;<code>\/etc\/yum.conf<\/code>&#8216;\u00a0 using the following commands:<\/p>\n<pre>$ cat &gt;&gt; \/etc\/yum.conf &lt;&lt; EOF\n&gt; exclude=mongodb-org,mongodb-org-database,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools\nEOF<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_6-1.png\" alt=\"\" \/><\/p>\n<h2>Step 4: Enable MongoDB service<\/h2>\n<p>Once the installation of MongoDB is completed, start and enable service of MongoDB by using the following &#8216;systemctl&#8217; command:<\/p>\n<pre>$ systemctl start mongod\n$ systemctl enable mongod<\/pre>\n<p>After enabling the service, check the running status of mongod service by using the below-mentioned command:<\/p>\n<pre>$ systemctl status mongod<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_7.png\" alt=\"\" \/><\/p>\n<h2>Step 5: Access MongoDB<\/h2>\n<p>You can access the MongoDB shell by running the below-mentioned terminal command:<\/p>\n<pre>$ mongo<\/pre>\n<p>To create a new user with privileges to manage the database, we will need to connect to the admin database first. To do so, run the following command at the prompt.<\/p>\n<pre>&gt; use admin<\/pre>\n<p>Now, create a new user and assigned role, name, and password by running the below-given command:<\/p>\n<pre>&gt; db.createUser(\n{\nuser: \"Greencloud \",\npwd: \"******\",\nroles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } ]\n}\n)<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_1-3.png\" alt=\"\" \/><\/p>\n<p>Press \u2018Enter\u2019 to execute the above database query. You will receive the following output on the terminal screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_2-3.png\" alt=\"\" \/><\/p>\n<p>To check your new user, run the following command.<\/p>\n<pre>&gt; show users<\/pre>\n<p>This command should return a list of users that currently exist in the system, including the newly created user.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-11207 size-full\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_9-2.png\" alt=\"\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, we have guided you to install MongoDB on AlmaLinux 8 system. Now you can start creating databases and adding data to them as per your requirement.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/bit.ly\/3tVkc95\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1024x171.png\" srcset=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1024x171.png 1024w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-300x50.png 300w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-768x128.png 768w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-750x125.png 750w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1140x191.png 1140w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux.png 1280w\" alt=\"\" \/> <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB is a cross-platform, open-source, and document-based database management system. It facilitates users by providing full index support, high availability, replication, and auto-sharding, etc. As we mentioned earlier, MongoDB is a cross-platform database. However, the data integration process is much easier and comparatively faster than other databases. Due to the free availability of the MongoDB [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"parent":17817,"menu_order":482,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-11147","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation\" \/>\n<meta property=\"og:description\" content=\"MongoDB is a cross-platform, open-source, and document-based database management system. It facilitates users by providing full index support, high availability, replication, and auto-sharding, etc. As we mentioned earlier, MongoDB is a cross-platform database. However, the data integration process is much easier and comparatively faster than other databases. Due to the free availability of the MongoDB [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/\" \/>\n<meta property=\"og:site_name\" content=\"GreenCloud Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T00:45:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/\",\"name\":\"How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Screenshot_4-1.png\",\"datePublished\":\"2022-05-16T07:58:24+00:00\",\"dateModified\":\"2026-01-19T00:45:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/#primaryimage\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Screenshot_4-1.png\",\"contentUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Screenshot_4-1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-mongodb-on-almalinux-8\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GreenCloud Documents\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/docs\\\/greencloud-documents\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux Operating Systems\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/linux-operating-systems\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to install MongoDB on AlmaLinux 8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\",\"name\":\"GreenCloud Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/green.cloud\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/","og_locale":"en_US","og_type":"article","og_title":"How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation","og_description":"MongoDB is a cross-platform, open-source, and document-based database management system. It facilitates users by providing full index support, high availability, replication, and auto-sharding, etc. As we mentioned earlier, MongoDB is a cross-platform database. However, the data integration process is much easier and comparatively faster than other databases. Due to the free availability of the MongoDB [&hellip;]","og_url":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/","og_site_name":"GreenCloud Documentation","article_modified_time":"2026-01-19T00:45:46+00:00","og_image":[{"url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/","url":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/","name":"How to install MongoDB on AlmaLinux 8 - GreenCloud Documentation","isPartOf":{"@id":"https:\/\/green.cloud\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/#primaryimage"},"image":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/#primaryimage"},"thumbnailUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png","datePublished":"2022-05-16T07:58:24+00:00","dateModified":"2026-01-19T00:45:46+00:00","breadcrumb":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/#primaryimage","url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png","contentUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/05\/Screenshot_4-1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/green.cloud\/docs\/how-to-install-mongodb-on-almalinux-8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/green.cloud\/docs\/"},{"@type":"ListItem","position":2,"name":"GreenCloud Documents","item":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/"},{"@type":"ListItem","position":3,"name":"Linux Operating Systems","item":"https:\/\/green.cloud\/docs\/linux-operating-systems\/"},{"@type":"ListItem","position":4,"name":"How to install MongoDB on AlmaLinux 8"}]},{"@type":"WebSite","@id":"https:\/\/green.cloud\/docs\/#website","url":"https:\/\/green.cloud\/docs\/","name":"GreenCloud Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/green.cloud\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/11147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/comments?post=11147"}],"version-history":[{"count":1,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/11147\/revisions"}],"predecessor-version":[{"id":18483,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/11147\/revisions\/18483"}],"up":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/17817"}],"wp:attachment":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/media?parent=11147"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/doc_tag?post=11147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}