{"id":148,"date":"2019-07-17T13:42:32","date_gmt":"2019-07-17T05:42:32","guid":{"rendered":"https:\/\/www.hlzhy.com\/?p=148"},"modified":"2019-07-22T09:07:24","modified_gmt":"2019-07-22T01:07:24","slug":"macos-%e7%bb%88%e7%ab%af%e8%bf%90%e8%a1%8css%e4%bb%a3%e7%90%86-%e5%ae%89%e8%a3%85cloud-sdk","status":"publish","type":"post","link":"https:\/\/www.hlzhy.com\/?p=148","title":{"rendered":"macOS \u7ec8\u7aef\u8fd0\u884css\u4ee3\u7406 \u5b89\u88c5Google Cloud SDK"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u4e00\u3001Mac OSX \u7ec8\u7aef\u8bbe\u7f6e\u4ee3\u7406<\/h3>\n\n\n\n<ul><li>\u6253\u5f00<code>shadowsocks<\/code><\/li><li>\u81ea\u52a8\u4ee3\u7406\u6a21\u5f0f<\/li><\/ul>\n\n\n\n<p>\u4ee5<code>zsh<\/code>\u4f5c\u4e3a\u8bf4\u660e<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ vim ~\/.zshrc  <\/pre>\n\n\n\n<p>\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7406\u914d\u7f6e:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># proxy list\nalias proxy='export all_proxy=socks5:\/\/127.0.0.1:1080'\nalias unproxy='unset all_proxy'<\/pre>\n\n\n\n<p><code>:wq<\/code>\u4fdd\u5b58\u9000\u51fa<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ source ~\/.zshrc<\/pre>\n\n\n\n<p>\u4f7f\u7528<code>proxy<\/code>\u524d\u5148\u67e5\u770b\u4e0b\u5f53\u524d\u7684<code>ip<\/code>\u5730\u5740\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ curl cip.cc\nIP : 140.206.97.42\n\u5730\u5740 : \u4e2d\u56fd  \u4e0a\u6d77\n\n\u6570\u636e\u4e8c : \u4e0a\u6d77\u5e02 | \u8054\u901a\n\nURL : http:\/\/www.cip.cc\/140.206.97.42<\/pre>\n\n\n\n<p>\u6267\u884c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ proxy\n$ curl cip.cc\nIP : 45.78.47.19\n\u5730\u5740 : \u7f8e\u56fd  \u52a0\u5229\u798f\u5c3c\u4e9a\n\n\u6570\u636e\u4e8c : \u7f8e\u56fd | \u52a0\u5229\u798f\u5c3c\u4e9a\u5dde\u6d1b\u6749\u77f6\u5e02 IT7 Networks\n\nURL : http:\/\/www.cip.cc\/45.78.47.19<\/pre>\n\n\n\n<p>\u4e0b\u6b21\u6253\u5f00\u7ec8\u7aef\u53ea\u9700\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ source ~\/.zshrc\n$ proxy<\/pre>\n\n\n\n<p>\u53d6\u6d88\u4ee3\u7406\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ unproxy<\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u5185\u5bb9\u6765\u81ea\u2014\u2014<a href=\"https:\/\/github.com\/mrdulin\/blog\/issues\/18\" target=\"_blank\" rel=\"noopener noreferrer\">Mac OSX\u7ec8\u7aef\u8d70shadowsocks\u4ee3\u7406<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c\u3001<strong>\u5b89\u88c5\u5e76\u521d\u59cb\u5316Cloud SDK<\/strong><\/h3>\n\n\n\n<p>\u8bf7\u5c06\u73af\u5883\u53d8\u91cfHTTPS_PROXY\u548cHTTP_PROXY\u8bbe\u7f6e\u4e3a\u4ee3\u7406\u5730\u5740\uff0c\u683c\u5f0f\u4e3a\u201cprotocol\uff1a\/\/ address\uff1aport\u201d\uff08\u4e0d\u5e26\u5f15\u53f7\uff09<\/p>\n\n\n\n<p>\u5982\u679c\u4f7f\u7528SS\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u6ca1\u6709\u4fee\u6539\u8fc7\u7aef\u53e3\u7684\u8bdd\u6309\u7167\u4e0b\u9762\u793a\u4f8b\u8bbe\u7f6e\u5373\u53ef\uff0c\u5426\u5219\u6309\u7167\u81ea\u5df1\u5b9e\u9645\u4fee\u6539\u7684\u53c2\u6570\u8fdb\u884c\u914d\u7f6e\u3002\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ export HTTP_PROXY=socks5:\/\/127.0.0.1:1080\n$ export HTTPS_PROXY=socks5:\/\/127.0.0.1:1080<\/pre>\n\n\n\n<p>\u53c2\u7167\u5b98\u65b9<a href=\"https:\/\/cloud.google.com\/sdk\/docs\/quickstart-macos?hl=zh-cn\" target=\"_blank\" rel=\"noopener noreferrer\">\u6587\u6863<\/a>\u5b89\u88c5\u597dCloud SDK<\/p>\n\n\n\n<p>\u6709\u4e24\u79cd\u65b9\u6cd5\u53ef\u4ee5\u914d\u7f6e\u4ee3\u7406\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1\u3001\u4e3b\u52a8\u8bbe\u7f6e\uff1a<\/h4>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528&nbsp;<code>gcloud config<\/code>&nbsp;\u673a\u5236\uff0c\u901a\u8fc7 Cloud SDK \u5c5e\u6027\u6765\u914d\u7f6e\u4ee3\u7406\u8bbe\u7f6e\u3002\u8981\u8be6\u7ec6\u4e86\u89e3 Cloud SDK \u5c5e\u6027\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u4eec\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/cloud.google.com\/sdk\/docs\/properties?hl=zh-cn\">\u5c5e\u6027<\/a>\u9875\u9762\u3002<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u8bbe\u7f6e\u60a8\u6b63\u5728\u4f7f\u7528\u7684\u4ee3\u7406\u7c7b\u578b\u4ee5\u53ca\u5728\u8bbf\u95ee\u4ee3\u7406\u65f6\u4f7f\u7528\u7684\u5730\u5740\u548c\u7aef\u53e3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ gcloud config set proxy\/type PROXY_TYPE\n$ gcloud config set proxy\/address PROXY_IP_ADDRESS\n$ gcloud config set proxy\/port PROXY_PORT<\/pre>\n\n\n\n<ul><li>Cloud SDK \u652f\u6301\u4ee5\u4e0b&nbsp;<code>PROXY_TYPE<\/code>&nbsp;\u503c\uff1a<code>http<\/code>\u3001<code>http_no_tunnel<\/code>\u3001<code>socks4<\/code>\u3001<code>socks5<\/code><\/li><li><code>PROXY_IP_ADDRESS<\/code>&nbsp;\u662f\u4ee3\u7406\u7684\u8bbf\u95ee\u4f4d\u7f6e\u7684\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\u3002<\/li><li><code>PROXY_PORT<\/code>&nbsp;\u662f\u4ee3\u7406\u8fd0\u884c\u65f6\u4f7f\u7528\u7684\u7aef\u53e3\uff08\u4f8b\u5982&nbsp;<code>8080<\/code>\uff09\u3002<\/li><\/ul>\n\n\n\n<p>\u793a\u4f8b\uff08\u4e00\u822c\u5982\u679c\u6ca1\u6709\u4fee\u6539\u8fc7\u7684\u8bdd\uff0c\u6309\u7167\u4ee5\u4e0b\u793a\u4f8b\u8bbe\u7f6e\u5373\u53ef\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ gcloud config set proxy\/type socks5\n$ gcloud config set proxy\/address 127.0.0.1\n$ gcloud config set proxy\/port 1080<\/pre>\n\n\n\n<p>\u5bf9\u4e8e\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\u7684\u4ee3\u7406\uff0c\u60a8\u9700\u8981\u4f7f\u7528<a href=\"https:\/\/cloud.google.com\/sdk\/docs\/properties?hl=zh-cn\" target=\"_blank\" rel=\"noopener noreferrer\">\u5c5e\u6027<\/a>\u6765\u8bbe\u7f6e\u4ee3\u7406\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ gcloud config set proxy\/username USERNAME\n$ gcloud config set proxy\/password PASSWORD<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2\u3001\u88ab\u52a8\u8bbe\u7f6e<\/h4>\n\n\n\n<p>\u76f4\u63a5\u4f7f\u7528&nbsp;<code>gcloud init<\/code>&nbsp;\u547d\u4ee4\u521d\u59cb\u5316\uff08\u4e0d\u5e26<code>--skip-diagnostics<\/code>\uff09\uff0c\u7b49\u5f85\u7f51\u7edc\u8bca\u65ad\u5de5\u5177\u8bca\u65ad\u5b8c\u6210\uff08\u6b64\u8fc7\u7a0b\u975e\u5e38\u6f2b\u957f~\uff09\u6309\u7167\u63d0\u793a\u8fdb\u884c\u8bbe\u7f6e\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Current effective Cloud SDK network proxy settings:\n (These settings are from your machine's environment, not gcloud properties.)\n     type = http\n     host = 127.0.0.1\n     port = 1080\n     username = None\n     password = None\n\n Do you have a network proxy you would like to set in gcloud (Y\/n)?  y\n\n Select the proxy type:\n  [1] HTTP\n  [2] HTTP_NO_TUNNEL\n  [3] SOCKS4\n  [4] SOCKS5\n Please enter your numeric choice:  4\n\n Enter the proxy host address: 127.0.0.1\n\n Enter the proxy port: 1080\n\n Is your proxy authenticated (y\/N)?  n\n\n Cloud SDK proxy properties set.\n\n Rechecking network connection\u2026done.                                          \n Reachability Check now passes.\n Network diagnostic passed (1\/1 checks passed).\n\n You must log in to continue. Would you like to log in (Y\/n)?  y<\/pre>\n\n\n\n<p>\u6b64\u65f6\u4f1a\u6253\u5f00\u7f51\u9875\u8fdb\u884c\u6388\u6743\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u6839\u636e\u63d0\u793a\u767b\u5f55\u60a8\u7684 Google \u7528\u6237\u5e10\u53f7\uff0c\u7136\u540e\u70b9\u51fb<strong>\u5141\u8bb8<\/strong>\u4ee5\u6388\u6743\u8bbf\u95ee Google Cloud Platform \u8d44\u6e90\u3002<\/p>\n\n\n\n<p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u5904\uff0c\u4ece\u60a8\u62e5\u6709<strong>\u6240\u6709\u8005<\/strong>\u3001<strong>\u7f16\u8f91\u8005<\/strong>\u6216<strong>\u67e5\u770b\u8005<\/strong>\u6743\u9650\u7684\u9879\u76ee\u5217\u8868\u4e2d\u9009\u62e9\u4e00\u4e2a Cloud Platform \u9879\u76ee\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Pick cloud project to use:\n  [1] [my-project-1]\n  [2] [my-project-2]\n  ...\n  Please enter your numeric choice: <\/pre>\n\n\n\n<p>\u5982\u679c\u60a8\u53ea\u6709\u4e00\u4e2a\u9879\u76ee\uff0c<code>gcloud init<\/code>&nbsp;\u4f1a\u4e3a\u60a8\u9009\u62e9\u8be5\u9879\u76ee\u3002\u5982\u679c\u60a8\u542f\u7528\u4e86 Google Compute Engine API\uff0c\u5219\u901a\u8fc7&nbsp;<code>gcloud init<\/code>\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u9ed8\u8ba4\u7684 Compute Engine \u5730\u533a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Which compute zone would you like to use as project default?\n  [1] [asia-east1-a]\n  [2] [asia-east1-b]\n  ...\n  [14] Do not use default zone\n  Please enter your numeric choice:<\/pre>\n\n\n\n<p>\u786e\u8ba4\u60a8\u5df2\u6210\u529f\u5b8c\u6210\u8bbe\u7f6e\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gcloud has now been configured!\nYou can use [gcloud config] to change more gcloud settings.\n\nYour active configuration is: [default]<\/pre>\n\n\n\n<p><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001Mac OSX \u7ec8\u7aef\u8bbe\u7f6e\u4ee3\u7406 \u6253\u5f00shadowsocks \u81ea\u52a8\u4ee3\u7406\u6a21\u5f0f \u4ee5zsh\u4f5c\u4e3a\u8bf4\u660e $ vim ~\/.zshrc \u6dfb\u52a0\u5982\u4e0b\u4ee3\u7406\u914d\u7f6e &hellip; <a href=\"https:\/\/www.hlzhy.com\/?p=148\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">macOS \u7ec8\u7aef\u8fd0\u884css\u4ee3\u7406 \u5b89\u88c5Google Cloud SDK<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[19,4],"_links":{"self":[{"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/posts\/148"}],"collection":[{"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=148"}],"version-history":[{"count":11,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hlzhy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}