{"id":911,"date":"2021-03-08T21:13:21","date_gmt":"2021-03-08T13:13:21","guid":{"rendered":"https:\/\/blog.humh.cn\/?p=911"},"modified":"2021-03-08T21:14:34","modified_gmt":"2021-03-08T13:14:34","slug":"wget%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e4%bb%a3%e7%90%86%ef%bc%8c%e5%8c%85%e5%90%absocks%e4%bb%a3%e7%90%86%e6%96%b9%e5%bc%8f%ef%bc%81","status":"publish","type":"post","link":"https:\/\/blog.humh.cn\/?p=911","title":{"rendered":"wget\u5982\u4f55\u4f7f\u7528\u4ee3\u7406\uff0c\u5305\u542bsocks\u4ee3\u7406\u65b9\u5f0f\uff01"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\u201c<a href=\"https:\/\/blog.humh.cn\/?p=908\">\u7ed9\u591a\u6570Shell\u547d\u4ee4\u542f\u7528\u4ee3\u7406<\/a>\u201d\u5df2\u7ecf\u603b\u7ed3\u8fc7\u90e8\u5206shell\u547d\u4ee4\u542f\u7528\u4ee3\u7406\u4e00\u4e8b\uff0c\u8fd9\u91cc\u4e3b\u8981\u603b\u7ed3\u4e0b<strong>wget<\/strong>\u4ee3\u7406\u9700\u8981\u6ce8\u610f\u7684\u5730\u65b9\uff01<\/p><\/blockquote>\n\n\n\n<p>\u4eca\u65e5\u5728\u4f7f\u7528wget\u4e0b\u8f7d\u4e00\u4e2a\u56fd\u5916\u955c\u50cf\u7ad9\u70b9\u7684\u8d44\u6e90\u65f6\uff0c\u53d1\u73b0\u901f\u5ea6\u975e\u5e38\u7684\u6162\uff0c\u4e0b\u8f7d\u5b8c\uff0c\u9700\u898120h\uff0c\u51e0kb\/s\u3002\u6240\u4ee5\u9700\u8981\u6302\u4ee3\u7406\uff0c\u6309\u7167\u4e0a\u7bc7\u6587\u7ae0\u7684\u65b9\u5f0f\uff0c\u914d\u7f6e\u4e86<code>ALL_PROXY<\/code>\u548c<code>all_proxy<\/code>\u5747\u4e0d\u8d77\u6548\u679c\u3002\u4e8e\u662f\u770b\u4e86\u770bwget\u7684man\u6587\u6863\uff0c\u5176\u4e2d<code>-e<\/code>\u53c2\u6570\u652f\u6301\u5f15\u7528<strong>.wgetrc<\/strong>\u914d\u7f6e\u53d8\u91cf\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   -e command\n   --execute command\n       Execute command as if it were a part of .wgetrc.  A command thus invoked will be executed after the commands in .wgetrc, thus taking precedence over them.  If you need to specify more than one wgetrc command, use multiple instances\n       of -e.<\/pre>\n\n\n\n<p>\u5176\u4e2d<strong>.wgetrc<\/strong>\u652f\u6301\u914d\u7f6e\u4ee3\u7406\u6709\u8fd9\u4e09\u4e2a\u5185\u5bb9<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   http_proxy\n   https_proxy\n       If set, the http_proxy and https_proxy variables should contain the URLs of the proxies for HTTP and HTTPS connections respectively.\n\n   ftp_proxy\n       This variable should contain the URL of the proxy for FTP connections.  It is quite common that http_proxy and ftp_proxy are set to the same URL.<\/pre>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u4ec5\u652f\u6301\u73af\u5883\u53d8\u91cf\u4e2d\u8bbe\u7f6e<code>http_proxy<\/code>\u548c<code>https_proxy<\/code>\uff0c\u4e8e\u662f\u6211\u5c06\u672c\u5730socks5\u7684\u4ee3\u7406\uff0c\u914d\u7f6e\u81f3\u5176\u4e2d\uff0c\u5982\u4e0b\u8fc7\u7a0b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> humh@MacBook-Pro \ue0b0 ~ \ue0b0 export https_proxy=socks5:\/\/127.0.0.1:6666\n humh@MacBook-Pro \ue0b0 ~ \ue0b0 wget https:\/\/archive.apache.org\/dist\/hadoop\/core\/hadoop-2.7.6\/hadoop-2.7.6.tar.gz -O tmp\/hadoop-2.7.6.tar.gz\n\u89e3\u6790\u4ee3\u7406\u670d\u52a1\u5668 URL socks5:\/\/127.0.0.1:6666 \u65f6\u53d1\u751f\u9519\u8bef\uff1a\u4e0d\u652f\u6301\u7684\u534f\u8bae\u7c7b\u578b \u201csocks5\u201d\u3002<\/pre>\n\n\n\n<p>\u60ca\u8bb6\u7684\u53d1\u73b0\uff0c\u539f\u6765wget\u5e76\u4e0d\u652f\u6301socks5\u534f\u8bae\u7684\u4ee3\u7406\u3002\uff08\u540c\u65f6\u9700\u8981\u6ce8\u610f\uff0c\u5982\u679c\u914d\u7f6e<code>http_proxy<\/code>\uff0c\u5219http\u8d44\u6e90\u624d\u80fd\u8d70\u4ee3\u7406 \uff0chttps\u8d44\u6e90\u9700\u8981\u914d\u7f6e<code>https_proxy<\/code>\uff0c\u5fc5\u987b\u4e00\u4e00\u5bf9\u5e94\uff09\u3002<\/p>\n\n\n\n<p><strong>\u8865\u5145<\/strong>\uff1awget\u9664\u4e86\u73af\u5883\u53d8\u91cf\u8fd9\u79cd\u65b9\u5f0f\uff0c\u672c\u8eab\u53ef\u4ee5\u76f4\u63a5\u91c7\u7528\u4e0a\u9762<code>-e<\/code>\u53c2\u6570\u542f\u7528\u4ee3\u7406\uff0c\u683c\u5f0f\u4e3a\uff1a<code>wget ... -e use_proxy=on -e http_proxy=127.0.0.1:8080<\/code>\u6216<code>wget ... -e http_proxy=127.0.0.1:8080<\/code><\/p>\n\n\n\n<h3>\u5982\u4f55\u89e3\u51b3wget\u4f7f\u7528socks5\u534f\u8bae\u7684\u4ee3\u7406<\/h3>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528<strong>tsocks<\/strong>\u89e3\u51b3\uff01\uff01\u5b83\u53ef\u4ee5\u8ba9\u5e94\u7528\u7a0b\u5e8f\u5728\u4e0d\u7ecf\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528socks\u4ee3\u7406\uff01\u70b9\u51fb<a href=\"http:\/\/tsocks.sourceforge.net\/faq.php\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">\u5b98\u7f51<\/a>\uff0c\u652f\u6301wget\u3001git\u7b49\u3002<\/p>\n\n\n\n<h4>1\u3001\u5b89\u88c5<\/h4>\n\n\n\n<p>\u8fd9\u91cc\u56e0\u4e3a\u672c\u4eba\u4f7f\u7528Mac\uff0c\u6240\u4ee5\u9610\u8ff0\u5982\u4f55\u901a\u8fc7homebrew\u5b89\u88c5\uff0c\u5982\u679c\u4f60\u662fUbuntu\u7684\u8bdd\uff0c\u53ef\u4ee5\u5c1d\u8bd5<code>apt-get install tsocks<\/code><\/p>\n\n\n\n<p>\u901a\u8fc7<code>brew search tsocks<\/code>\u53d1\u73b0\u6ca1\u6709\u8fd9\u4e2a\u5de5\u5177\u5305\uff0c\u641c\u4e86\u4e00\u4e0b\uff0c\u53d1\u73b0\u8fd9\u4e2a\u5de5\u5177\u5305\uff0c\u5b98\u65b9\u5e93\u6ca1\u6709\uff0c\u9700\u8981\u901a\u8fc7\u7b2c\u4e09\u65b9\u5e93\u3002<\/p>\n\n\n\n<p>\u9996\u5148<code>brew tap<\/code>\u67e5\u770b\u672c\u5730\u5e93<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> \u2718 humh@MacBook-Pro \ue0b0 ~ \ue0b0 brew tap\nhomebrew\/cask\nhomebrew\/core\nhomebrew\/services<\/pre>\n\n\n\n<p>\u8bf4\u660e\u53ea\u6709\u5b98\u65b9\u6838\u5fc3\u5e93\uff0c\u8fd9\u91cc\u6dfb\u52a0tsocks\u7684\u5e93\u3002\u8fd0\u884c<code>brew tap Anakros\/homebrew-tsocks<\/code>\u3002\u518d\u6b21tap\u9a8c\u8bc1<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> \u2718 humh@MacBook-Pro \ue0b0 ~ \ue0b0 brew tap\nanakros\/tsocks\nhomebrew\/cask\nhomebrew\/core\nhomebrew\/services<\/pre>\n\n\n\n<p>tsocks\u7684\u7b2c\u4e09\u65b9\u5e93\u6dfb\u52a0\u6210\u529f\uff0c\u6b64\u65f6\u8fd0\u884c<code>brew install --HEAD tsocks<\/code>\u5b89\u88c5\u6700\u65b0\u7248tsocks\u3002<\/p>\n\n\n\n<p>\u8bf4\u660e\uff1a<strong>homebrew<\/strong>\u7b2c\u4e09\u65b9\u5e93\u8f6f\u4ef6\u5b89\u88c5\u7684\u539f\u7406\uff0c\u5927\u81f4\u662f\uff0chomebrew\u652f\u6301\u4e09\u65b9\u521b\u4f5c\uff0c\u652f\u6301github\u7b49\uff0c\u53ea\u8981\u4f60\u7684\u4ed3\u5e93\u540d\u7b26\u5408<strong>homebrew-something<\/strong>\u7684\u683c\u5f0f\u5373\u53ef\u3002<\/p>\n\n\n\n<h4>2\u3001\u914d\u7f6etsocks<\/h4>\n\n\n\n<p>Mac\u9ed8\u8ba4\u914d\u7f6e\u4f4d\u4e8e<code>\/usr\/local\/etc\/tsocks.conf<\/code>\uff0c\u5176\u4ed6\u7cfb\u7edf\u7c7b\u4f3c\uff0c\u53ea\u8981\u627e\u5230\u914d\u7f6e\u6587\u4ef6\u5373\u53ef\u3002\u914d\u7f6e\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> humh@MacBook-Pro \ue0b0 ~ \ue0b0 vim \/usr\/local\/etc\/tsocks.conf\n\n#\u914d\u7f6e\u5982\u4e0b\uff1a\nserver = 127.0.0.1\nserver_port = 6666\nserver_type = 5<\/pre>\n\n\n\n<ul><li>server\uff1a\u9700\u8981\u4f7f\u7528\u7684\u4ee3\u7406\uff0c\u5176\u5730\u5740<\/li><li>server_port\uff1a\u9700\u8981\u4f7f\u7528\u7684\u4ee3\u7406\uff0c\u5176\u7aef\u53e3\u53f7<\/li><li>server_type\uff1a\u9700\u8981\u4f7f\u7528\u7684\u4ee3\u7406\uff0c\u5176\u534f\u8bae\u7c7b\u578b\uff0c\u8fd9\u91cc<strong>5<\/strong>\u4ee3\u7406socks5\u534f\u8bae\uff0c\u5177\u4f53\u53ef\u53c2\u8003\u6700\u540e\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u8bf4\u660e\u3002<\/li><\/ul>\n\n\n\n<h4>3\u3001\u9a8c\u8bc1\u4f7f\u7528<\/h4>\n\n\n\n<p>\u53ea\u8981\u5728\u4f60\u9700\u8981\u4ee3\u7406\u7684\u547d\u4ee4\u524d\uff0c\u52a0\u4e0a<code>tsocks<\/code>\u5373\u53ef\uff0c\u5982wget\uff0c\u4e3e\u4f8b\uff1a<code>tsocks wget https:\/\/archive.apache.org\/dist\/hadoop\/core\/hadoop-2.7.6\/hadoop-2.7.6.tar.gz -O .\/hadoop-2.7.6.tar.gz<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<p><strong>\u672c\u6587\u53c2\u8003<\/strong><\/p>\n\n\n\n<ul><li>\u201cHow to set proxy for wget?\u201d\uff1a<a rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/stackoverflow.com\/questions\/11211705\/how-to-set-proxy-for-wget\" target=\"_blank\">https:\/\/stackoverflow.com\/questions\/11211705\/how-to-set-proxy-for-wget<\/a><\/li><li>\u201cTSOCKS\u201d\uff1a<a rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"http:\/\/tsocks.sourceforge.net\/faq.php\" target=\"_blank\">http:\/\/tsocks.sourceforge.net\/faq.php<\/a><\/li><li>\u201cMac \u4e0b\u5b89\u88c5 tsocks \u524d\u7f6e\u4ee3\u7406\u5de5\u5177\u201d\uff1a<a rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/www.coderxing.com\/install-tsocks-on-macos.html\" target=\"_blank\">https:\/\/www.coderxing.com\/install-tsocks-on-macos.html<\/a><\/li><li>\u201cAnakros\/homebrew-tsocks\u201d\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/Anakros\/homebrew-tsocks\" target=\"_blank\">https:\/\/github.com\/Anakros\/homebrew-tsocks<\/a><\/li><li>\u201chomebrew\u7684tap\u529f\u80fd\u8be6\u89e3\u201d\uff1a<a rel=\"noreferrer noopener\" aria-label=\"https:\/\/segmentfault.com\/a\/1190000012826983\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/segmentfault.com\/a\/1190000012826983\" target=\"_blank\">https:\/\/segmentfault.com\/a\/1190000012826983<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\u201c\u7ed9\u591a\u6570Shell\u547d\u4ee4\u542f\u7528\u4ee3\u7406\u201d\u5df2\u7ecf\u603b\u7ed3\u8fc7\u90e8\u5206shell\u547d\u4ee4\u542f\u7528\u4ee3\u7406\u4e00\u4e8b\uff0c\u8fd9\u91cc\u4e3b\u8981\u603b\u7ed3\u4e0bwget [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":914,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[53],"tags":[113,104,116,115],"_links":{"self":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/911"}],"collection":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=911"}],"version-history":[{"count":4,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/911\/revisions"}],"predecessor-version":[{"id":916,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/911\/revisions\/916"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}