{"id":4107,"date":"2019-06-26T07:33:06","date_gmt":"2019-06-26T07:33:06","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=4107"},"modified":"2022-06-18T07:40:48","modified_gmt":"2022-06-18T07:40:48","slug":"install-mongodb-for-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2019\/06\/26\/install-mongodb-for-ubuntu-16-04\/","title":{"rendered":"Install MongoDb for Ubuntu 16.04"},"content":{"rendered":"<p>Ref: https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-ubuntu\/<br \/>\nhttps:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-mongodb-on-ubuntu-16-04<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"xZ4zcmFvfw\"><p><a href=\"https:\/\/hevodata.com\/blog\/install-mongodb-on-ubuntu\/\">Install MongoDB on Ubuntu: 5 Easy Steps<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Install MongoDB on Ubuntu: 5 Easy Steps&#8221; &#8212; Hevo Blog - Transformative ideas and real insights on all things Data\" src=\"https:\/\/hevodata.com\/blog\/install-mongodb-on-ubuntu\/embed\/#?secret=xZ4zcmFvfw\" data-secret=\"xZ4zcmFvfw\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"jAStXt2BJT\"><p><a href=\"https:\/\/websiteforstudents.com\/install-grandnode-ecommerce-platform-on-ubuntu-16-04-18-04-18-10\/\">Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10&#8221; &#8212; Website for Students\" src=\"https:\/\/websiteforstudents.com\/install-grandnode-ecommerce-platform-on-ubuntu-16-04-18-04-18-10\/embed\/#?secret=aeU2DRSp8t#?secret=jAStXt2BJT\" data-secret=\"jAStXt2BJT\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>This tutorial installs MongoDB 4.0 Community Edition . For other versions of MongoDB, refer to the corresponding version of the manual.<br \/>\n1. Import the public key used by the package management system.<br \/>\nThe Ubuntu package management tools (i.e.\u00a0dpkg\u00a0and\u00a0apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import theMongoDB public GPG Key:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4\r\n[sudo] password for teddy: \r\n\\Executing: \/tmp\/tmp.boZZpFlZy6\/gpg.1.sh --keyserver\r\nhkp:\/\/keyserver.ubuntu.com:80\r\n--recv\r\n9DA31620334BD75D9DCB49F368818C72E52529D4\r\ngpg: requesting key E52529D4 from hkp server keyserver.ubuntu.com\r\ngpg: key E52529D4: public key \"MongoDB 4.0 Release Signing Key &lt;packaging@mongodb.com&gt;\" imported\r\ngpg: Total number processed: 1\r\ngpg:               imported: 1  (RSA: 1)<\/pre>\n<p>2. Create a list file for MongoDB.<br \/>\nCreate the list file\u00a0\/etc\/apt\/sources.list.d\/mongodb-org-4.0.list\u00a0for your version of Ubuntu.<\/p>\n<p>Click on the appropriate tab for your version of Ubuntu. If you are unsure of what Ubuntu version the host is running, open a terminal or shell on the host and execute\u00a0lsb_release\u00a0-dc.<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ echo \"deb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0 multiverse\" | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-4.0.list\r\ndeb [ arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0 multiverse<\/pre>\n<p>3. Reload local package database.<br \/>\nIssue the following command to reload the local package database:<\/p>\n<pre class=\"lang:default decode:true \">sudo apt-get update<\/pre>\n<p>4. Install the MongoDB packages.<br \/>\nYou can install either the latest stable version of MongoDB or a specific version of MongoDB.<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo apt-get install -y mongodb-org\r\nReading package lists... Done\r\nBuilding dependency tree       \r\nReading state information... Done\r\nThe following packages were automatically installed and are no longer required:\r\n  exuberant-ctags geany-plugin-addons geany-plugin-autoclose\r\n  geany-plugin-automark geany-plugin-codenav geany-plugin-commander\r\n  geany-plugin-ctags geany-plugin-defineformat geany-plugin-doc\r\n  geany-plugin-extrasel geany-plugin-gendoc geany-plugin-geniuspaste\r\n  geany-plugin-insertnum geany-plugin-keyrecord geany-plugin-latex\r\n  geany-plugin-lineoperations geany-plugin-lipsum geany-plugin-lua\r\n  geany-plugin-macro geany-plugin-miniscript geany-plugin-numberedbookmarks\r\n  geany-plugin-overview geany-plugin-pairtaghighlighter geany-plugin-pg\r\n  geany-plugin-pohelper geany-plugin-prettyprinter geany-plugin-prj\r\n  geany-plugin-projectorganizer geany-plugin-sendmail geany-plugin-shiftcolumn\r\n  geany-plugin-spellcheck geany-plugin-tableconvert geany-plugin-treebrowser\r\n  geany-plugin-updatechecker geany-plugin-vc geany-plugin-workbench\r\n  geany-plugin-xmlsnippets geany-plugins-common libctpl2 libssh2-1 libtidy5\r\n  libzip5 php7.2-sqlite3 python-cliapp python-markdown python-ttystatus\r\n  python-yaml qtdeclarative5-controls-plugin qtdeclarative5-dialogs-plugin\r\nUse 'sudo apt autoremove' to remove them.\r\nThe following additional packages will be installed:\r\n  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools\r\nThe following NEW packages will be installed:\r\n  mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell\r\n  mongodb-org-tools\r\n0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.\r\nNeed to get 73,9 MB of archives.\r\nAfter this operation, 269 MB of additional disk space will be used.\r\nGet:1 https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0\/multiverse amd64 mongodb-org-shell amd64 4.0.10 [9.797 kB]\r\nGet:2 https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0\/multiverse amd64 mongodb-org-server amd64 4.0.10 [15,7 MB]\r\nGet:3 https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0\/multiverse amd64 mongodb-org-mongos amd64 4.0.10 [8.790 kB]\r\nGet:4 https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0\/multiverse amd64 mongodb-org-tools amd64 4.0.10 [39,6 MB]\r\nGet:5 https:\/\/repo.mongodb.org\/apt\/ubuntu xenial\/mongodb-org\/4.0\/multiverse amd64 mongodb-org amd64 4.0.10 [3.514 B]\r\nFetched 73,9 MB in 37s (1.948 kB\/s)                                            \r\nSelecting previously unselected package mongodb-org-shell.\r\n(Reading database ... 343352 files and directories currently installed.)\r\nPreparing to unpack ...\/mongodb-org-shell_4.0.10_amd64.deb ...\r\nUnpacking mongodb-org-shell (4.0.10) ...\r\nSelecting previously unselected package mongodb-org-server.\r\nPreparing to unpack ...\/mongodb-org-server_4.0.10_amd64.deb ...\r\nUnpacking mongodb-org-server (4.0.10) ...\r\nSelecting previously unselected package mongodb-org-mongos.\r\nPreparing to unpack ...\/mongodb-org-mongos_4.0.10_amd64.deb ...\r\nUnpacking mongodb-org-mongos (4.0.10) ...\r\nSelecting previously unselected package mongodb-org-tools.\r\nPreparing to unpack ...\/mongodb-org-tools_4.0.10_amd64.deb ...\r\nUnpacking mongodb-org-tools (4.0.10) ...\r\nSelecting previously unselected package mongodb-org.\r\nPreparing to unpack ...\/mongodb-org_4.0.10_amd64.deb ...\r\nUnpacking mongodb-org (4.0.10) ...\r\nProcessing triggers for man-db (2.7.5-1) ...\r\nSetting up mongodb-org-shell (4.0.10) ...\r\nSetting up mongodb-org-server (4.0.10) ...\r\nAdding system user `mongodb' (UID 127) ...\r\nAdding new user `mongodb' (UID 127) with group `nogroup' ...\r\nNot creating home directory `\/home\/mongodb'.\r\nAdding group `mongodb' (GID 135) ...\r\nDone.\r\nAdding user `mongodb' to group `mongodb' ...\r\nAdding user mongodb to group mongodb\r\nDone.\r\nSetting up mongodb-org-mongos (4.0.10) ...\r\nSetting up mongodb-org-tools (4.0.10) ...\r\nSetting up mongodb-org (4.0.10) ...<\/pre>\n<p>Start MongoDb service<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo service mongod start<\/pre>\n<p>Check MongoDb status<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo service mongod status\r\n\u25cf mongod.service - MongoDB Database Server\r\n   Loaded: loaded (\/lib\/systemd\/system\/mongod.service; disabled; vendor preset: \r\n   Active: active (running) since Rab 2019-06-26 14:40:32 WIB; 9s ago\r\n     Docs: https:\/\/docs.mongodb.org\/manual\r\n Main PID: 7509 (mongod)\r\n    Tasks: 27\r\n   Memory: 42.4M\r\n      CPU: 559ms\r\n   CGroup: \/system.slice\/mongod.service\r\n           \u2514\u25007509 \/usr\/bin\/mongod --config \/etc\/mongod.conf\r\n\r\nJun 26 14:40:32 teddy systemd[1]: Started MongoDB Database Server.<\/pre>\n<p>Verify that the\u00a0mongod\u00a0process has started successfully by checking the contents of the log file at\/var\/log\/mongodb\/mongod.log\u00a0for a line reading<\/p>\n<pre class=\"lang:default decode:true \">...\r\n2019-06-26T14:40:33.004+0700 I CONTROL  [initandlisten] MongoDB starting : pid=7509 port=27017 dbpath=\/var\/lib\/mongodb 64-bit host=teddy\r\n...<\/pre>\n<p>27017\u00a0is the default port the standalone\u00a0mongod\u00a0listens on.<\/p>\n<p>Create a database<br \/>\nNOTE: Make sure mongodb already start or start it<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo service mongod start<\/pre>\n<p>then run &#8216;sudo mongo&#8217;:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo mongo\r\nMongoDB shell version v4.0.10\r\nconnecting to: mongodb:\/\/127.0.0.1:27017\/?gssapiServiceName=mongodb\r\nImplicit session: session { \"id\" : UUID(\"20bf4404-9ed8-44f2-961c-ff5ffc8176e9\") }\r\nMongoDB server version: 4.0.10\r\nWelcome to the MongoDB shell.\r\nFor interactive help, type \"help\".\r\nFor more comprehensive documentation, see\r\n\thttp:\/\/docs.mongodb.org\/\r\nQuestions? Try the support group\r\n\thttp:\/\/groups.google.com\/group\/mongodb-user\r\nServer has startup warnings: \r\n2019-06-26T20:57:28.164+0700 I STORAGE  [initandlisten] \r\n2019-06-26T20:57:28.164+0700 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine\r\n2019-06-26T20:57:28.164+0700 I STORAGE  [initandlisten] **          See http:\/\/dochub.mongodb.org\/core\/prodnotes-filesystem\r\n2019-06-26T20:57:28.924+0700 I CONTROL  [initandlisten] \r\n2019-06-26T20:57:28.924+0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.\r\n2019-06-26T20:57:28.924+0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.\r\n2019-06-26T20:57:28.924+0700 I CONTROL  [initandlisten] \r\n---\r\nEnable MongoDB's free cloud-based monitoring service, which will then receive and display\r\nmetrics about your deployment (disk utilization, CPU, operation statistics, etc).\r\n\r\nThe monitoring data will be available on a MongoDB website with a unique URL accessible to you\r\nand anyone you share the URL with. MongoDB may use this information to make product\r\nimprovements and to suggest MongoDB products and deployment options to you.\r\n\r\nTo enable free monitoring, run the following command: db.enableFreeMonitoring()\r\nTo permanently disable this reminder, run the following command: db.disableFreeMonitoring()\r\n---\r\n\r\n&gt;<\/pre>\n<p>type in the terminal this script<\/p>\n<pre class=\"lang:default decode:true\">use grandnode\r\ndb.createUser(\r\n   {\r\n     user: \"grandnodeuser\",\r\n     pwd: \"grandnode\",\r\n     roles: [ \"dbOwner\" ]\r\n   }\r\n)<\/pre>\n<p>it will look:<\/p>\n<pre class=\"lang:default decode:true\">&gt; use grandnode\r\nswitched to db grandnode\r\n&gt; db.createUser(\r\n... {\r\n... user: \"grandnodeuser\",\r\n... pwd: \"grandnode\",\r\n... roles: [\"dbOwner\"]\r\n... }\r\n... )\r\nSuccessfully added user: { \"user\" : \"grandnodeuser\", \"roles\" : [ \"dbOwner\" ] }\r\n&gt; exit\r\nbye<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ref: https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-ubuntu\/ https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-mongodb-on-ubuntu-16-04 Install MongoDB on Ubuntu: 5 Easy Steps Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10 This tutorial installs MongoDB 4.0 Community Edition . For other versions of MongoDB, refer to the corresponding version of the manual. 1. Import the public key used by the package management system. The Ubuntu &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2019\/06\/26\/install-mongodb-for-ubuntu-16-04\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install MongoDb for Ubuntu 16.04&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[90,78],"tags":[],"class_list":["post-4107","post","type-post","status-publish","format-standard","hentry","category-mongodb","category-ubuntu-16-04"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=4107"}],"version-history":[{"count":4,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4107\/revisions"}],"predecessor-version":[{"id":4119,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4107\/revisions\/4119"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=4107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=4107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=4107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}