{"id":3455,"date":"2023-01-25T10:52:19","date_gmt":"2023-01-25T10:52:19","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=3455"},"modified":"2023-01-25T10:52:22","modified_gmt":"2023-01-25T10:52:22","slug":"install-mongodb-on-ubuntu-18-04-20-04-22-04-debian","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/","title":{"rendered":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &#038; Debian"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en.jpg\" alt=\"How to Install MongoDB on Ubuntu 18.04, 20.04, and 22.04 &amp; Debian\" class=\"wp-image-3517\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>MongoDB is a popular NoSQL database that is widely used for storing and managing large amounts of unstructured data. In this guide, we will show you how to install MongoDB on Ubuntu 18.04, 20.04, and 22.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p>Before starting, you will need the following:<\/p>\n\n\n\n<ul><li>An Ubuntu 18.04, 20.04 and 22.04 or Debian Operatin System.<\/li><li>Root access to the system<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Add the MongoDB Repository<\/h3>\n\n\n\n<p>To install MongoDB, you will need to add the MongoDB repository to your system. You can do this by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt-get install gnupg\n$ wget -qO - https:\/\/www.mongodb.org\/static\/pgp\/server-5.0.asc | sudo apt-key add -<\/code><\/pre>\n\n\n\n<p>Then you should create a new sources list file for MongoDB:<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Ubuntu 20.04:<\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo \"deb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu focal\/mongodb-org\/5.0 multiverse\" | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-5.0.list<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Ubuntu 18.04:<\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo \"deb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu bionic\/mongodb-org\/5.0 multiverse\" | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-5.0.list<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install MongoDB<\/h3>\n\n\n\n<p>Now that the repository is added, you can install MongoDB by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt-get update\n$ sudo apt-get install -y mongodb-org<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Start MongoDB<\/h3>\n\n\n\n<p>After installation, you can start MongoDB by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl start mongod<\/code><\/pre>\n\n\n\n<p>You can also enable MongoDB to start automatically on boot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl enable mongod<\/code><\/pre>\n\n\n\n<p>Verify that MongoDB is running by checking its status:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl status mongod<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion:<\/h3>\n\n\n\n<p>With the successful installation and running of MongoDB on your Ubuntu 18.04, 20.04, or 22.04 system, you can now proceed with creating and managing your databases and collections.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB is a popular NoSQL database that is widely used for storing and managing large amounts of unstructured data. In this guide, we will show you how to install MongoDB on Ubuntu 18.04, 20.04, and 22.04. Prerequisites Before starting, you will need the following: An Ubuntu 18.04, 20.04 and 22.04 or Debian Operatin System. Root ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57,69],"tags":[],"yoast_head":"\n<title>Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &amp; Debian - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 &amp; Debian OS.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &amp; Debian - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 &amp; Debian OS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-25T10:52:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-25T10:52:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &#038; Debian\",\"datePublished\":\"2023-01-25T10:52:19+00:00\",\"dateModified\":\"2023-01-25T10:52:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\"},\"wordCount\":176,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Databases\",\"Linux system administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\",\"name\":\"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 & Debian - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2023-01-25T10:52:19+00:00\",\"dateModified\":\"2023-01-25T10:52:22+00:00\",\"description\":\"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 & Debian OS.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &#038; Debian\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1780005063\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1780005063\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 & Debian - WebHi Tutorials &amp; Documentations","description":"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 & Debian OS.","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:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/","og_locale":"en_US","og_type":"article","og_title":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 & Debian - WebHi Tutorials &amp; Documentations","og_description":"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 & Debian OS.","og_url":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2023-01-25T10:52:19+00:00","article_modified_time":"2023-01-25T10:52:22+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/01\/mongodb_ubuntu_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &#038; Debian","datePublished":"2023-01-25T10:52:19+00:00","dateModified":"2023-01-25T10:52:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/"},"wordCount":176,"commentCount":1,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Databases","Linux system administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/","url":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/","name":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 & Debian - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2023-01-25T10:52:19+00:00","dateModified":"2023-01-25T10:52:22+00:00","description":"In this guide, we will show you how to install and configure MongoDB on Ubuntu 18.04, 20.04, and 22.04 & Debian OS.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/install-mongodb-on-ubuntu-18-04-20-04-22-04-debian\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"Install MongoDB on Ubuntu 18.04, 20.04, 22.04 &#038; Debian"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1780005063","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1780005063","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/3455"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=3455"}],"version-history":[{"count":26,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/3455\/revisions"}],"predecessor-version":[{"id":3526,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/3455\/revisions\/3526"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=3455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=3455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=3455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}