{"id":187,"date":"2015-08-19T15:00:49","date_gmt":"2015-08-19T15:00:49","guid":{"rendered":"https:\/\/www.nonamehosts.com\/blog\/?p=187"},"modified":"2015-08-19T15:00:49","modified_gmt":"2015-08-19T15:00:49","slug":"how-to-install-and-configure-mongodb-on-ubuntu-14-04-x64","status":"publish","type":"post","link":"https:\/\/www.nonamehosts.com\/blog\/tutorials\/how-to-install-and-configure-mongodb-on-ubuntu-14-04-x64\/","title":{"rendered":"How to Install and Configure MongoDB on Ubuntu 14.04 x64"},"content":{"rendered":"<p>In this howto we&#8217;ll setup and configure MongoDB server on Ubuntu 14.04 x64 (it&#8217;s only available for x64 LTS distributions). To begin we have to setup custom repository:<\/p>\n<p><!--more--><\/p>\n<h3>MongoDB installation<\/h3>\n<p>Add repo key:<\/p>\n<pre class=\"lang:sh decode:true\">root@mongodb:~#\u00a0apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv 7F0CEB10<\/pre>\n<p>Create apt source.list config:<\/p>\n<pre class=\"lang:sh decode:true\">root@mongodb:~#\u00a0echo \"deb http:\/\/repo.mongodb.org\/apt\/ubuntu \"$(lsb_release -sc)\"\/mongodb-org\/3.0 multiverse\" | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-3.0.list<\/pre>\n<p>Update apt repo list and install MongoDB:<\/p>\n<pre class=\"lang:sh decode:true\">root@mongodb:~#\u00a0apt-get update; apt-get install -y mongodb-org<\/pre>\n<h3>MongoDB access configuration<\/h3>\n<p>Now let&#8217;s setup access to MongoDB.<\/p>\n<p>Run MongoDB shell and switch to admin user:<\/p>\n<pre class=\"lang:sh decode:true\">root@mongodb:~# mongo\nMongoDB shell version: 3.0.5\nconnecting to: test\nWelcome to the MongoDB shell.\nFor interactive help, type \"help\".\nFor more comprehensive documentation, see\n        http:\/\/docs.mongodb.org\/\nQuestions? Try the support group\n        http:\/\/groups.google.com\/group\/mongodb-user\n&gt; use admin\nswitched to db admin\n&gt;<\/pre>\n<p>Create root user and exit the shell:<\/p>\n<pre class=\"lang:sh decode:true \">&gt; db.createUser({user:\"admin\", pwd:\"root\", roles:[{role:\"root\", db:\"admin\"}]})\nSuccessfully added user: {\n        \"user\" : \"admin\",\n        \"roles\" : [\n                {\n                        \"role\" : \"root\",\n                        \"db\" : \"admin\"\n                }\n        ]\n}\n&gt; exit\nbye\nroot@mongodb:~#<\/pre>\n<p>Enable authentication in MongoDB config and restart MongoDB service:<\/p>\n<pre class=\"lang:sh decode:true\">root@mongodb:~# sed -i \"s\/#auth = true\/auth = true\/g\" \/etc\/mongod.conf\nroot@mongodb:~# service mongod restart<\/pre>\n<p>Test the connection to database with new credentials:<\/p>\n<pre class=\"lang:sh decode:true \">root@mongodb:~# mongo -u admin -p root --authenticationDatabase admin\nMongoDB shell version: 3.0.5\nconnecting to: test\n&gt;\n<\/pre>\n<p>That&#8217;s all, your MongoDB is setup.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this howto we&#8217;ll setup and configure MongoDB server on Ubuntu 14.04 x64 (it&#8217;s only available for x64 LTS distributions). To begin we have to setup custom repository:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[31,33,57,58,68,74,75,76,115,118,133],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-database","tag-db","tag-howto","tag-install","tag-linux","tag-mongo","tag-mongod","tag-mongodb","tag-server","tag-setup","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/posts\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":0,"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/posts\/187\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/media?parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/categories?post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nonamehosts.com\/blog\/wp-json\/wp\/v2\/tags?post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}