{"id":6884,"date":"2022-10-20T17:08:59","date_gmt":"2022-10-20T17:08:59","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=6884"},"modified":"2022-10-20T17:08:59","modified_gmt":"2022-10-20T17:08:59","slug":"install-rocket-chat","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2022\/10\/20\/install-rocket-chat\/","title":{"rendered":"Install Mongo 6 Database on Debian 11"},"content":{"rendered":"<p>This article covers how to install MongoDB (Community Edition Tutorial) on Debian 11. MongoDB is a popular open source NoSQL database. It is a document oriented database that supports structured and unstructured data, including JSON, XML, and organic data.<br \/>\n<!--more--><\/p>\n<p>Source: <a href=\"https:\/\/docs.rocket.chat\/quick-start\/deploying-rocket.chat\/other-deployment-methods\/manual-installation\/debian-based-distros\/debian\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.rocket.chat\/quick-start\/deploying-rocket.chat\/other-deployment-methods\/manual-installation\/debian-based-distros\/debian<\/a><br \/>\nUpdate system<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# sudo apt update\n# sudo apt dist-upgrade -y\n<\/pre>\n<p>You will need wget and GnuPG packages to download the MongoDB repository securely. Install these dependency packages with the following commands:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo apt install wget\n$ sudo apt install gnupg2\n<\/pre>\n<p>Import the GPG key of the MongoDB repository with the following command.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ wget -qO - https:\/\/www.mongodb.org\/static\/pgp\/server-6.0.asc | sudo apt-key add -\nWarning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).\nOK\n<\/pre>\n<p>Next, add and enable MongoDB Repository to APT with the following command.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ echo &quot;deb http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0 main&quot; | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-6.0.list\n<\/pre>\n<p>View the output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ cat \/etc\/apt\/sources.list.d\/mongodb-org-6.0.list\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndeb http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0 main\n<\/pre>\n<p>Update the system:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo apt update\n.........\nIgn:4 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0 InRelease\nGet:5 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0 Release &#x5B;2,400 B]\nGet:6 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0 Release.gpg &#x5B;801 B]\nGet:7 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 Packages &#x5B;7,652 B]\n.........\n<\/pre>\n<p>Install MongoDB on your system.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo apt install -y mongodb-org\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.......\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n  mongodb-database-tools mongodb-mongosh mongodb-org-database mongodb-org-database-tools-extra\n  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools\nThe following NEW packages will be installed:\n  mongodb-database-tools mongodb-mongosh mongodb-org mongodb-org-database\n  mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell\n  mongodb-org-tools\n0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 134 MB of archives.\nAfter this operation, 460 MB of additional disk space will be used.\nGet:1 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-database-tools amd64                                      100.6.0 &#x5B;47.7 MB]\nGet:2 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-mongosh amd64 1.6.0 &#x5B;                                     37.4 MB]\nGet:3 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-shell amd64 6.0.2                                      &#x5B;3,080 B]\nGet:4 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-server amd64 6.0.                                     2 &#x5B;28.8 MB]\nGet:5 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-mongos amd64 6.0.                                     2 &#x5B;20.3 MB]\nGet:6 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-database-tools-ex                                     tra amd64 6.0.2 &#x5B;7,748 B]\nGet:7 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-database amd64 6.                                     0.2 &#x5B;3,536 B]\nGet:8 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org-tools amd64 6.0.2                                      &#x5B;2,892 B]\nGet:9 http:\/\/repo.mongodb.org\/apt\/debian bullseye\/mongodb-org\/6.0\/main amd64 mongodb-org amd64 6.0.2 &#x5B;2,92                                     8 B]\nFetched 134 MB in 7s (20.1 MB\/s)\nSelecting previously unselected package mongodb-database-tools.\n(Reading database ... 35446 files and directories currently installed.)\nPreparing to unpack ...\/0-mongodb-database-tools_100.6.0_amd64.deb ...\nUnpacking mongodb-database-tools (100.6.0) ...\nSelecting previously unselected package mongodb-mongosh.\nPreparing to unpack ...\/1-mongodb-mongosh_1.6.0_amd64.deb ...\nUnpacking mongodb-mongosh (1.6.0) ...\nSelecting previously unselected package mongodb-org-shell.\nPreparing to unpack ...\/2-mongodb-org-shell_6.0.2_amd64.deb ...\nUnpacking mongodb-org-shell (6.0.2) ...\nSelecting previously unselected package mongodb-org-server.\nPreparing to unpack ...\/3-mongodb-org-server_6.0.2_amd64.deb ...\nUnpacking mongodb-org-server (6.0.2) ...\nSelecting previously unselected package mongodb-org-mongos.\nPreparing to unpack ...\/4-mongodb-org-mongos_6.0.2_amd64.deb ...\nUnpacking mongodb-org-mongos (6.0.2) ...\nSelecting previously unselected package mongodb-org-database-tools-extra.\nPreparing to unpack ...\/5-mongodb-org-database-tools-extra_6.0.2_amd64.deb ...\nUnpacking mongodb-org-database-tools-extra (6.0.2) ...\nSelecting previously unselected package mongodb-org-database.\nPreparing to unpack ...\/6-mongodb-org-database_6.0.2_amd64.deb ...\nUnpacking mongodb-org-database (6.0.2) ...\nSelecting previously unselected package mongodb-org-tools.\nPreparing to unpack ...\/7-mongodb-org-tools_6.0.2_amd64.deb ...\nUnpacking mongodb-org-tools (6.0.2) ...\nSelecting previously unselected package mongodb-org.\nPreparing to unpack ...\/8-mongodb-org_6.0.2_amd64.deb ...\nUnpacking mongodb-org (6.0.2) ...\nSetting up mongodb-mongosh (1.6.0) ...\nSetting up mongodb-org-server (6.0.2) ...\nAdding system user `mongodb' (UID 107) ...\nAdding new user `mongodb' (UID 107) with group `nogroup' ...\nNot creating home directory `\/home\/mongodb'.\nAdding group `mongodb' (GID 114) ...\nDone.\nAdding user `mongodb' to group `mongodb' ...\nAdding user mongodb to group mongodb\nDone.\nSetting up mongodb-org-shell (6.0.2) ...\nSetting up mongodb-database-tools (100.6.0) ...\nSetting up mongodb-org-mongos (6.0.2) ...\nSetting up mongodb-org-database-tools-extra (6.0.2) ...\nSetting up mongodb-org-database (6.0.2) ...\nSetting up mongodb-org-tools (6.0.2) ...\nSetting up mongodb-org (6.0.2) ...\nProcessing triggers for man-db (2.9.4-2) ...\n<\/pre>\n<p>Enable the MongoDB service to start on boot with the following command.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo systemctl enable mongod\n<\/pre>\n<p>Output<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n...Created symlink \/etc\/systemd\/system\/multi-user.target.wants\/mongod.service \u2192 \/lib\/systemd\/system\/mongod.service.\n<\/pre>\n<p>Start MongoDB<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo systemctl start mongod\n<\/pre>\n<p>Check status:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo systemctl status mongod\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u25cf mongod.service - MongoDB Database Server\n     Loaded: loaded (\/lib\/systemd\/system\/mongod.service; enabled; vendor preset: enabled)\n     Active: active (running) since Thu 2022-10-20 12:12:56 CDT; 1min 22s ago\n       Docs: https:\/\/docs.mongodb.org\/manual\n   Main PID: 7749 (mongod)\n     Memory: 76.6M\n        CPU: 1.053s\n     CGroup: \/system.slice\/mongod.service\n             \u2514\u25007749 \/usr\/bin\/mongod --config \/etc\/mongod.conf\n<\/pre>\n<p>Verify your MongoDB\u2019s successful installation with the following command. (This used to be &#8220;mongo&#8221; but has been replaced by &#8220;mongosh&#8221; in version 6.).<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmongosh --eval 'db.runCommand({ connectionStatus: 1 })'\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCurrent Mongosh Log ID: 6351852ac5d17178a2b8eee3\nConnecting to:          mongodb:\/\/127.0.0.1:27017\/?directConnection=true&amp;serverSelectionTimeoutMS=2000&amp;appName=mongosh+1.6.0\nUsing MongoDB:          6.0.2\nUsing Mongosh:          1.6.0\n\nFor mongosh info see: https:\/\/docs.mongodb.com\/mongodb-shell\/\n\n\nTo help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https:\/\/www.mongodb.com\/legal\/privacy-policy).\nYou can opt-out by running the disableTelemetry() command.\n\n------\n   The server generated these startup warnings when booting\n   2022-10-20T12:12:56.716-05:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http:\/\/dochub.mongodb.org\/core\/prodnotes-filesystem\n   2022-10-20T12:12:57.427-05:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted\n   2022-10-20T12:12:57.428-05:00: \/sys\/kernel\/mm\/transparent_hugepage\/enabled is 'always'. We suggest setting it to 'never'\n   2022-10-20T12:12:57.428-05:00: vm.max_map_count is too low\n------\n\n------\n   Enable MongoDB's free cloud-based monitoring service, which will then receive and display\n   metrics about your deployment (disk utilization, CPU, operation statistics, etc).\n\n   The monitoring data will be available on a MongoDB website with a unique URL accessible to you\n   and anyone you share the URL with. MongoDB may use this information to make product\n   improvements and to suggest MongoDB products and deployment options to you.\n\n   To enable free monitoring, run the following command: db.enableFreeMonitoring()\n   To permanently disable this reminder, run the following command: db.disableFreeMonitoring()\n------\n\n{\n  authInfo: { authenticatedUsers: &#x5B;], authenticatedUserRoles: &#x5B;] },\n  ok: 1\n}\n\n<\/pre>\n<p>Configure MongoDB<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo nano \/etc\/mongod.conf\n<\/pre>\n<p>Go to the &#8220;#security&#8221; section and comment out security and add the following line of code. (note spaces!!)<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsecurity:\n  authorization: enabled\n<\/pre>\n<p>Next, go to the #network interfaces section and add your system IP in the bindIp field.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnet:\nport: 27017\nbindIp: 127.0.0.1,192.168.0.20\n<\/pre>\n<p>Save and exit the configuration file.<\/p>\n<p>Restart the MongoDB service for the changes to take effect.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo systemctl restart mongod\n<\/pre>\n<p>Create MongoDB Admin User<\/p>\n<p>For that, launch the MongoDB shell using the following command.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmongosh\nCurrent Mongosh Log ID: 6351a5fe6f68885a7b8b95d0\nConnecting to:          mongodb:\/\/127.0.0.1:27017\/?directConnection=true&amp;serverSelectionTimeoutMS=2000&amp;appName=mongosh+1.6.0\nUsing MongoDB:          6.0.2\nUsing Mongosh:          1.6.0\n\nFor mongosh info see: https:\/\/docs.mongodb.com\/mongodb-shell\/\n\ntest&gt;\n<\/pre>\n<p>Change to the admin database.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ntest&gt; use admin\nswitched to db admin\nadmin&gt;\n<\/pre>\n<p>And run the following command to add the admin user. Enter a password when prompted.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nadmin&gt; db.createUser({user: &quot;admin&quot; , pwd: passwordPrompt() , roles: &#x5B;{ role: &quot;userAdminAnyDatabase&quot; , db: &quot;admin&quot;}]})\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nEnter password\n****{ ok: 1 }\n<\/pre>\n<p>Setup the password on the prompt.<\/p>\n<p>Now type exit to get out of the MongoDB shell.<\/p>\n<p>Connect to the MongoDB<br \/>\nNow, you can use the admin user to connect to the MongoDB shell with the following command.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo mongosh --port 27017 --authenticationDatabase &quot;admin&quot; -u &quot;admin&quot; -p\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nEnter password: **********\nCurrent Mongosh Log ID: 6351a75c4e0ef8b1b32b0b73\nConnecting to:          mongodb:\/\/&lt;credentials&gt;@127.0.0.1:27017\/?directConnection=true&amp;serverSelectionTimeoutMS=2000&amp;authSource=admin&amp;appName=mongosh+1.6.0\nUsing MongoDB:          6.0.2\nUsing Mongosh:          1.6.0\n\nFor mongosh info see: https:\/\/docs.mongodb.com\/mongodb-shell\/\n\ntest&gt;\n<\/pre>\n<p>Uninstall MongoDB Community Edition<br \/>\nTo completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.<\/p>\n<p>Stop MongoDB.<br \/>\nStop the mongod process by issuing the following command:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo service mongod stop\n<\/pre>\n<p>Remove Packages.<br \/>\nRemove any MongoDB packages that you had previously installed.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo apt-get purge mongodb-org*\n<\/pre>\n<p>Remove Data Directories.<br \/>\nRemove MongoDB databases and log files.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ sudo rm -r \/var\/log\/mongodb\n$ sudo rm -r \/var\/lib\/mongodb\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article covers how to install MongoDB (Community Edition Tutorial) on Debian 11. MongoDB is a popular open source NoSQL database. It is a document oriented database that supports structured and unstructured data, including JSON, XML, and organic data.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-6884","post","type-post","status-publish","format-standard","hentry","category-mongodb"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=6884"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6884\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=6884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=6884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=6884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}