﻿{"id":803,"date":"2021-01-07T08:12:18","date_gmt":"2021-01-07T00:12:18","guid":{"rendered":"https:\/\/byy3.com\/?p=803"},"modified":"2022-10-05T16:13:39","modified_gmt":"2022-10-05T08:13:39","slug":"google-shell%e5%90%af%e7%94%a8%e5%a2%9e%e5%bc%ba%e6%a8%a1%e5%bc%8f4%e6%a0%b816g%e5%86%85%e5%ad%98","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=803","title":{"rendered":"google shell\u542f\u7528\u589e\u5f3a\u6a21\u5f0f4\u683816G\u5185\u5b58"},"content":{"rendered":"<h2>Enabling Google Cloud Shell \u201cboost\u201d mode via gcloud cli<\/h2>\n<div id=\"fc\"><center><\/center><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-804\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2021\/01\/2021010700111063.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"996\" height=\"679\" title=\"google shell\u542f\u7528\u589e\u5f3a\u6a21\u5f0f4\u683816G\u5185\u5b58\u63d2\u56fe\" alt=\"google shell\u542f\u7528\u589e\u5f3a\u6a21\u5f0f4\u683816G\u5185\u5b58\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5b8c\u7f8e\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a\u626b\u63cf\u6dfb\u52a0\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u3010\u6cd3\u6e90\u89c6\u91ce\u7f51\u7edc\u5b89\u5168\u3011\u00a0 \u53d1\u9001\u3010googleshellboost\u3011\u83b7\u5f97<\/p>\n<div id=\"attachment_907\" style=\"width: 268px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-907\" class=\"size-full wp-image-907\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2021\/02\/2021020418394688.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"258\" height=\"258\" title=\"google shell\u542f\u7528\u589e\u5f3a\u6a21\u5f0f4\u683816G\u5185\u5b58\u63d2\u56fe1\" alt=\"google shell\u542f\u7528\u589e\u5f3a\u6a21\u5f0f4\u683816G\u5185\u5b58\u63d2\u56fe1\" \/><p id=\"caption-attachment-907\" class=\"wp-caption-text\">\u6cd3\u6e90\u89c6\u91ce\u7f51\u7edc\u5b89\u5168,\u5fae\u4fe1\u516c\u4f17\u53f7<\/p><\/div>\n<p>\u66f4\u65b0\u4e8e2021\u5e742\u670824\u65e5<\/p>\n<p>https:\/\/github.com\/offensi\/LiveOverflow-cloudshell-stuff<\/p>\n<p>\u6211\u4f7f\u7528\u8fd9\u4e2a\u51fa\u8272\u7684\u7b54\u6848https:\/\/stackoverflow.com\/a\/49515502\/10690958\u4e2d\u63d0\u5230\u7684\u65b9\u6cd5\uff0c\u901a\u8fc7ubuntu\u5de5\u4f5c\u7ad9\u4e0a\u7684ssh\u8fde\u63a5\u5230Google Cloud Shell\u3002 \u6709\u65f6\uff0c\u6211\u9700\u8981\u542f\u7528\"\u5347\u538b\u6a21\u5f0f\"\u3002 \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u76ee\u524d\u5fc5\u987b\u901a\u8fc7firefox(https:\/\/console.cloud.google.com\/cloudshell\/editor?shellonly=true)\u6253\u5f00Cloud Shell\uff0c\u7136\u540e\u767b\u5f55\u5e76\u542f\u7528\u589e\u5f3a\u6a21\u5f0f\u3002 \u4e4b\u540e\uff0c\u6211\u53ef\u4ee5\u5173\u95edfirefox\uff0c\u5e76\u4f7f\u7528gcloud\u65b9\u6cd5\u4ee5\u589e\u5f3a\u6a21\u5f0f\u8bbf\u95ee\u4e91\u5916\u58f3VM\u3002<\/p>\n<p>\u6211\u60f3\u7eaf\u7cb9\u901a\u8fc7gcloud cli\u6765\u6267\u884c\u6b64\u64cd\u4f5c(\u8bbf\u95ee\u589e\u5f3a\u6a21\u5f0f)\uff0c\u56e0\u4e3a\u4f7f\u7528\u6d4f\u89c8\u5668\u975e\u5e38\u9ebb\u70e6\u3002<\/p>\n<p>\u5b98\u65b9\u6587\u6863\u6ca1\u6709\u63d0\u53ca\u901a\u8fc7gcloud\u542f\u7528\u589e\u5f3a\u6a21\u5f0f\u7684\u4efb\u4f55\u65b9\u6cd5\u3002\u4f3c\u4e4e\u53ea\u6709\u4e09\u4e2a\u9009\u9879\uff0c\u5373\u901a\u8fc7gcloud alpha cloud-shell\u7684ssh \/ scp \/ sshfs\u3002 \u662f\u5426\u6709\u529e\u6cd5\u901a\u8fc7\u67d0\u4e9b\u914d\u7f6e\u9009\u9879\u542f\u7528\u6b64\u529f\u80fd\uff1f<\/p>\n<p>\u8c22\u8c22<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p><center><\/center>&nbsp;<\/p>\n<p>\u4f3c\u4e4e\u6ca1\u6709\u4efb\u4f55\u9009\u9879\u53ef\u4ee5\u4eceCloud Shell API\u7684v1\u6216v1alpha1\u7248\u672c(\u8fd9\u4e24\u4e2a\u7248\u672c\u5747\u672a\u8bb0\u5f55)\u542f\u7528\u589e\u5f3a\u6a21\u5f0f\u3002<\/p>\n<p>gcloud\u547d\u4ee4\u5b9e\u9645\u4e0a\u4f7f\u7528API??\u6765\u83b7\u53d6Cloud Shell\u73af\u5883\u7684\u72b6\u6001\uff0c\u8be5\u72b6\u6001\u5305\u542b\u6709\u5173\u5982\u4f55\u901a\u8fc7SSH\u8fde\u63a5\u7684\u4fe1\u606f\uff0c\u5982\u679c\u9700\u8981\u7684\u8bdd\u66f4\u65b0SSH\u5bc6\u94a5\uff0c\u7136\u540e\u4f7f\u7528\u8be5\u4fe1\u606f\u8fdb\u884c\u8fde\u63a5(\u5982\u679c\u9700\u8981\uff0c\u8bf7\u4f7f\u7528gcloud alpha cloud-shell ssh --log-http\u81ea\u884c\u68c0\u67e5)\u3002<\/p>\n<p>\u636e\u6211\u6240\u77e5\uff0c\u5f53\u60a8\u5355\u51fb\" Boost\u6a21\u5f0f\"\u6309\u94ae\u65f6\uff0c\u6d4f\u89c8\u5668\u5c06\u8c03\u7528https:\/\/ssh.cloud.google.com\/devshell?boost=true&amp;forceNewVm=true(\u4ee5\u53ca\u5176\u4ed6\u4e00\u4e9b\u53c2\u6570)\uff0c\u4f46\u662f\u6211\u65e0\u6cd5\u4f7f\u5176\u5728\u547d\u4ee4\u884c\u4e0a\u8fd0\u884c\uff0c\u6240\u4ee5\u6211\u731c\u6d4b\u5b83\u6b63\u5728\u505a\u6211\u65e0\u6cd5\u8bc6\u522b\u7684\u5176\u4ed6\u4e8b\u60c5\u3002<\/p>\n<p>https:\/\/shell.cloud.google.com\/?hl=zh-cn&pli=1&show=ide&environment_deployment=ide<\/p>\n<p>sudo apt install htop<\/p>\n<p>\u7136\u540ehtop\u4e00\u4e0b\u53d1\u73b04cpu 16G\u4e86<\/p>\n<p>\u5982\u679c\u60a8\u7684\u5de5\u4f5c\u6d41\u7a0b\u9700\u8981\u6b64\u529f\u80fd\uff0c\u5219\u53ef\u4ee5\u5728Google\u7684\u95ee\u9898\u8ddf\u8e2a\u5668\u4e0a\u63d0\u51fa\u529f\u80fd\u8bf7\u6c42\u3002<\/p>\n<hr \/>\n<p>\u73b0\u5728\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4eceCLI\u4ee5\u589e\u5f3a\u6a21\u5f0f\u8bbf\u95eeCloud Shell\uff1agcloud alpha cloud-shell ssh --boosted\u3002\u5176\u4ed6\u53ef\u80fd\u7684\u53c2\u6570\u5728\u6b64\u5904\u8bb0\u5f55\u3002\u53ea\u662f\u8b66\u544a\uff1a\u6211\u7b2c\u4e00\u6b21\u5c1d\u8bd5\u4f7f\u4e3b\u76ee\u5f55\u53d8\u5f97\u4e0d\u53ef\u8bfb\uff0c\u5e76\u5f00\u59cb\u8fd4\u56de\"\u8f93\u5165\/\u8f93\u51fa\u9519\u8bef\"\uff0c\u6ce8\u9500\u5e76\u518d\u6b21\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n<h1 class=\"devsite-page-title\">Cloud Shell \u7684\u5de5\u4f5c\u539f\u7406<\/h1>\n<ul class=\"devsite-nav-list\" role=\"navigation\" aria-label=\"\u76ee\u5f55\">\n<li class=\"devsite-nav-item devsite-nav-heading devsite-toc-toggle\" role=\"heading\" aria-level=\"2\"><a class=\"devsite-nav-title\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#top_of_page\" aria-label=\"\u9875\u9996\" data-title=\"\u9875\u9996\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u76ee\u5f55<\/span><\/a><button class=\"devsite-nav-show-all button-transparent material-icons\" title=\"\u5c55\u5f00\/\u6536\u8d77\u5185\u5bb9\" type=\"button\"><\/button><\/li>\n<li class=\"devsite-nav-item\"><a class=\"devsite-nav-title gc-analytics-event\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#persistent_disk_storage\" data-category=\"Site-Wide Custom Events\" data-action=\"click\" data-label=\"Embedded nav\" data-value=\"0\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u6c38\u4e45\u6027\u78c1\u76d8\u5b58\u50a8\u7a7a\u95f4<\/span><\/a><\/li>\n<li class=\"devsite-nav-item\"><a class=\"devsite-nav-title gc-analytics-event\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#authorization\" data-category=\"Site-Wide Custom Events\" data-action=\"click\" data-label=\"Embedded nav\" data-value=\"1\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u6388\u6743<\/span><\/a><\/li>\n<li class=\"devsite-nav-item\"><a class=\"devsite-nav-title gc-analytics-event\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#pre-configured_environment_variables\" data-category=\"Site-Wide Custom Events\" data-action=\"click\" data-label=\"Embedded nav\" data-value=\"2\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u9884\u5148\u914d\u7f6e\u7684\u73af\u5883\u53d8\u91cf<\/span><\/a><\/li>\n<li class=\"devsite-nav-item\"><a class=\"devsite-nav-title gc-analytics-event\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#zone_selection\" data-category=\"Site-Wide Custom Events\" data-action=\"click\" data-label=\"Embedded nav\" data-value=\"3\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u5730\u533a\u9009\u62e9<\/span><\/a><\/li>\n<li class=\"devsite-nav-item\"><a class=\"devsite-nav-title gc-analytics-event\" href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/how-cloud-shell-works#image_rollout\" data-category=\"Site-Wide Custom Events\" data-action=\"click\" data-label=\"Embedded nav\" data-value=\"4\" rel=\"nofollow\" ><span class=\"devsite-nav-text\">\u56fe\u7247\u53d1\u5e03<\/span><\/a><\/li>\n<li class=\"devsite-toc-toggle\"><\/li>\n<\/ul>\n<div class=\"devsite-article-body clearfix \">\n<p>\u542f\u52a8 Cloud Shell \u65f6\uff0c\u5b83\u4f1a\u4e3a\u60a8\u9884\u914d\u4e00\u4e2a\u8fd0\u884c\u57fa\u4e8e Debian \u7684 Linux \u64cd\u4f5c\u7cfb\u7edf\u7684 Google Compute Engine \u865a\u62df\u673a\u3002Cloud Shell \u5b9e\u4f8b\u6309\u6bcf\u4e2a\u7528\u6237\u3001\u6bcf\u4e2a\u4f1a\u8bdd\u5355\u72ec\u9884\u914d\u3002\u5f53\u60a8\u7684 Cloud Shell \u4f1a\u8bdd\u5904\u4e8e\u6d3b\u8dc3\u72b6\u6001\u65f6\uff0c\u6b64\u5b9e\u4f8b\u5c06\u4f1a\u6301\u7eed\u5b58\u5728\uff1b\u5728\u5904\u4e8e\u975e\u6d3b\u8dc3\u72b6\u6001\u4e00\u5c0f\u65f6\u540e\uff0c\u60a8\u7684\u4f1a\u8bdd\u5c06\u7ec8\u6b62\uff0c\u800c\u5176\u865a\u62df\u673a\u5c06\u88ab\u820d\u5f03\u3002\u5982\u9700\u8be6\u7ec6\u4e86\u89e3\u7528\u91cf\u914d\u989d\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/limitations#usage_limits\" rel=\"nofollow\" >\u9650\u5236<\/a>\u6307\u5357\u3002<\/p>\n<p>\u51ed\u501f\u9ed8\u8ba4\u7684 Cloud Shell \u4f53\u9a8c\uff0c\u60a8\u5c06\u5206\u914d\u6709\u4e00\u4e2a\u4e34\u65f6\u7684\u3001\u9884\u914d\u7f6e\u7684<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/launching-cloud-shell-editor?hl=zh-cn\" rel=\"nofollow\" >\u865a\u62df\u673a<\/a>\uff0c\u5e76\u4e14\u60a8\u4f7f\u7528\u7684\u73af\u5883\u662f\u5728\u8be5\u865a\u62df\u673a\u4e0a\u8fd0\u884c\u7684 Docker \u5bb9\u5668\u3002\u60a8\u8fd8\u53ef\u4ee5\u5728\u865a\u62df\u673a\u542f\u52a8\u65f6\u81ea\u52a8<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/custom-environments\" rel=\"nofollow\" >\u81ea\u5b9a\u4e49\u73af\u5883<\/a>\uff0c\u4ee5\u786e\u4fdd Cloud Shell \u5b9e\u4f8b\u5305\u542b\u60a8\u7684\u9996\u9009\u5de5\u5177\u3002https:\/\/cloud.google.com\/shell\/docs\/launching-cloud-shell-editor?hl=zh-cn<\/p>\n<h2 id=\"persistent_disk_storage\" data-text=\"\u6c38\u4e45\u6027\u78c1\u76d8\u5b58\u50a8\u7a7a\u95f4\">\u6c38\u4e45\u6027\u78c1\u76d8\u5b58\u50a8\u7a7a\u95f4<\/h2>\n<p>Cloud Shell \u514d\u8d39\u9884\u914d 5 GB \u7684<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/compute\/docs\/disks\/persistent-disks\" rel=\"nofollow\" >\u6c38\u4e45\u6027\u78c1\u76d8\u5b58\u50a8\u7a7a\u95f4<\/a>\uff0c\u88c5\u8f7d\u4e3a\u60a8\u5728\u865a\u62df\u673a\u5b9e\u4f8b\u4e0a\u7684\u00a0<code dir=\"ltr\" translate=\"no\">$HOME<\/code>\u00a0\u76ee\u5f55\u3002\u6b64\u5b58\u50a8\u7a7a\u95f4\u6309\u7528\u6237\u5206\u914d\uff0c\u5e76\u4e14\u53ef\u4ee5\u4f9b\u591a\u4e2a\u9879\u76ee\u4f7f\u7528\u3002\u4e0e\u5b9e\u4f8b\u672c\u8eab\u4e0d\u540c\uff0c\u6b64\u5b58\u50a8\u7a7a\u95f4\u4e0d\u4f1a\u56e0\u5904\u4e8e\u975e\u6d3b\u8dc3\u72b6\u6001\u800c\u8d85\u65f6\u3002\u60a8\u5b58\u50a8\u5728\u4e3b\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff08\u5305\u62ec\u5b89\u88c5\u7684\u8f6f\u4ef6\u3001\u811a\u672c\u4ee5\u53ca\u00a0<code dir=\"ltr\" translate=\"no\">.bashrc<\/code>\u00a0\u548c\u00a0<code dir=\"ltr\" translate=\"no\">.vimrc<\/code>\u00a0\u7b49\u7528\u6237\u914d\u7f6e\u6587\u4ef6\uff09\u5728\u4e0d\u540c\u4f1a\u8bdd\u4e4b\u95f4\u4fdd\u6301\u4e0d\u53d8\u3002\u60a8\u7684\u00a0<code dir=\"ltr\" translate=\"no\">$HOME<\/code>\u00a0\u76ee\u5f55\u53ea\u6709\u60a8\u81ea\u5df1\u53ef\u4ee5\u770b\u5230\uff0c\u5176\u4ed6\u7528\u6237\u65e0\u6cd5\u8bbf\u95ee\u3002<\/p>\n<aside class=\"note\"><strong>\u6ce8\u610f<\/strong>\uff1a\u5982\u679c\u60a8\u4e0d\u7ecf\u5e38\u4f7f\u7528 Cloud Shell\uff0c\u5219\u00a0<code dir=\"ltr\" translate=\"no\">$HOME<\/code>\u00a0\u76ee\u5f55\u6c38\u4e45\u6027\u5b58\u50a8\u7a7a\u95f4\u53ef\u80fd\u4f1a\u88ab\u56de\u6536\u3002\u56de\u6536\u4e4b\u524d\uff0c\u7cfb\u7edf\u4f1a\u5411\u60a8\u53d1\u9001\u4e00\u5c01\u7535\u5b50\u90ae\u4ef6\u901a\u77e5\u3002\u53ea\u9700\u542f\u52a8\u4e00\u4e2a Cloud Shell \u4f1a\u8bdd\uff0c\u5373\u53ef\u907f\u514d\u6b64\u5b58\u50a8\u7a7a\u95f4\u88ab\u5220\u9664\u3002<\/aside>\n<h2 id=\"authorization\" data-text=\"\u6388\u6743\">\u6388\u6743<\/h2>\n<p>\u5f53\u60a8\u9996\u6b21\u8fdb\u884c Google Cloud API \u8c03\u7528\u6216\u662f\u5c06\u9700\u8981\u51ed\u636e\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff08\u4f8b\u5982 gcloud \u547d\u4ee4\u884c\u5de5\u5177\uff09\u4e0e Cloud Shell \u642d\u914d\u4f7f\u7528\u65f6\uff0cCloud Shell \u4f1a\u4f7f\u7528\u201c\u4e3a Cloud Shell \u63d0\u4f9b\u6388\u6743\u201d\u5bf9\u8bdd\u6846\u63d0\u793a\u60a8\u3002\u70b9\u51fb\u201c\u6388\u6743\u201d\u53ef\u8ba9\u8be5\u5de5\u5177\u4f7f\u7528\u60a8\u7684\u51ed\u636e\u8fdb\u884c\u8c03\u7528\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u8be6\u60c5\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/auth\" rel=\"nofollow\" >\u4f7f\u7528 Cloud Shell \u6388\u6743<\/a>\u3002<\/p>\n<h2 id=\"pre-configured_environment_variables\" data-text=\"\u9884\u5148\u914d\u7f6e\u7684\u73af\u5883\u53d8\u91cf\">\u9884\u5148\u914d\u7f6e\u7684\u73af\u5883\u53d8\u91cf<\/h2>\n<p>\u542f\u52a8 Cloud Shell \u540e\uff0c\u63a7\u5236\u53f0\u4e2d\u6b63\u5728\u8fdb\u884c\u7684\u9879\u76ee\u5c06\u4f20\u64ad\u5230 Cloud Shell \u5185\u7684\u00a0<code dir=\"ltr\" translate=\"no\">gcloud<\/code>\u00a0\u914d\u7f6e\uff0c\u4ee5\u4fbf\u7acb\u5373\u4f7f\u7528\u3002\u5e94\u7528\u9ed8\u8ba4\u51ed\u636e\u5e93\u7528\u4e8e\u652f\u6301\u5b9a\u4e49\u9879\u76ee ID \u7684\u73af\u5883\u53d8\u91cf\u00a0<code dir=\"ltr\" translate=\"no\">GOOGLE_CLOUD_PROJECT<\/code>\uff0c\u4e5f\u88ab\u8bbe\u7f6e\u4e3a\u6307\u5411 Console \u4e2d\u7684\u6d3b\u52a8\u9879\u76ee\u3002<\/p>\n<h2 id=\"zone_selection\" data-text=\"\u5730\u533a\u9009\u62e9\">\u5730\u533a\u9009\u62e9<\/h2>\n<p>Cloud Shell \u5206\u5e03\u5728\u591a\u4e2a Google Cloud Platform \u533a\u57df\u4e2d\u3002\u9996\u6b21\u8fde\u63a5\u5230 Cloud Shell \u65f6\uff0c\u60a8\u5c06\u88ab\u81ea\u52a8\u5206\u914d\u5230\u6700\u8fd1\u7684\u53ef\u7528\u5730\u7406\u533a\u57df\u3002\u60a8\u65e0\u6cd5\u9009\u62e9\u81ea\u5df1\u7684\u533a\u57df\uff0c\u5982\u679c Cloud Shell \u672a\u9009\u62e9\u6700\u4f73\u533a\u57df\uff0c\u5b83\u4f1a\u5c1d\u8bd5\u5728\u60a8\u7684 Cloud Shell \u865a\u62df\u673a\u672a\u4f7f\u7528\u65f6\u8fc1\u79fb\u5230\u4e00\u4e2a\u66f4\u8fd1\u7684\u533a\u57df\u3002<\/p>\n<p>\u8981\u67e5\u770b\u5f53\u524d\u533a\u57df\uff0c\u8bf7\u4ece Cloud Shell \u4f1a\u8bdd\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<div class=\"devsite-code-buttons-container\" role=\"group\" aria-label=\"\u64cd\u4f5c\u6309\u94ae\"><\/div>\n<pre class=\"\" dir=\"ltr\" translate=\"no\"><code dir=\"ltr\"><span class=\"pln\">curl metadata<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">computeMetadata<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">v1<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">instance<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">zone\r\n<\/span><\/code><\/pre>\n<h2 id=\"image_rollout\" data-text=\"\u56fe\u7247\u53d1\u5e03\">\u56fe\u7247\u53d1\u5e03<\/h2>\n<p>Cloud Shell \u5bb9\u5668\u6620\u50cf\u6bcf\u5468\u66f4\u65b0\u4e00\u6b21\uff0c\u4ee5\u786e\u4fdd\u9884\u5c01\u88c5\u7684\u5de5\u5177\u4fdd\u6301\u6700\u65b0\u3002\u4e5f\u5c31\u662f\u8bf4\uff0cCloud Shell \u59cb\u7ec8\u968f\u9644\u6709\u6700\u65b0\u7248\u672c\u7684 Cloud SDK\u3001Docker \u53ca\u5176\u6240\u6709\u5176\u4ed6\u5b9e\u7528\u7a0b\u5e8f\u3002<\/p>\n<h2 id=\"root_user\" data-text=\"\u6839\u7528\u6237\">\u6839\u7528\u6237<\/h2>\n<p>\u5728\u8bbe\u7f6e Cloud Shell \u4f1a\u8bdd\u65f6\uff0c\u60a8\u5c06\u83b7\u5f97\u4e00\u4e2a\u5e38\u89c4\u7684 Unix \u7528\u6237\u5e10\u53f7\uff0c\u5176\u7528\u6237\u540d\u57fa\u4e8e\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002\u6709\u4e86\u6b64\u8bbf\u95ee\u6743\u9650\uff0c\u60a8\u5c31\u53ef\u4ee5\u5728\u5206\u914d\u7684\u865a\u62df\u673a\u4e0a\u62e5\u6709\u5b8c\u6574\u7684\u6839\u7528\u6237\u6743\u9650\uff0c\u751a\u81f3\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fd0\u884c sudo \u547d\u4ee4\u3002<\/p>\n<h2 id=\"tools\" data-text=\"\u53ef\u7528\u7684\u5de5\u5177\">\u53ef\u7528\u7684\u5de5\u5177<\/h2>\n<p>Cloud Shell \u865a\u62df\u673a\u5b9e\u4f8b\u9884\u5b89\u88c5\u4e86\u4ee5\u4e0b\u5de5\u5177\uff1a<\/p>\n<div class=\"devsite-table-wrapper\">\n<table>\n<thead>\n<tr>\n<th>\u7c7b\u578b<\/th>\n<th>\u5de5\u5177<\/th>\n<\/tr>\n<\/thead>\n<thead><\/thead>\n<tbody>\n<tr>\n<td>Linux Shell \u89e3\u91ca\u5668<\/td>\n<td>bash<br \/>\nsh<\/td>\n<\/tr>\n<tr>\n<td>Linux \u5b9e\u7528\u5de5\u5177<\/td>\n<td>\u6807\u51c6 Debian \u7cfb\u7edf\u5b9e\u7528\u5de5\u5177<\/td>\n<\/tr>\n<tr>\n<td>Google SDK \u548c\u5de5\u5177<\/td>\n<td><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/appengine\/downloads\" rel=\"nofollow\" >Google App Engine SDK<\/a><br \/>\n<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/sdk\" rel=\"nofollow\" >Google Cloud SDK<\/a>\uff0c\u5305\u62ec Cloud Storage \u7684\u00a0<code dir=\"ltr\" translate=\"no\">gcloud<\/code>\u00a0\u547d\u4ee4\u884c\u5de5\u5177<br \/>\n<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/storage\/docs\/gsutil\" rel=\"nofollow\" ><code dir=\"ltr\" translate=\"no\">gsutil<\/code><\/a><\/td>\n<\/tr>\n<tr>\n<td>\u6587\u672c\u7f16\u8f91\u5668<\/td>\n<td>Emacs<br \/>\nVim<br \/>\nNano<\/td>\n<\/tr>\n<tr>\n<td>\u6784\u5efa\u548c\u6253\u5305\u5de5\u5177<\/td>\n<td>Gradle<br \/>\nHelm<br \/>\nMake<br \/>\nMaven<br \/>\nBazel<br \/>\nnpm<br \/>\nnvm<br \/>\npip<br \/>\nComposer<\/td>\n<\/tr>\n<tr>\n<td>\u6e90\u4ee3\u7801\u63a7\u5236\u5de5\u5177<\/td>\n<td>Git<br \/>\nMercurial<\/td>\n<\/tr>\n<tr>\n<td>\u5176\u4ed6\u5de5\u5177<\/td>\n<td>Docker<br \/>\niPython<br \/>\nMySQL \u5ba2\u6237\u7aef<br \/>\ngRPC \u7f16\u8bd1\u5668<br \/>\nTensorFlow<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u60a8\u53ef\u4ee5\u5728\u865a\u62df\u673a\u5b9e\u4f8b\u4e0a\u5b89\u88c5\u5176\u4ed6\u8f6f\u4ef6\u5305\uff0c\u4f46\u9664\u975e\u60a8\u5c06\u8f6f\u4ef6\u5b89\u88c5\u5728\u00a0<code dir=\"ltr\" translate=\"no\">$HOME<\/code>\u00a0\u76ee\u5f55\u4e2d\u6216\u521b\u5efa<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/custom-environments\" rel=\"nofollow\" >\u81ea\u5b9a\u4e49\u73af\u5883<\/a>\uff0c\u5426\u5219\u5728\u5b9e\u4f8b\u7ec8\u6b62\u540e\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u5c06\u4e0d\u4f1a\u4fdd\u7559\u3002<\/p>\n<h2 id=\"language_support\" data-text=\"\u8bed\u8a00\u652f\u6301\">\u8bed\u8a00\u652f\u6301<\/h2>\n<aside class=\"note\"><strong>\u6ce8\u610f<\/strong>\uff1a\u8bed\u8a00\u7248\u672c\u53ef\u80fd\u4f1a\u66f4\u6539\u3002\u4f46\u662f\uff0c\u5982\u679c\u60a8\u9700\u8981\u4f7f\u7528<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/configuring-cloud-shell#environment_customization\" rel=\"nofollow\" >\u73af\u5883\u5b9a\u5236\u811a\u672c<\/a>\uff0c\u5219\u60a8\u53ef\u4ee5\u5b89\u88c5\u4e0d\u540c\u7684\u7248\u672c\u3002<\/aside>\n<p>Cloud Shell \u865a\u62df\u673a\u5b9e\u4f8b\u9884\u5b89\u88c5\u4e86\u5bf9\u4ee5\u4e0b\u8bed\u8a00\u7684\u652f\u6301\uff1a<\/p>\n<div class=\"devsite-table-wrapper\">\n<table>\n<thead>\n<tr>\n<th>\u8bed\u8a00<\/th>\n<th>\u7248\u672c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Java<\/td>\n<td>JRE\/JDK 1.8 \u548c 1.11<\/td>\n<\/tr>\n<tr>\n<td>Go<\/td>\n<td>1.13<\/td>\n<\/tr>\n<tr>\n<td>Python<\/td>\n<td>2.7.13<\/td>\n<\/tr>\n<tr>\n<td>Node.js<\/td>\n<td>v10.14.2<\/td>\n<\/tr>\n<tr>\n<td>Ruby<\/td>\n<td>2.6.0<\/td>\n<\/tr>\n<tr>\n<td>PHP<\/td>\n<td>7.0.33<\/td>\n<\/tr>\n<tr>\n<td>.NET Core<\/td>\n<td>SDK 2.0.0 \u548c 2.1.502<br \/>\n\u6838\u5fc3\u8fd0\u884c\u65f6 2.0.0 \u548c 2.1.6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Java \u73af\u5883\u7684\u9ed8\u8ba4\u7248\u672c\u4e3a 1.11\u3002\u8981\u5c06\u5f53\u524d Cloud Shell \u4f1a\u8bdd\u66f4\u6539\u4e3a\u4f7f\u7528 JRE \u548c JDK 1.8 \u7248\uff0c\u8bf7\u5728 Cloud Shell \u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"devsite-code-buttons-container\" role=\"group\" aria-label=\"\u64cd\u4f5c\u6309\u94ae\"><\/div>\n<pre class=\"lang-sh\" dir=\"ltr\" translate=\"no\">sudo update-java-alternatives -s java-1.8.0-openjdk-amd64 &amp;&amp; export JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64\r\n<\/pre>\n<p>\u8981\u6539\u56de 1.11.0\uff0c\u8bf7\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"devsite-code-buttons-container\" role=\"group\" aria-label=\"\u64cd\u4f5c\u6309\u94ae\"><\/div>\n<pre class=\"lang-sh\" dir=\"ltr\" translate=\"no\">sudo update-java-alternatives -s java-1.11.0-openjdk-amd64 &amp;&amp; export JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk-amd64\/jre\r\n<\/pre>\n<h2 id=\"safe_mode\" data-text=\"\u5b89\u5168\u6a21\u5f0f\">\u5b89\u5168\u6a21\u5f0f<\/h2>\n<p>\u5982\u679c\u60a8\u7684\u00a0<code dir=\"ltr\" translate=\"no\">.bashrc<\/code>\u00a0\u6216\u00a0<code dir=\"ltr\" translate=\"no\">.tmux.conf<\/code>\u00a0\u6587\u4ef6\u5b58\u5728\u95ee\u9898\uff0cCloud Shell \u5c06\u5728\u8fde\u63a5\u540e\u7acb\u5373\u5173\u95ed\u3002\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u5728\u7f51\u5740\u7ed3\u5c3e\u5904\u9644\u52a0<code dir=\"ltr\" translate=\"no\">cloudshellsafemode=true<\/code>\uff0c\u4ee5\u5b89\u5168\u6a21\u5f0f\u6253\u5f00 Cloud Shell\u3002\u8fd9\u5c06\u91cd\u65b0\u542f\u52a8\u60a8\u7684 Cloud Shell \u5e76\u4ee5\u6839\u7528\u6237\u8eab\u4efd\u767b\u5f55\uff0c\u4ee5\u4fbf\u60a8\u4fee\u590d\u6587\u4ef6\u4e2d\u7684\u4efb\u4f55\u95ee\u9898\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5e0c\u671b\u6c38\u4e45\u5220\u9664\u4e3b\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u5e76\u5c06 Cloud Shell \u4e3b\u76ee\u5f55\u6062\u590d\u5230\u9ed8\u8ba4\u72b6\u6001\uff0c\u5219\u53ef\u4ee5\u5b8c\u5168<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.google.com\/shell\/docs\/resetting-cloud-shell\" rel=\"nofollow\" >\u91cd\u7f6e Cloud Shell \u865a\u62df\u673a<\/a>\u3002<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Enabling Google Cloud Shell \u201cboost\u201d mode via gcloud cli [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[226,261,260,328,228,353],"class_list":["post-803","post","type-post","status-publish","format-standard","hentry","category-linux","tag-google","tag-google-cloud-shell","tag-google-shell","tag-googleshell","tag-linux"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=803"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}