{"id":2451,"date":"2023-05-27T01:53:18","date_gmt":"2023-05-27T01:53:18","guid":{"rendered":"https:\/\/draculaservers.com\/tutorials\/?p=2451"},"modified":"2023-06-06T06:55:04","modified_gmt":"2023-06-06T06:55:04","slug":"install-mongodb-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/","title":{"rendered":"How to Install MongoDB on Ubuntu 22?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">MongoDB is a document-based database commonly used by developers, managers, and Linux system administrators. However, installing MongoDB in Ubuntu is relatively easy, but people are often met with errors and a lot of confusion. If you are looking for a reliable step-by-step procedure to install MongoDB in your Ubuntu installation, this article covers you.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There is a MongoDB default repository added to the Ubuntu installation (old installations.). However, the version of MongoDB in the default repo is not the latest one. Therefore, installing that does not benefit a lot of people. That is why this post will explain the method of installing MongoDB from an external source.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s get started.<\/span><\/p>\n<h2 id=\"installing-mongodb-in-ubuntu-22-04\"><span style=\"font-weight: 400;\">Installing MongoDB in Ubuntu 22.04<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In this method, you will manually add the MongoDB Repo to your <a href=\"https:\/\/ubuntu.com\/\" target=\"_blank\" rel=\"noopener\">Ubuntu<\/a> installation and then install it. To follow along with this method, start by first updating your system and apt packages list by running the following commands in the terminal:<\/span><\/p>\n<pre>sudo apt update\r\nsudo apt upgrade<\/pre>\n<p><span style=\"font-weight: 400;\">Once that is done, install all the dependencies for installing MongoDB by running the following command:<\/span><\/p>\n<pre>sudo apt-get install wget curl gnupg2 software-properties-common apt-transport-https ca-certificates lsb-release<\/pre>\n<p><span style=\"font-weight: 400;\">After that, the terminal will ask you to provide the password for the sudo user. Therefore, type that in:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2452\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/1.png\" alt=\"\" width=\"979\" height=\"189\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/1.png 979w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/1-300x58.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/1-768x148.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Once that is done, the next step is to add the GPG key for MongoDB using the following command:<\/span><\/p>\n<pre>curl -fsSL https:\/\/www.mongodb.org\/static\/pgp\/server-6.0.asc|sudo gpg --dearmor -o \/etc\/apt\/trusted.gpg.d\/mongodb-6.gpg<\/pre>\n<p><span style=\"font-weight: 400;\">After the public GPG key has been added to your Ubuntu, the next step is to add the MongoDB repo to your system using the GPG key. For that, run the following command in the terminal:<\/span><\/p>\n<pre>echo \"deb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu $(lsb_release -cs)\/mongodb-org\/6.0 multiverse\" | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-6.0.list<\/pre>\n<p><b>Note:<\/b><span style=\"font-weight: 400;\"> If you get an error running the above command, then simply add sudo at the start of the command and try again.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Once the repo has been added to your Ubuntu. The next step is to update the apt packages list using the following command:<\/span><\/p>\n<pre>sudo apt update<\/pre>\n<p><span style=\"font-weight: 400;\">After the apt list has been successfully updated, you will see that the MongoDB repo is displayed in the terminal:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2453\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/2.png\" alt=\"Sudo Apt Update Output\" width=\"978\" height=\"447\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/2.png 978w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/2-300x137.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/2-768x351.png 768w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">The next step is to simply run the following install command in the terminal:<\/span><\/p>\n<pre>sudo apt install mongodb-org<\/pre>\n<p><span style=\"font-weight: 400;\">When prompted about the confirmation, simply type \u201cy\u201d and press enter:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2454\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/3.png\" alt=\"\" width=\"978\" height=\"418\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/3.png 978w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/3-300x128.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/3-768x328.png 768w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">After that, simply wait for the installation process to fully complete. Once it&#8217;s done, you can check the status of the MongoDB service by running the following command:<\/span><\/p>\n<pre>sudo systemctl status mongod<\/pre>\n<p><span style=\"font-weight: 400;\">You will get the following output on the terminal window:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2455\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/4.png\" alt=\"\" width=\"976\" height=\"161\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/4.png 976w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/4-300x49.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/4-768x127.png 768w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">As you can see, the MongoDB Database Server is currently in an inactive state. To run it, simply type the following command in the terminal:<\/span><\/p>\n<pre>sudo systemctl start mongod<\/pre>\n<p><span style=\"font-weight: 400;\">And then recheck the status using the status command:<\/span><\/p>\n<pre>sudo systemctl status mongod<\/pre>\n<p><span style=\"font-weight: 400;\">This time around, you will get the following output on the terminal window:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2456\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/5.png\" alt=\"\" width=\"976\" height=\"448\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/5.png 976w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/5-300x138.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/5-768x353.png 768w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Incase you want the MongoDB service to autorun at the boot time, then run the following command:<\/span><\/p>\n<pre>sudo systemctl enable mongod<\/pre>\n<p><span style=\"font-weight: 400;\">Lastly, check the version command to verify the correct installation of MongoDB:<\/span><\/p>\n<pre>mongod --version<\/pre>\n<p><span style=\"font-weight: 400;\">This will return the following output on the terminal:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2457\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/6.png\" alt=\"\" width=\"976\" height=\"396\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/6.png 976w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/6-300x122.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/6-768x312.png 768w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">The output shows that you are running MongoDB version 6.0.6.<\/span><\/p>\n<p>Looking for Affordable VPS Hosting Without Compromise? Check out <a href=\"https:\/\/draculaservers.com\/\" target=\"_blank\" rel=\"noopener\">Dracula Servers<\/a>!<\/p>\n<h2 id=\"using-mongodb\"><span style=\"font-weight: 400;\">Using MongoDB<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To use the MongoDB after successful installation, you need to enter the MongoDB Shell using the following command:<\/span><\/p>\n<pre>mongosh<\/pre>\n<p><span style=\"font-weight: 400;\">This will show you the following output on the terminal:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2459\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/7.png\" alt=\"Mongo Shell\" width=\"995\" height=\"660\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/7.png 995w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/7-300x199.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/7-768x509.png 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">To show all the available databases, simply run the following command:<\/span><\/p>\n<pre>show databases;<\/pre>\n<p><span style=\"font-weight: 400;\">This will generate the following output:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2460\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/8.png\" alt=\"\" width=\"1000\" height=\"288\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/8.png 1000w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/8-300x86.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/8-768x221.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">If you want to switch to a specific database or create a new database, then simply use the \u201cuse\u201d command. For example, let\u2019s use the admin database by running the following command in the Mongo Shell:<\/span><\/p>\n<pre>use admin<\/pre>\n<p>This will change the name in the shell, showing that the user is now using the &#8220;admin&#8221; database:<\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2462\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/9.png\" alt=\"\" width=\"980\" height=\"343\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/9.png 980w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/9-300x105.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/9-768x269.png 768w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">To exit from the MongoDB Shell, either press \u201c<\/span><b>CTRL + C<\/b><span style=\"font-weight: 400;\">\u201d twice or type the following command in the shell:<\/span><\/p>\n<pre>exit;<\/pre>\n<h2 id=\"enabling-mongodb-authentication\"><span style=\"font-weight: 400;\">Enabling MongoDB Authentication<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Another thing that you can do after the successful installation of MongoDB on Ubuntu is to enable MongoDB Authentication. To do this, you need to open the mongod.service file and make the required changes in it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To open up the mongod.service, use the following command:<\/span><\/p>\n<pre>sudo nano \/lib\/systemd\/system\/mongod.service<\/pre>\n<p><span style=\"font-weight: 400;\">You will have the following output in the terminal window:<\/span><\/p>\n<p><a href=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2461\" src=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/10.png\" alt=\"Mongod.Service File\" width=\"982\" height=\"679\" srcset=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/10.png 982w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/10-300x207.png 300w, https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/10-768x531.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Within this file, you need to add the following line:<\/span><\/p>\n<pre>ExecStart=\/usr\/bin\/mongod --quiet --auth --config \/etc\/mongod.conf<\/pre>\n<p><span style=\"font-weight: 400;\">After that is done, press \u201c<\/span><b>CTRL + O<\/b><span style=\"font-weight: 400;\">\u201d and \u201c<\/span><b>CTRL + X<\/b><span style=\"font-weight: 400;\">\u201d to save and exit the file. The next time you open up a database that is password protected, you will have to use the following syntax:<\/span><\/p>\n<pre>mongosh -u demo -p --authenticationDatabase admin<\/pre>\n<p><span style=\"font-weight: 400;\">Replace the \u201cdemo\u201d and \u201cAdmin\u201d with the required database name and the user name. And that brings us to the end of this tutorial.<\/span><\/p>\n<h2 id=\"dracula-vps-hosting-service\"><span style=\"font-weight: 400;\">Dracula VPS Hosting Service<\/span><\/h2>\n<p><a href=\"http:\/\/draculaservers.com\"><span style=\"font-weight: 400;\">Dracula Servers<\/span><\/a><span style=\"font-weight: 400;\"> offers high-performance server hosting at entry-level prices. The plans include Linux VPS, Sneaker Servers, Dedicated Servers &amp; turnkey solutions. If you&#8217;re looking for quality self-managed servers with high amounts of RAM and storage, look no further.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Check the plans for yourself by clicking <\/span><a href=\"https:\/\/draculaservers.com\/#pick-plan\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Here<\/span><\/a><span style=\"font-weight: 400;\">!<\/span><\/p>\n<h2 id=\"wrap-up\"><span style=\"font-weight: 400;\">Wrap up<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">MongoDB is quite often used by system admins, developers, and in web applications. And this popularity is all due to the document database design. To use MongoDB in Ubuntu, there used to be a repo in the default APT packages. However, that version used to be outdated, and now it has been removed from the default apt packages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Therefore, to install MongoDB in your Ubuntu, you need to add the public GPG key and use it to add the repo of MongoDB in the apt packages list. From there, you can easily install MongoDB by using the \u201c<\/span><b>install<\/b><span style=\"font-weight: 400;\">\u201d command. After the installation is done, make sure to enable and start the <\/span><b>mongod<\/b><span style=\"font-weight: 400;\"> service. Finally, to use MongoDB, use MongoShell by typing the command \u201cmongosh\u201d.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB is a document-based database commonly used by developers, managers, and Linux system administrators. However, installing MongoDB in Ubuntu is relatively easy, but people are often met with errors and a lot of confusion. If you are looking for a reliable step-by-step procedure to install MongoDB in your Ubuntu installation, this article covers you. There [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":2463,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67,22],"tags":[102,124,126,34,125,127],"class_list":["post-2451","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","category-ubuntu","tag-linux","tag-mongodb","tag-mongosh","tag-ubuntu","tag-ubuntu-22","tag-ubuntu-tutorials"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"featured_image_urls_v2":{"full":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png",1280,720,false],"thumbnail":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-150x150.png",150,150,true],"medium":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-300x169.png",300,169,true],"medium_large":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-768x432.png",768,432,true],"large":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-1024x576.png",1024,576,true],"1536x1536":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png",1280,720,false],"2048x2048":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png",1280,720,false],"pk-small":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-80x80.png",80,80,true],"pk-thumbnail":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu-300x225.png",300,225,true]},"post_excerpt_stackable_v2":"<p>MongoDB is a document-based database commonly used by developers, managers, and Linux system administrators. However, installing MongoDB in Ubuntu is relatively easy, but people are often met with errors and a lot of confusion. If you are looking for a reliable step-by-step procedure to install MongoDB in your Ubuntu installation, this article covers you. There is a MongoDB default repository added to the Ubuntu installation (old installations.). However, the version of MongoDB in the default repo is not the latest one. Therefore, installing that does not benefit a lot of people. That is why this post will explain the method&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/draculaservers.com\/tutorials\/category\/debian\/\" rel=\"category tag\">Debian<\/a>, <a href=\"https:\/\/draculaservers.com\/tutorials\/category\/ubuntu\/\" rel=\"category tag\">Ubuntu<\/a>","author_info_v2":{"name":"Abdul Mannan","url":"https:\/\/draculaservers.com\/tutorials\/author\/abdul-mannan-tbgmail-com\/"},"comments_num_v2":"0 comments","yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install MongoDB on Ubuntu 22? - Dracula Servers Tutorials<\/title>\n<meta name=\"description\" content=\"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the &quot;apt install&quot; command.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/\" \/>\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 Ubuntu 22? - Dracula Servers Tutorials\" \/>\n<meta property=\"og:description\" content=\"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the &quot;apt install&quot; command.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:site_name\" content=\"Dracula Servers Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-27T01:53:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-06T06:55:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abdul Mannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abdul Mannan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/\"},\"author\":{\"name\":\"Abdul Mannan\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/ac89d0281f4fb596bfaa0bc1e746c8a6\"},\"headline\":\"How to Install MongoDB on Ubuntu 22?\",\"datePublished\":\"2023-05-27T01:53:18+00:00\",\"dateModified\":\"2023-06-06T06:55:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/\"},\"wordCount\":914,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/How-to-Install-MongoDB-on-Ubuntu.png\",\"keywords\":[\"linux\",\"MongoDB\",\"Mongosh\",\"Ubuntu\",\"ubuntu 22\",\"Ubuntu Tutorials\"],\"articleSection\":[\"Debian\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/\",\"name\":\"How to Install MongoDB on Ubuntu 22? - Dracula Servers Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/How-to-Install-MongoDB-on-Ubuntu.png\",\"datePublished\":\"2023-05-27T01:53:18+00:00\",\"dateModified\":\"2023-06-06T06:55:04+00:00\",\"description\":\"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the \\\"apt install\\\" command.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/How-to-Install-MongoDB-on-Ubuntu.png\",\"contentUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/How-to-Install-MongoDB-on-Ubuntu.png\",\"width\":1280,\"height\":720,\"caption\":\"How to Install MongoDB on Ubuntu 22.04?\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/install-mongodb-on-ubuntu-22-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install MongoDB on Ubuntu 22?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"name\":\"Dracula Servers Tutorials\",\"description\":\"Dedicated Servers\",\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\",\"name\":\"Dracula Servers\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"contentUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"width\":1625,\"height\":200,\"caption\":\"Dracula Servers\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/ac89d0281f4fb596bfaa0bc1e746c8a6\",\"name\":\"Abdul Mannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"caption\":\"Abdul Mannan\"},\"description\":\"An individual trying to decipher the enigmas of technology by the sheer driving force of curiosity. Interested in learning new skills and being better at those skills than the lot.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install MongoDB on Ubuntu 22? - Dracula Servers Tutorials","description":"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the \"apt install\" command.","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:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install MongoDB on Ubuntu 22? - Dracula Servers Tutorials","og_description":"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the \"apt install\" command.","og_url":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/","og_site_name":"Dracula Servers Tutorials","article_published_time":"2023-05-27T01:53:18+00:00","article_modified_time":"2023-06-06T06:55:04+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png","type":"image\/png"}],"author":"Abdul Mannan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abdul Mannan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#article","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/"},"author":{"name":"Abdul Mannan","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/ac89d0281f4fb596bfaa0bc1e746c8a6"},"headline":"How to Install MongoDB on Ubuntu 22?","datePublished":"2023-05-27T01:53:18+00:00","dateModified":"2023-06-06T06:55:04+00:00","mainEntityOfPage":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/"},"wordCount":914,"commentCount":0,"publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png","keywords":["linux","MongoDB","Mongosh","Ubuntu","ubuntu 22","Ubuntu Tutorials"],"articleSection":["Debian","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/","url":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/","name":"How to Install MongoDB on Ubuntu 22? - Dracula Servers Tutorials","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#primaryimage"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png","datePublished":"2023-05-27T01:53:18+00:00","dateModified":"2023-06-06T06:55:04+00:00","description":"To Install MongoDB in Ubuntu, Add the Public GPG Key, Add MongoDB Repo to the APT packages list, and then run the \"apt install\" command.","breadcrumb":{"@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#primaryimage","url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png","contentUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2023\/05\/How-to-Install-MongoDB-on-Ubuntu.png","width":1280,"height":720,"caption":"How to Install MongoDB on Ubuntu 22.04?"},{"@type":"BreadcrumbList","@id":"https:\/\/draculaservers.com\/tutorials\/install-mongodb-on-ubuntu-22-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/draculaservers.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How to Install MongoDB on Ubuntu 22?"}]},{"@type":"WebSite","@id":"https:\/\/draculaservers.com\/tutorials\/#website","url":"https:\/\/draculaservers.com\/tutorials\/","name":"Dracula Servers Tutorials","description":"Dedicated Servers","publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/draculaservers.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/draculaservers.com\/tutorials\/#organization","name":"Dracula Servers","url":"https:\/\/draculaservers.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","contentUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","width":1625,"height":200,"caption":"Dracula Servers"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/ac89d0281f4fb596bfaa0bc1e746c8a6","name":"Abdul Mannan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","caption":"Abdul Mannan"},"description":"An individual trying to decipher the enigmas of technology by the sheer driving force of curiosity. Interested in learning new skills and being better at those skills than the lot."}]}},"_links":{"self":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/comments?post=2451"}],"version-history":[{"count":3,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2451\/revisions"}],"predecessor-version":[{"id":2529,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2451\/revisions\/2529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/media\/2463"}],"wp:attachment":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/media?parent=2451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/categories?post=2451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/tags?post=2451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}