{"id":17184,"date":"2025-04-18T23:38:49","date_gmt":"2025-04-18T15:38:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17184.html"},"modified":"2025-04-18T23:38:49","modified_gmt":"2025-04-18T15:38:49","slug":"%e5%9c%a8-ubuntu-%e4%b8%8b%e9%80%9a%e8%bf%87-docker-%e9%83%a8%e7%bd%b2-mastodon-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17184.html","title":{"rendered":"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668"},"content":{"rendered":"<h4>\u5f15\u8a00<\/h4>\n<p>Mastodon \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0&#xff0c;\u5141\u8bb8\u7528\u6237\u5efa\u7acb\u81ea\u5df1\u7684\u793e\u533a\u5e76\u4e0e\u5176\u4ed6\u793e\u533a\u4e92\u52a8\u3002\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5feb\u901f\u3001\u4fbf\u6377\u7684\u73af\u5883\u642d\u5efa\u3002Docker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u5316\u5e73\u53f0&#xff0c;\u4f7f\u5f97\u5e94\u7528\u53ef\u4ee5\u5728\u9694\u79bb\u7684\u73af\u5883\u4e2d\u8fd0\u884c&#xff0c;\u786e\u4fdd\u4e00\u81f4\u6027\u548c\u53ef\u79fb\u690d\u6027\u3002\u4f7f\u7528 Docker \u90e8\u7f72 Mastodon&#xff0c;\u4f60\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u5e94\u7528\u7684\u4f9d\u8d56\u548c\u7248\u672c\u3002<\/p>\n<h4>\u670d\u52a1\u5668\u914d\u7f6e\u8bc4\u4f30<\/h4>\n<p>\u672c\u6b21\u5b9e\u9a8c\u4f7f\u7528\u7684\u662f\u963f\u8d1d\u4e91\u7684\u514d\u8d39\u670d\u52a1\u5668&#xff0c;\u914d\u7f6e\u4e3a 1 \u6838 CPU\u30011G \u5185\u5b58\u548c 5M \u5e26\u5bbd\u3002\u867d\u7136\u8fd9\u4e2a\u914d\u7f6e\u5728\u8d44\u6e90\u4e0a\u8f83\u4e3a\u7d27\u5f20&#xff0c;\u4f46\u5bf9\u4e8e\u6d4b\u8bd5\u548c\u5b66\u4e60 Mastodon \u7684\u57fa\u672c\u529f\u80fd\u662f\u8db3\u591f\u7684&#xff0c;\u57fa\u672c\u80fd\u591f\u6ee1\u8db3\u9700\u6c42\u3002<\/p>\n<h4>\u90e8\u7f72\u6559\u7a0b<\/h4>\n<h5>\u6b65\u9aa4 1: \u5b89\u88c5 Docker \u548c Docker Compose<\/h5>\n<p>\u9996\u5148&#xff0c;\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u662f\u6700\u65b0\u7684&#xff0c;\u7136\u540e\u5b89\u88c5 Docker \u548c Docker Compose\u3002<\/p>\n<p>sudo apt update<br \/>\nsudo apt upgrade -y<br \/>\nsudo apt install docker.io docker-compose -y<\/p>\n<h5>\u6b65\u9aa4 2: \u521b\u5efa Mastodon \u76ee\u5f55<\/h5>\n<p>\u5728\u4f60\u7684\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u76ee\u5f55\u7528\u4e8e\u5b58\u653e Mastodon \u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>mkdir ~\/mastodon<br \/>\ncd ~\/mastodon<\/p>\n<h5>\u6b65\u9aa4 3: \u521b\u5efa Docker Compose \u6587\u4ef6<\/h5>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a docker-compose.yml \u7684\u6587\u4ef6&#xff0c;\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p>version: &#039;3&#039;<\/p>\n<p>services:<br \/>\n  web:<br \/>\n    image: tootsuite\/mastodon<br \/>\n    restart: always<br \/>\n    environment:<br \/>\n      &#8211; LOCAL_DOMAIN&#061;example.com<br \/>\n      &#8211; SECRET_KEY_BASE&#061;your_secret_key<br \/>\n      &#8211; OTP_SECRET&#061;your_otp_secret<br \/>\n      &#8211; DATABASE_URL&#061;postgres:\/\/mastodon:password&#064;db\/mastodon<br \/>\n      &#8211; REDIS_HOST&#061;redis<br \/>\n      &#8211; SMTP_SERVER&#061;smtp.example.com<br \/>\n      &#8211; SMTP_PORT&#061;587<br \/>\n      &#8211; SMTP_LOGIN&#061;user&#064;example.com<br \/>\n      &#8211; SMTP_PASSWORD&#061;your_smtp_password<br \/>\n      &#8211; SMTP_FROM_ADDRESS&#061;from&#064;example.com<br \/>\n    ports:<br \/>\n      &#8211; &#034;3000:3000&#034;<br \/>\n    depends_on:<br \/>\n      &#8211; db<br \/>\n      &#8211; redis<\/p>\n<p>  db:<br \/>\n    image: postgres:latest<br \/>\n    restart: always<br \/>\n    environment:<br \/>\n      &#8211; POSTGRES_USER&#061;mastodon<br \/>\n      &#8211; POSTGRES_PASSWORD&#061;password<br \/>\n      &#8211; POSTGRES_DB&#061;mastodon<\/p>\n<p>  redis:<br \/>\n    image: redis:latest<br \/>\n    restart: always<\/p>\n<h5>\u6b65\u9aa4 4: \u542f\u52a8\u670d\u52a1<\/h5>\n<p>\u4f7f\u7528 Docker Compose \u542f\u52a8 Mastodon \u670d\u52a1\u3002<\/p>\n<p>docker-compose up -d<\/p>\n<h5>\u6b65\u9aa4 5: \u521d\u59cb\u5316\u6570\u636e\u5e93<\/h5>\n<p>\u8fdb\u5165 web \u5bb9\u5668&#xff0c;\u521d\u59cb\u5316\u6570\u636e\u5e93\u3002<\/p>\n<p>docker-compose exec web rails db:migrate<br \/>\ndocker-compose exec web rails db:seed<\/p>\n<h5>\u6b65\u9aa4 6: \u8bbf\u95ee Mastodon<\/h5>\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee http:\/\/your_server_ip:3000&#xff0c;\u4f60\u5e94\u8be5\u80fd\u591f\u770b\u5230 Mastodon \u7684\u4e3b\u9875\u3002\u6839\u636e\u63d0\u793a\u5b8c\u6210\u6ce8\u518c\u548c\u8bbe\u7f6e\u3002<\/p>\n<h4>\u603b\u7ed3<\/h4>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4&#xff0c;\u4f60\u53ef\u4ee5\u5728 Ubuntu \u4e0a\u6210\u529f\u901a\u8fc7 Docker \u90e8\u7f72\u4e00\u4e2a Mastodon \u670d\u52a1\u5668\u3002\u867d\u7136\u5728\u8d44\u6e90\u6709\u9650\u7684\u60c5\u51b5\u4e0b\u8fd0\u884c&#xff0c;\u4f46\u5bf9\u4e8e\u5b66\u4e60\u548c\u6d4b\u8bd5\u6765\u8bf4&#xff0c;\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u7b80\u5355\u800c\u6709\u8da3\u7684\u3002\u5e0c\u671b\u4f60\u80fd\u5728\u8fd9\u4e2a\u5e73\u53f0\u4e0a\u627e\u5230\u4e50\u8da3&#xff0c;\u5efa\u7acb\u5c5e\u4e8e\u81ea\u5df1\u7684\u793e\u4ea4\u7f51\u7edc\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb828\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668_mastodon\u642d\u5efa\u6559\u7a0b<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27,103,43],"topic":[],"class_list":["post-17184","post","type-post","status-publish","format-standard","hentry","category-server","tag-docker","tag-ubuntu","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\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.wsisp.com\/helps\/17184.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb828\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668_mastodon\u642d\u5efa\u6559\u7a0b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17184.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:38:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17184.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17184.html\",\"name\":\"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:38:49+00:00\",\"dateModified\":\"2025-04-18T15:38:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17184.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17184.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17184.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/17184.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb828\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668_mastodon\u642d\u5efa\u6559\u7a0b","og_url":"https:\/\/www.wsisp.com\/helps\/17184.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:38:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/17184.html","url":"https:\/\/www.wsisp.com\/helps\/17184.html","name":"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:38:49+00:00","dateModified":"2025-04-18T15:38:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17184.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17184.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17184.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5728 Ubuntu \u4e0b\u901a\u8fc7 Docker \u90e8\u7f72 Mastodon \u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=17184"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17184\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17184"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}