{"id":2110,"date":"2016-06-28T16:09:11","date_gmt":"2016-06-28T20:09:11","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2110"},"modified":"2017-12-12T15:43:29","modified_gmt":"2017-12-12T20:43:29","slug":"install-mongodb-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/","title":{"rendered":"How to Install MongoDB on CentOS 7"},"content":{"rendered":"<h1>How to Install MongoDB on CentOS 7<\/h1>\n<p>MongoDB is a popular, document-oriented, NoSQL database that is quick to install, easy to develop with, and trivial to scale. It is a great solution for anyone wishing to cluster an application&#8217;s storage across multiple servers, tracking arbitrarily complex JSON and binary data. As it is schemaless, it is also a quick path for applications needing to store data but without a clear idea of what form that data might take, or for services needing to store arbitrarily diverse records with no schema in common. Installing MongoDB on CentOS 7 is quick and easy, particularly as the company behind MongoDB maintains updated package repositories for most popular Linux distributions.<\/p>\n<h2>Getting Started<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 1 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) running a clean CentOS 7.<br \/>\n\u2022 Root access to the server.<\/p>\n<p>It should also work on servers with other services installed, provided MongoDB&#8217;s port is not taken by anything else. When complete, the server will have a fresh MongoDB installation that can be connected to locally, or clustered with other servers to replicate and shard documents.<\/p>\n<h2>Tutorial<\/h2>\n<p>Start by updating your CentOS 7 installation. This will integrate any currently available security updates and bugfixes, and should be performed on a regular basis to keep your server running more efficiently.<\/p>\n<p><code>yum -y update<\/code><\/p>\n<p>MongoDB ships in its own official package repository. Let&#8217;s add that to Yum so we can automatically download the package and keep it updated later.<\/p>\n<p><code>nano \/etc\/yum.repos.d\/mongodb.repo<\/code><\/p>\n<p><code class=\"gris\"> [mongodb]<br \/>\nname=MongoDB Repository<br \/>\nbaseurl=http:\/\/downloads-distro.mongodb.org\/repo\/redhat\/os\/x86_64\/<br \/>\ngpgcheck=0<br \/>\nenabled=1<\/code><\/p>\n<p>The repo list must now be updated before MongoDB can be installed.<\/p>\n<p><code>yum -y update<\/code><\/p>\n<p>Next we install MongoDB itself.<\/p>\n<p><code>yum -y install mongodb-org mongodb-org-server<\/code><\/p>\n<p>MongoDB must now be started and configured to run on boot. Note that the MongoDB daemon is called mongod, which is what you&#8217;ll actually be starting and configuring. We&#8217;ll also use the chkconfig command to check how this went.<\/p>\n<p><code>systemctl start mongod.service<br \/>\nchkconfig mongod on<\/code><\/p>\n<p>To determine if MongoDB is running, we&#8217;ll check its status.<br \/>\n<code>systemctl status mongod.service<\/code><br \/>\n<code class=\"gris\"> ? mongod.service - SYSV: Mongo is a scalable, document-oriented database.<br \/>\n   Loaded: loaded (\/etc\/rc.d\/init.d\/mongod)<br \/>\n   Active: active (running) since Fri 2016-06-24 09:55:34 UTC; 2min 10s ago<br \/>\n     Docs: man:systemd-sysv-generator(8)<br \/>\n Main PID: 32306 (mongod)<br \/>\n   CGroup: \/system.slice\/mongod.service<br \/>\n           ??32306 \/usr\/bin\/mongod -f \/etc\/mongod.conf<\/code><\/p>\n<p>To further test our mongod instance, let&#8217;s check the statistics as reported by the database itself.<\/p>\n<p><code>mongostat<\/code><br \/>\n<code class=\"gris\"> insert  query update delete getmore command flushes mapped  vsize    res faults  locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn       time<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:25<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:26<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:27<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:28<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:29<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:30<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0     .:0.0%          0       0|0     0|0    62b     2k     1   09:59:31<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:32<br \/>\n    *0     *0     *0     *0       0     1|0       1    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:33<br \/>\n    *0     *0     *0     *0       0     1|0       0    80m   443m    31m      0 local:0.0%          0       0|0     0|0    62b     2k     1   09:59:34<br \/>\ninsert  query update delete getmore command flushes mapped  vsize    res faults  locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn       time <\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>MongoDB is now installed, running, configured to launch on boot, and ready to be connected to and clustered. Services can now connect to the mongod daemon by accessing localhost on port 27017. If this guide was helpful to you, kindly share it with others who may also be interested. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How to Install MongoDB on CentOS 7 MongoDB is a popular, document-oriented, NoSQL database that is quick to install, easy to develop with, and trivial to scale. It is a great solution for anyone wishing to cluster an application&#8217;s storage across multiple servers, tracking arbitrarily complex JSON and binary data. As it is schemaless, it<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-2110","post","type-post","status-publish","format-standard","hentry","category-database","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install MongoDB on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now &amp; Enjoy this popular, document-oriented, NoSQL database !\" \/>\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.globo.tech\/learning-center\/install-mongodb-centos-7\/\" \/>\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 CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now &amp; Enjoy this popular, document-oriented, NoSQL database !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-28T20:09:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-12T20:43:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/\",\"name\":\"How to Install MongoDB on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"datePublished\":\"2016-06-28T20:09:11+00:00\",\"dateModified\":\"2017-12-12T20:43:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now & Enjoy this popular, document-oriented, NoSQL database !\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install MongoDB on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\/\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install MongoDB on CentOS 7 - Globo.Tech","description":"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now & Enjoy this popular, document-oriented, NoSQL database !","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.globo.tech\/learning-center\/install-mongodb-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to Install MongoDB on CentOS 7 - Globo.Tech","og_description":"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now & Enjoy this popular, document-oriented, NoSQL database !","og_url":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-06-28T20:09:11+00:00","article_modified_time":"2017-12-12T20:43:29+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/","name":"How to Install MongoDB on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-06-28T20:09:11+00:00","dateModified":"2017-12-12T20:43:29+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to install MongoDB on your CentOS 7 server. Read now & Enjoy this popular, document-oriented, NoSQL database !","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-mongodb-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Install MongoDB on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2110"}],"version-history":[{"count":5,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2110\/revisions"}],"predecessor-version":[{"id":3983,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2110\/revisions\/3983"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}