{"id":49,"date":"2024-09-20T12:04:56","date_gmt":"2024-09-20T04:04:56","guid":{"rendered":"https:\/\/blog.easitch.com\/?p=49"},"modified":"2026-06-09T16:23:40","modified_gmt":"2026-06-09T08:23:40","slug":"linux%e4%bd%bf%e7%94%a8%e6%a2%af%e5%ad%90","status":"publish","type":"post","link":"https:\/\/blog.eastfond.com\/?p=49","title":{"rendered":"Linux\u4f7f\u7528\u68af\u5b50"},"content":{"rendered":"<h1>\u865a\u62df\u673a<\/h1>\n<h2>\u5fc5\u8981\u6761\u4ef6<\/h2>\n<ol>\n<li>\u865a\u62df\u673a\u80fd\u591f\u6b63\u5e38\u8bbf\u95ee\u672c\u673a\u7684IP<\/li>\n<li>\u865a\u62df\u673a\u53ef\u4ee5\u6b63\u5e38\u8054\u7f51<\/li>\n<li>\u672c\u673a\u53ef\u4ee5\u6b63\u5e38\u7ffb\u5899<\/li>\n<\/ol>\n<h2>\u5b89\u88c5<\/h2>\n<p>\u9996\u5148\u9700\u8981\u5728\u672c\u673a\u4e0a\u6709\u4e00\u4e2a\u7ffb\u5899\u5de5\u5177\uff08v2Ray\u3001Clash\u7b49\uff09\uff0c\u7136\u540e\u9700\u8981\u5728\u5bf9\u5e94\u7684\u8bbe\u7f6e\u91cc\u5f00\u542f<code>\u5141\u8bb8\u5c40\u57df\u7f51\u8bbf\u95ee<\/code>\uff01\uff01\uff01\u3002<\/p>\n<ol>\n<li>\u5728\u865a\u62df\u673a\u4e2d\u521b\u5efaproxy.sh\uff0c<code>touch \/etc\/profile.d\/proxy.sh<\/code>\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\u3002<\/li>\n<\/ol>\n<pre><code># \u5f00\u542f\u7cfb\u7edf\u4ee3\u7406\nproxy_on() {\n        export http_proxy=http:\/\/vpn:7890\n        export https_proxy=http:\/\/vpn:7890\n        export no_proxy=127.0.0.1,localhost\n        export HTTP_PROXY=http:\/\/vpn:7890\n        export HTTPS_PROXY=http:\/\/vpn:7890\n        export NO_PROXY=127.0.0.1,localhost\n        echo -e &quot;\\033[32m[\u221a] \u5df2\u5f00\u542f\u4ee3\u7406\\033[0m&quot;\n}\n\n# \u5173\u95ed\u7cfb\u7edf\u4ee3\u7406\nproxy_off(){\n        unset http_proxy\n        unset https_proxy\n        unset no_proxy\n        unset HTTP_PROXY\n        unset HTTPS_PROXY\n        unset NO_PROXY\n        echo -e &quot;\\033[31m[\u00d7] \u5df2\u5173\u95ed\u4ee3\u7406\\033[0m&quot;\n}<\/code><\/pre>\n<pre><code>chmod +x \/etc\/profile.d\/proxy.sh<\/code><\/pre>\n<ol start=\"2\">\n<li>\u7f16\u8f91hosts\u6587\u4ef6\uff0c<code>vim \/etc\/hosts<\/code>\uff0c\u6dfb\u52a0\u672c\u673aIP\u3002<\/li>\n<\/ol>\n<pre><code>192.168.xx.xxx vpn<\/code><\/pre>\n<ol start=\"3\">\n<li>\u5f00\u542f\u4ee3\u7406<\/li>\n<\/ol>\n<pre><code># \u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\nsource \/etc\/profile.d\/proxy.sh\n# \u5f00\u542f\u4ee3\u7406\nproxy_on\n# \u5173\u95ed\u4ee3\u7406\nproxy_off<\/code><\/pre>\n<h1>\u4e91\u670d\u52a1\u5668<\/h1>\n<blockquote>\n<p>\u4e24\u79cd\u65b9\u5f0f<\/p>\n<ol>\n<li>\u5982\u679c\u662f\u81ea\u5df1\u4e70\u7684\uff0c\u90a3\u4e48\u4f1a\u6709\u4e00\u4e2a\u8ba2\u9605\u94fe\u63a5\uff0c\u4f7f\u7528\u65b9\u5f0f\u4e00<\/li>\n<li>\u5982\u679c\u662f\u81ea\u5df1\u901a\u8fc7VPS\u642d\u5efa\u7684\uff0c\u5e94\u8be5\u4f1a\u751f\u6210sing-box\u7684json\u6587\u4ef6\uff0c\u4f7f\u7528\u65b9\u5f0f\u4e8c<\/li>\n<\/ol>\n<\/blockquote>\n<h2>\u65b9\u5f0f\u4e00<\/h2>\n<ol>\n<li><strong>\u514b\u9686\u9879\u76ee<\/strong><\/li>\n<\/ol>\n<pre><code>git clone https:\/\/github.com\/dong152389\/clash-for-linux-backup.git<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>\u7528\u81ea\u5df1\u7684\u8ba2\u9605\u5730\u5740\u66ff\u6362 .env \u4e2d\u7684\u201c\u8ba2\u9605\u5730\u5740\u201d<\/strong><\/li>\n<\/ol>\n<pre><code>vim .env<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>\u542f\u52a8 clash<\/strong><\/li>\n<\/ol>\n<pre><code>$ sudo bash start.sh\n\n\u6b63\u5728\u68c0\u6d4b\u8ba2\u9605\u5730\u5740...\nClash\u8ba2\u9605\u5730\u5740\u53ef\u8bbf\u95ee\uff01                                      [  OK  ]\n\n\u6b63\u5728\u4e0b\u8f7dClash\u914d\u7f6e\u6587\u4ef6...\n\u914d\u7f6e\u6587\u4ef6config.yaml\u4e0b\u8f7d\u6210\u529f\uff01                              [  OK  ]\n\n\u6b63\u5728\u542f\u52a8Clash\u670d\u52a1...\n\u670d\u52a1\u542f\u52a8\u6210\u529f\uff01                                             [  OK  ]\n\nClash Dashboard \u8bbf\u95ee\u5730\u5740\uff1ahttp:\/\/&lt;ip&gt;:9090\/ui\nSecret\uff1axxxxxxxxxxxxx\n\n\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u52a0\u8f7d\u73af\u5883\u53d8\u91cf: source \/etc\/profile.d\/clash.sh\n\n\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5f00\u542f\u7cfb\u7edf\u4ee3\u7406: proxy_on\n\n\u82e5\u8981\u4e34\u65f6\u5173\u95ed\u7cfb\u7edf\u4ee3\u7406\uff0c\u8bf7\u6267\u884c: proxy_off<\/code><\/pre>\n<pre><code>$ netstat -tln | grep -E &#039;9090|789.&#039;\ntcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN     \ntcp6       0      0 :::7890                 :::*                    LISTEN     \ntcp6       0      0 :::7891                 :::*                    LISTEN     \ntcp6       0      0 :::7892                 :::*                    LISTEN<\/code><\/pre>\n<pre><code>$ env | grep -E &#039;http_proxy|https_proxy&#039;\nhttp_proxy=http:\/\/127.0.0.1:7890\nhttps_proxy=http:\/\/127.0.0.1:7890<\/code><\/pre>\n<h2>\u65b9\u5f0f\u4e8c<\/h2>\n<blockquote>\n<p>\u53ef\u9009\u672c\u5730\u5b89\u88c5\u6216\u8005Docker\u5b89\u88c5<\/p>\n<\/blockquote>\n<h1>\u914d\u7f6eDocker\u7684\u4ee3\u7406\u5730\u5740<\/h1>\n<blockquote>\n<p>\u4e0a\u9762\u6240\u914d\u7f6e\u7684\u90fd\u662fLinux\u672c\u5730\u5b89\u88c5\u7684\u65f6\u5019\u7684\u4ee3\u7406\u5730\u5740\uff0c\u4f8b\u5982\uff1awget\u3001curl\u3001git clone\u7b49\u7b49\uff0c\u4f7f\u7528docker\u5b89\u88c5\u5e94\u7528\u7684\u65f6\u5019\u662f\u65e0\u6548\u7684\uff0c\u9700\u8981\u914d\u7f6edocker\u81ea\u8eab\u7684\u4ee3\u7406\u5730\u5740\u3002<\/p>\n<\/blockquote>\n<h2>\u5220\u9664daemon.json<\/h2>\n<p>\u8fd9\u91cc\u7684\u955c\u50cf\u52a0\u901f\u5668\u9700\u8981\u5220\u9664\u6389\uff0c\u4e00\u65e6\u914d\u7f6e\u597d\u4ee3\u7406\u540e\u901f\u5ea6\u4f1a\u66f4\u5feb\uff0c\u5176\u5b9e\u8fd9\u4e2adaemon.json\u6839\u672c\u4e5f\u6ca1\u4ec0\u4e48\u7528\uff0c\u8be5\u4e0b\u8f7d\u4e0d\u4e0b\u6765\u8fd8\u662f\u4e0b\u8f7d\u4e0d\u4e0b\u6765\u3002<\/p>\n<pre><code class=\"language-bash\">rm \/etc\/docker\/daemon.json<\/code><\/pre>\n<h2>\u4e3a docker \u914d\u7f6e HTTP\/HTTPS \u7f51\u7edc\u4ee3\u7406<\/h2>\n<pre><code class=\"language-bash\">sudo mkdir -p \/etc\/systemd\/system\/docker.service.d\nsudo touch \/etc\/systemd\/system\/docker.service.d\/docker.conf\n# \u7f16\u8f91 docker.conf\nvim \/etc\/systemd\/system\/docker.service.d\/docker.conf<\/code><\/pre>\n<pre><code class=\"language-bash\"># \u65b0\u589e\u5982\u4e0b\u5185\u5bb9\uff0c\u5982\u679c\u662fhttp\u7684\u65b9\u5f0f\u8bf7\u5199\u6210http:\/\/vpn:10809\/\n[Service]\nEnvironment=&quot;HTTP_PROXY=http:\/\/vpn:10808\/&quot;\nEnvironment=&quot;HTTPS_PROXY=http:\/\/vpn:10808\/&quot;<\/code><\/pre>\n<pre><code class=\"language-bash\"># \u91cd\u542f Docker\nsudo systemctl daemon-reload\nsudo systemctl restart docker<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u865a\u62df\u673a \u5fc5\u8981\u6761\u4ef6 \u865a\u62df\u673a\u80fd\u591f\u6b63\u5e38\u8bbf\u95ee\u672c\u673a\u7684IP \u865a\u62df\u673a\u53ef\u4ee5\u6b63\u5e38\u8054\u7f51 \u672c\u673a\u53ef\u4ee5\u6b63\u5e38\u7ffb\u5899 \u5b89\u88c5 \u9996\u5148\u9700\u8981\u5728\u672c\u673a\u4e0a\u6709 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,4],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-linux","category-posts"],"_links":{"self":[{"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":10,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":615,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/615"}],"wp:attachment":[{"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.eastfond.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}