「Google Compute Engine」:修訂間差異
跳至導覽
跳至搜尋
(未顯示同一使用者於中間所作的 6 次修訂) | |||
第1行: | 第1行: | ||
'''Google Compute Engine'''。 | '''Google Compute Engine'''是[[GCP]]的VM類服務。 | ||
== 範例 == | == 範例 == | ||
第13行: | 第13行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
echo "%staff ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/group-staff | echo "%staff ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/group-staff | ||
</syntaxhighlight> | |||
安裝<code>gcloud</code>指令: | |||
<syntaxhighlight lang="bash"> | |||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; sudo apt update; sudo apt install -y google-cloud-cli; sudo apt clean | |||
</syntaxhighlight> | |||
安裝<code>gce2env</code>,這隻程式可以把Google Secret Manager裡面的dotenv資料轉到環境變數裡,再執行我們的程式: | |||
<syntaxhighlight lang="bash"> | |||
sudo curl -L -o /usr/sbin/gsm2env https://gist.github.com/gslin/ec0c2df038732246feb84f07cbb20a66/raw/6e4f5afdfe236e507815d61d4e23f601597f5560/gsm2env; sudo chmod 755 /usr/sbin/gsm2env | |||
</syntaxhighlight> | </syntaxhighlight> | ||
於 2023年6月27日 (二) 06:04 的最新修訂
Google Compute Engine是GCP的VM類服務。
範例
關閉GCE的自動建立帳號以及SSH key機制:
echo -e '[Daemons]\naccounts_daemon = false' | sudo tee /etc/default/instance_configs.cfg; sudo reboot
所有在staff群組的人都可以無限制sudo:
echo "%staff ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/group-staff
安裝gcloud
指令:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; sudo apt update; sudo apt install -y google-cloud-cli; sudo apt clean
安裝gce2env
,這隻程式可以把Google Secret Manager裡面的dotenv資料轉到環境變數裡,再執行我們的程式:
sudo curl -L -o /usr/sbin/gsm2env https://gist.github.com/gslin/ec0c2df038732246feb84f07cbb20a66/raw/6e4f5afdfe236e507815d61d4e23f601597f5560/gsm2env; sudo chmod 755 /usr/sbin/gsm2env