{"id":141,"date":"2023-03-11T14:52:49","date_gmt":"2023-03-11T06:52:49","guid":{"rendered":"http:\/\/jemlab.cn\/?p=141"},"modified":"2023-03-12T16:31:57","modified_gmt":"2023-03-12T08:31:57","slug":"ubuntu-%e9%85%8d%e7%bd%aeclash-%ef%bc%88%e9%80%82%e7%94%a8%e4%ba%8e%e6%89%80%e6%9c%89%e7%89%88%e6%9c%ac%ef%bc%89%e3%80%90%e8%bd%ac%e8%bd%bd%e3%80%91","status":"publish","type":"post","link":"http:\/\/jemlab.cn\/?p=141","title":{"rendered":"Ubuntu \u914d\u7f6eclash \uff08\u9002\u7528\u4e8e\u6240\u6709\u7248\u672c\uff09\u3010\u8f6c\u8f7d\u3011"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\u81ea\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/598337110<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h_598337110_0\"><strong>\u4e00\u3001\u4e0b\u8f7dclash\u5e76\u914d\u7f6e<\/strong><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p># \u5b98\u65b9\u7f51\u7ad9<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Dreamacro\/clash\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">clash<\/a>\u4e0b\u8f7d\u6587\u4ef6\uff1a<strong>clash-linux-amd64-v1.12.0.gz<\/strong>\uff08\u4e5f\u53ef\u4ee5\u4e0b\u8f7d\u6700\u65b0\u7684\u7248\u672c\uff0c\u524d\u7f00\u662fclash-linux-amd64\u5373\u53ef\uff09<br>\u8fdb\u5165\u8be5\u6587\u4ef6\u6240\u5728\u76ee\u5f55\uff0c\u5728\u9875\u9762\u7a7a\u767d\u5904\u53f3\u952e\uff0c\u5728\u7ec8\u7aef\u6253\u5f00<br>1. \u89e3\u538b<br><strong>gunzip clash-linux-amd64-v1.12.0.gz<\/strong><br>2. \u5c06clash-linux-amd64-v1.12.0\u6587\u4ef6\u91cd\u547d\u540d\u4e3aclash<br><strong>mv clash-linux-amd64-v1.12.0 clash<\/strong><br>3. \u5728\u6b64\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6\u5939\uff08\u6ce8\u610f\u8fd9\u91cc\u7528\u5927\u5199Clash\u53ea\u662f\u4e3a\u4e86\u548cclash\u533a\u522b\u5f00\uff09<br><strong>mkdir Clash<\/strong><br>4. \u79fb\u52a8clash\u6587\u4ef6\u5939\u5230Clash\u6587\u4ef6\u5939<br><strong>mv clash .\/Clash<\/strong><br>5. \u8fdb\u5165Clash\u6587\u4ef6\u5939<br><strong>cd Clash<\/strong><br>6. \u4e0b\u8f7dclash \u914d\u7f6e\u6587\u4ef6config.yaml \uff08\u6ce8\u610f\uff1a\u8fd9\u4e2a\u8ba2\u9605\u94fe\u63a5\u662f\u81ea\u5df1\u7684\uff0c\u66ff\u4ee3 [\u8ba2\u9605\u94fe\u63a5]\uff0c\u5982\u679c\u5931\u8d25\u4e86\u8bf4\u660e\u8ba2\u9605\u94fe\u63a5\u6709\u95ee\u9898\uff09<br><strong>wget -O config.yaml [\u8ba2\u9605\u94fe\u63a5]<\/strong><br>7. \u4e0b\u8f7dCountry.mmdb<br><strong>wget -O Country.mmdb&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/www.sub-speeder.com\/client-download\/Country.mmdb\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.sub-speeder.com\/client-download\/Country.mmdb<\/a><\/strong><br>\u6ce8\u610f\uff1a\u5982\u679c\u6b65\u9aa47\u5931\u8d25\u4e86\u4e5f\u6ca1\u5173\u7cfb\uff0c\u76f4\u63a5\u8df3\u8fc7\u8fd9\u4e00\u6b65\uff0c\u540e\u9762\u4e5f\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u3002\u4e5f\u53ef\u4ee5\u5728\u7f51\u5740<a href=\"https:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Loyalsoldier\/geoip\/releases\/download\/202212010123\/Country.mmdb\" target=\"_blank\" rel=\"noreferrer noopener\">Country.mmdb<\/a>\u4e0b\u8f7d\u3002<br>8. \u542f\u52a8clash<br><strong>.\/clash -d .<\/strong><br>\u6ce8\u610f\uff1a\u5982\u679c\u63d0\u793a\u6743\u9650\u4e0d\u8db3\uff0c\u5148\u6267\u884c&nbsp;<strong>chmod +x clash<\/strong>&nbsp;\uff0c\u518d\u6267\u884c&nbsp;<strong>.\/clash -d .<\/strong>&nbsp;\u51fa\u73b0\u5982\u4e0b\u8868\u793a\u6210\u529f\uff0c\u5e76\u4fdd\u6301\u6b64\u7ec8\u7aef\u6253\u5f00<br>9. \u6253\u5f00\u914d\u7f6e\u6587\u4ef6config.yaml \uff0c\u7ed9\u5b83\u8bbe\u7f6e\u4e00\u4e2a\u5bc6\u7801\uff1a # RESTful API \u7684\u53e3\u4ee4 secret: &#8216;123456&#8217;<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-0befeb7cc67c64ef034394bdb48aa908_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>10. \u6253\u5f00\u7cfb\u7edf\u8bbe\u7f6e\uff0c\u9009\u62e9\u7f51\u7edc\uff0c\u70b9\u51fb\u7f51\u7edc\u4ee3\u7406\u53f3\u8fb9\u7684 \u2699 \u6309\u94ae\uff0c\u9009\u62e9\u624b\u52a8\uff0c\u586b\u5199 HTTP \u548c HTTPS \u4ee3\u7406\u4e3a 127.0.0.1:7890\uff0c\u586b\u5199 Socks \u4e3b\u673a\u4e3a 127.0.0.1:7891\uff0c\u5373\u53ef\u542f\u7528\u7cfb\u7edf\u4ee3\u7406\u3002\uff08\u4e0d\u540c\u7684ubuntu\u7248\u672c\u7cfb\u7edf\u8bbe\u7f6e\u7684\u4f4d\u7f6e\u4e0d\u4e00\u6837\uff09<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-e7a859991cabe136ab116056fa3dc748_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>11. \u8bbf\u95ee&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/clash.razord.top\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/clash.razord.top\/<\/a>&nbsp;\u3002\uff08\u4ee3\u7406\u6a21\u5f0f\u9009<strong>\u89c4\u5219<\/strong>\uff09<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-4604beda74a7d09714eaaf5695283021_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u4f18\u5148\u4f7f\u7528\u706b\u72d0\u6d4f\u89c8\u5668\uff0c\u5982\u679c\u8fdb\u5230\u8fd9\u4e2a\u7f51\u7ad9\u70b9\u786e\u5b9a\u6ca1\u6709\u54cd\u5e94\uff0cf12\u770b\u770bconsole\u91cc\u9762\u7684\u62a5\u9519\u3002\u5982\u679c\u662fThe request client is not a secure context and the resource is in more-private address space `local`\uff0c\u53ef\u4ee5\u5728url\u90a3\u4e00\u680f\u8f93\u5165chrome\/\/:flags\uff0c\u641c\u7d22Block insecure private network requests\uff0c\u8c03\u6574\u4e3adisabled\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd9\u4e2a\u9875\u9762\u8981\u6c42\u63d0\u4f9b\uff0cHost,Port,Secret \u4e09\u4e2a\u8f93\u5165\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Host: 127.0.0.1  \nPort: 9090  \nSecret: 123456<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-7039cecea861b9ff5da7708b431b1299_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u4e0b\u754c\u9762\u53ef\u4ee5\u6d4b\u901f \uff08\u70b9\u84dd\u8272\u8868\u793a\u9009\u4e2d\u8fd9\u4e2a\uff09<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-198412c6db3ebf6e374043754747008d_1440w.webp\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u547d\u4ee4\u884c\u5207\u6362\u8282\u70b9\uff1a<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u7528 curl -X PUT \u6765\u8bbf\u95ee clash RESTapi\uff0c<br>\u5982\uff1a\u5148\u7528 curl&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/127.0.0.1%3A9090\/proxies\" target=\"_blank\" rel=\"noreferrer noopener\">127.0.0.1:9090\/proxies<\/a>\u67e5\u770b\u6240\u6709\u8282\u70b9\uff0c<br>\u7136\u540e curl -X PUT -H &#8220;Content-Type: application\/json&#8221; -d &#8216;{&#8220;name&#8221;:&#8221;V2-3515|\u9999\u6e2f|x2.0&#8243;}&#8217;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/127.0.0.1%3A9090\/proxies\/Proxy\" target=\"_blank\" rel=\"noreferrer noopener\">127.0.0.1:9090\/proxies\/<\/a>\u6765\u5207\u6362\u8282\u70b9<\/p>\n<\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6ce8\u610f\uff1a<\/li>\n<\/ul>\n\n\n\n<p>\uff081\uff09\u8981\u65f6\u523b\u6253\u5f00\u90a3\u4e2a\u7ec8\u7aef\uff08\u5982\u679c\u53d1\u73b0\u6ca1\u6cd5\u4e0a\u7f51\u4e86\uff0c\u4e00\u822c\u662f\u70b9\u4e86\u76f4\u63a5\u8fde\u63a5\uff0c\u67e5\u770b\u662f\u4e0d\u662f\u89c4\u5219\u8fde\u63a5\uff0c\u89c1\u6b65\u9aa411\uff09<\/p>\n\n\n\n<p>\uff082\uff09\u5982\u679c\u5931\u8d25\u4e86\uff0c\u5efa\u8bae\u91cd\u542f\u7535\u8111\uff0c\u91cd\u65b0\u518dClash\u6587\u4ef6\u5939\u4e0b\u6267\u884c&nbsp;<strong>.\/clash -d .<\/strong>&nbsp;\uff0c\u7136\u540e\u518d\u6253\u5f00\u7f51\u5740<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/clash.razord.top\/\" target=\"_blank\" rel=\"noreferrer noopener\">Clash Dashboard<\/a>\u5207\u6362\u8282\u70b9\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h_598337110_1\"><strong>\u4e8c\u3001\u914d\u7f6e\u5f00\u673a\u81ea\u542f\u52a8<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u6253\u5f00\u7ec8\u7aef\uff0c\u83b7\u53d6\u6743\u9650 \nsu \n#\u8f93\u5165\u5bc6\u7801\n#\u521b\u5efaservice\u6587\u4ef6\ntouch \/etc\/systemd\/system\/clash.service\n#\u7f16\u8f91service\u6587\u4ef6 \nvi \/etc\/systemd\/system\/clash.service \n#\u7f16\u8f91\u5982\u4e0b\u6587\u672c\uff1a \n&#91;Unit] \nDescription=clash daemon  \n&#91;Service] \nType=simple \nUser=root \nExecStart=\/home\/username\/\u4e0b\u8f7d\/Clash\/clash -d \/home\/username\/\u4e0b\u8f7d\/Clash\/ \nRestart=on-failure  \n&#91;Install] \nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p><strong>\u8bbe\u7f6e Clash \u7684\u5f00\u673a\u542f\u52a8\u9879\uff0c\u68c0\u67e5\u72b6\u6001\uff0c\u670d\u52a1\u542f\u52a8\u6210\u529f\u4e4b\u540e\uff0c\u6839\u636e\u4fe1\u606f\u8bbe\u7f6e\u81ea\u5df1\u5ba2\u6237\u7aef\u7684\u4ee3\u7406\u534f\u8bae\u7c7b\u578b\u53ca\u7aef\u53e3\uff08\u4f9d\u6b21\u8f93\u5165\uff09<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload \nsudo systemctl enable clash \nsudo systemctl start clash \nsudo systemctl status clash<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u53e6\u5916\uff0c\u8865\u5145\u4e00\u4e9b\u64cd\u4f5c\u547d\u4ee4\u4ecb\u7ecd\uff1a<\/strong><br>\u4f7f\u7528vi\u8fdb\u5165\u6587\u672c\u540e\uff0c\u6309i\u5f00\u59cb\u7f16\u8f91\u6587\u672c<br>\u9000\u51fa\u7f16\u8f91\u6a21\u5f0f \u3000\u3000<br>\u6309ESC\u952e\uff0c\u7136\u540e\uff1a \u3000\u3000\u3000\u3000<br>\u9000\u51favi \u3000\u3000\u3000<br>:q! \u4e0d\u4fdd\u5b58\u6587\u4ef6\uff0c\u5f3a\u5236\u9000\u51favi\u547d\u4ee4 \u3000\u3000\u3000<br>:w \u4fdd\u5b58\u6587\u4ef6\uff0c\u4e0d\u9000\u51favi\u547d\u4ee4 \u3000\u3000\u3000<br>:wq \u4fdd\u5b58\u6587\u4ef6\uff0c\u9000\u51favi\u547d\u4ee4<br>\u5220\u9664\u5f53\u524d\u884c \u5220\u9664 dd<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ea\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/598337110 \u4e00\u3001\u4e0b\u8f7dclash\u5e76\u914d\u7f6e&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":148,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,4],"tags":[22,15,23,24],"class_list":["post-141","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","category-article","tag-clash","tag-ubuntu","tag-vpn","tag-24"],"_links":{"self":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141"}],"version-history":[{"count":1,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":142,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions\/142"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/media\/148"}],"wp:attachment":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}