{"id":5375,"date":"2022-04-21T23:10:56","date_gmt":"2022-04-21T14:10:56","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=5375"},"modified":"2023-07-11T06:24:33","modified_gmt":"2023-07-10T21:24:33","slug":"ubuntu-20-04%e3%81%abmongodzb-5-0%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/5375","title":{"rendered":"MongoDB 5.0\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01\uff08Ubuntu Server 20.04\uff09"},"content":{"rendered":"<p>Ubuntu 20.04\u306bMongoDB 5.0\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>MongoDB\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u7528\u306e\u30ad\u30fc\u3092\u8ffd\u52a0\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u7528\u306e\u30ad\u30fc\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ wget -qO - https:\/\/www.mongodb.org\/static\/pgp\/server-5.0.asc | sudo apt-key add -\r\n<\/pre>\n<h2>MongoDB\u7528\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u7528\u306e\u30ea\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u7528\u306e\u30ea\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo echo &quot;deb &#x5B; arch=amd64,arm64 ] https:\/\/repo.mongodb.org\/apt\/ubuntu focal\/mongodb-org\/5.0 multiverse&quot; | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-5.0.list\r\n<\/pre>\n<h2>MongoDB\u7528\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u7528\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30ea\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get update\r\n<\/pre>\n<h2>MongoDB\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get install -y mongodb-org\r\n<\/pre>\n<h2>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl start mongod\r\n$ sudo systemctl status mongod\r\n<\/pre>\n<h2>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u81ea\u52d5\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u81ea\u52d5\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl enable mongod\r\n<\/pre>\n<h2>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$sudo systemctl stop mongod\r\n<\/pre>\n<h2>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u518d\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl restart mongod\r\n<\/pre>\n<h2>MongoDB\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5834\u5408\u306f\u3001\u307e\u305a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get purge mongodb-org*\r\n<\/pre>\n<p>\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30ed\u30b0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo rm -r \/var\/log\/mongodb\r\n$ sudo rm -r \/var\/lib\/mongodb\r\n<\/pre>\n<h2>MongoDB\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306b\u63a5\u7d9a\u3057\u307e\u3059\uff01<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mongosh\r\n<\/pre>\n<h2>MongoDB\u306b\u63a5\u7d9a\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u304b\u3089\u5207\u65ad\u3057\u307e\u3059\uff01exit\u3067\u3082quit\u3067\u3082\u5207\u65ad\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ntest&gt; exit\r\n<\/pre>\n<h2>MongoDB\u306e\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ls -l \/var\/lib\/mongodb\r\n<\/pre>\n<h2>MongoDB\u306e\u30ed\u30b0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u30ed\u30b0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ls -l \/var\/log\/mongodb\r\n<\/pre>\n<h2>MongoDB\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>MongoDB\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cat \/etc\/mongod.conf\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>MongoDB\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3001\u30de\u30cb\u30e5\u30a2\u30eb\u901a\u308a\u3067\u554f\u984c\u306a\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003\u60c5\u5831<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.mongodb.com\/docs\/\" target=\"_blank\" rel=\"noopener\">MongoDB - Documentation<\/a><\/li>\n<li><a href=\"https:\/\/www.mongodb.com\/docs\/manual\/\" target=\"_blank\" rel=\"noopener\">MongoDB Server - Manual<\/a><\/li>\n<\/ul>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/9850\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011MongoDB\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2018\/09\/eyecatch_mongodb_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011MongoDB\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01<\/div><div class=\"substr\">MongoDB\u3092\u4f7f\u3044\u3053\u306a\u3059\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u53c2\u8003\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><iframe sandbox=\"allow-popups allow-scripts allow-modals allow-forms allow-same-origin\" style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=infotecr-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=B07BGC4MJ1&linkId=0d0d3ef2181b83931f80739f4cfceb0e\"><\/iframe><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 20.04\u306bMongoDB 5.0\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":9875,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[74,51,359,672,52],"class_list":["post-5375","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mongodb","tag-mongodb","tag-ubuntu","tag-ubuntu-server","tag-ubuntu-server-20-04","tag-52"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=5375"}],"version-history":[{"count":8,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5375\/revisions"}],"predecessor-version":[{"id":12695,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5375\/revisions\/12695"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/9875"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=5375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=5375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=5375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}