{"id":588,"date":"2024-09-15T20:27:39","date_gmt":"2024-09-15T12:27:39","guid":{"rendered":"https:\/\/blog.ttf2.cn\/?p=588"},"modified":"2024-09-15T20:27:39","modified_gmt":"2024-09-15T12:27:39","slug":"linux%e4%bb%a3%e7%90%86","status":"publish","type":"post","link":"https:\/\/blog.ttf2.cn\/index.php\/2024\/09\/15\/linux%e4%bb%a3%e7%90%86\/","title":{"rendered":"Linux\u4ee3\u7406"},"content":{"rendered":"<h4>Linux \u5168\u5c40\u4ee3\u7406<\/h4>\n<p>\u6d89\u53cawget\uff0ccurl\u7b49\uff0cdocker\u62c9\u53d6\u9700\u8981\u53e6\u5916\u914d\u7f6e<\/p>\n<p><strong>\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u4ee3\u7406\u53d8\u91cf\u7684\u914d\u7f6e:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>\u73af\u5883\u53d8\u91cf<\/th>\n<th>\u63cf\u8ff0<\/th>\n<th>\u503c\u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>http_proxy<\/td>\n<td>\u4e3ahttp\u53d8\u91cf\u8bbe\u7f6e\u4ee3\u7406\uff1b\u9ed8\u8ba4\u4e0d\u586b\u5f00\u5934\u4ee5http\u534f\u8bae\u4f20\u8f93<\/td>\n<td><a href=\"http:\/\/10.0.0.51:8080\">http:\/\/10.0.0.51:8080<\/a>  <a href=\"http:\/\/user:pass@10.0.0.10:8080\">http:\/\/user:pass@10.0.0.10:8080<\/a>    socks4:\/\/10.0.0.51:1080  socks5:\/\/192.168.1.1:1080<\/td>\n<\/tr>\n<tr>\n<td>https_proxy<\/td>\n<td>\u4e3ahttps\u53d8\u91cf\u8bbe\u7f6e\u4ee3\u7406\uff1b<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>ftp_proxy<\/td>\n<td>\u4e3aftp\u53d8\u91cf\u8bbe\u7f6e\u4ee3\u7406\uff1b<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>all_proxy<\/td>\n<td>\u5168\u90e8\u53d8\u91cf\u8bbe\u7f6e\u4ee3\u7406\uff0c\u8bbe\u7f6e\u4e86\u8fd9\u4e2a\u65f6\u5019\u4e0a\u9762\u7684\u4e0d\u7528\u8bbe\u7f6e<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>no_proxy<\/td>\n<td>\u65e0\u9700\u4ee3\u7406\u7684\u4e3b\u673a\u6216\u57df\u540d\uff1b \u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26\uff1b \u591a\u4e2a\u65f6\u4f7f\u7528\u201c,\u201d\u53f7\u5206\u9694\uff1b<\/td>\n<td>.aiezu.com,10...,192.168.., *.local,localhost,127.0.0.1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u8bbe\u7f6e\u65b9\u5f0f:<\/strong><\/p>\n<p>(1) \u4e34\u65f6\u751f\u6548(\u5f53\u524dshell\u4e0b)<\/p>\n<pre><code class=\"language-javascript\">export proxy=&quot;http:\/\/127.0.0.1:7897&quot;\nexport http_proxy=$proxy\nexport https_proxy=$proxy\nexport ftp_proxy=$proxy\nexport no_proxy=&quot;localhost, 127.0.0.1, ::1&quot;<\/code><\/pre>\n<p>(2) \u6c38\u4e45\u751f\u6548<\/p>\n<pre><code class=\"language-javascript\"># \u9488\u5bf9\u4e0a\u9762\u53d8\u91cf\u7684\u8bbe\u7f6e\u65b9\u6cd5\n1\u3001\u5728\/etc\/profile\u6587\u4ef6\n2\u3001\u5728~\/.bashrc\n3\u3001\u5728~\/.zshrc\n4\u3001\u5728\/etc\/profile.d\/\u6587\u4ef6\u5939\u4e0b\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6xxx.sh\n\n# \u4f8b\u5982\nsudo tee \/etc\/profile.d\/custom_proxy.sh &lt;&lt;&#039;END&#039;\nexport proxy=&quot;http:\/\/172.23.106.151:7897&quot;\n# export proxy=&quot;socks5:\/\/192.168.1.1:1080&quot;\nexport http_proxy=$proxy\nexport https_proxy=$proxy\nexport ftp_proxy=$proxy\nexport no_proxy=&quot;localhost,127.0.0.1,172.0.0.0\/8,192.168.0.0\/8,10.0.0.0\/8&quot; \nEND<\/code><\/pre>\n<p>\u4e0d\u8981\u7528https\u94fe\u63a5\u4ee3\u7406\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01<\/p>\n<p><strong>\u53d6\u6d88\u73af\u5883\u53d8\u91cf\u7684\u8bbe\u7f6e\uff1a<\/strong><\/p>\n<pre><code class=\"language-javascript\">unset http_proxy\nunset https_proxy\nunset ftp_proxy\nunset no_proxy<\/code><\/pre>\n<h4>Ubuntu-apt \u4ee3\u7406\u914d\u7f6e<\/h4>\n<p>\u4ee3\u7406\u53c2\u6570\u547d\u4ee4:<\/p>\n<pre><code class=\"language-javascript\"># \u4f7f\u7528 Squid cache\uff08\u7b80\u79f0\u4e3aSquid\uff09\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u81ea\u7531\u8f6f\u4ef6\uff08GNU\u901a\u7528\u516c\u5171\u8bb8\u53ef\u8bc1\uff09\u7684\u4ee3\u7406\u670d\u52a1\u5668\u548cWeb\u7f13\u5b58\u670d\u52a1\u5668\u3002\nexport http_proxy=http:\/\/192.168.1.2:3128\nexport https_proxy=http:\/\/192.168.1.2:3128\nsudo apt -o Acquire::http::proxy=&quot;http:\/\/192.168.1.2:3128\/&quot; update<\/code><\/pre>\n<h4>CentOS-yum \u4ee3\u7406\u914d\u7f6e<\/h4>\n<p>yum\u4ee3\u7406\u914d\u7f6e\u6587\u4ef6\u53d8\u91cf\u914d\u7f6e:<\/p>\n<pre><code class=\"language-javascript\"># \u5355\u72ec\u8bbe\u7f6eyum\u4ee3\u7406\u8bbf\u95ee\uff0c\u5982\u4e0b\u6587\u4ef6\u7684\u53d8\u91cf\necho &quot;proxy=http:\/\/127.0.0.1:8080\/&quot; &gt;&gt; \/etc\/yum.conf<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u5168\u5c40\u4ee3\u7406 \u6d89\u53cawget\uff0ccurl\u7b49\uff0cdocker\u62c9\u53d6\u9700\u8981\u53e6\u5916\u914d\u7f6e \u64cd\u4f5c\u7cfb\u7edf\u4e2d\u4ee3\u7406\u53d8\u91cf\u7684\u914d\u7f6e: \u73af\u5883 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.ttf2.cn\/index.php\/2024\/09\/15\/linux%e4%bb%a3%e7%90%86\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cLinux\u4ee3\u7406\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-588","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/posts\/588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/comments?post=588"}],"version-history":[{"count":1,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/posts\/588\/revisions"}],"predecessor-version":[{"id":589,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/posts\/588\/revisions\/589"}],"wp:attachment":[{"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/media?parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/categories?post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ttf2.cn\/index.php\/wp-json\/wp\/v2\/tags?post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}