本教學課程示範如何在 Compute Engine 的 Debian Linux 虛擬機器 (VM) 執行個體上設定 Chrome 遠端桌面服務。如需 Windows VM 的個別操作說明,請參閱「Windows 虛擬機器」。Chrome 遠端桌面可讓您透過本機電腦或行動裝置的圖形使用者介面,遠端存取應用程式。
在本教學課程中,預設的防火牆規則會允許 Chrome 遠端桌面連線,因此您不需要設定任何額外的防火牆規則。只有在初始設定時才需要 SSH 存取權。
VM 需要存取網際網路 (使用外部 IP 位址或透過 Cloud NAT),且您必須使用 Google 帳戶進行驗證和授權。
本教學課程假設您熟悉 Linux 指令列及安裝 Debian 套件。
如要瞭解建立虛擬工作站的其他選項,請參閱「建立虛擬工作站」。
目標
- 建立要用以執行 Chrome 遠端桌面的無介面 Compute Engine VM 執行個體。
- 在 VM 執行個體上安裝及設定 Chrome 遠端桌面服務。
- 在 VM 執行個體中設定 X Window System 桌面環境。
- 從您的本機電腦連線至 VM 執行個體上的桌面環境。
費用
本教學課程使用 Google Cloud的計費元件,包括:
- Compute Engine
使用 Pricing Calculator 可根據您的預測使用量來產生費用預估。
事前準備
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API.
-
Make sure that you have the following role or roles on the project: roles/compute.admin
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
前往「身分與存取權管理」頁面 - 選取專案。
- 按一下 「授予存取權」。
-
在「New principals」(新增主體) 欄位中輸入使用者 ID。 通常是 Google 帳戶的電子郵件地址。
- 在「請選擇角色」清單中,選取角色。
- 如要授予其他角色,請按一下 「Add another role」(新增其他角色),然後新增其他角色。
- 按一下 [Save]。
- 您在本機電腦上使用 Google Chrome 瀏覽器。
-
完成本文件所述工作後,您可以刪除已建立的資源,避免繼續計費。詳情請參閱「清除所用資源」。
建立 Compute Engine 執行個體
為了配合本教學課程的目的,我們會使用含 Debian Linux 開機磁碟的預設機器類型。如果您要將這個環境用於自己的環境,建議您調整機器類型、名稱、區域、啟動磁碟大小或其他設定。
前往 Google Cloud 控制台的「VM Instances」(VM 執行個體) 頁面。
按一下 [建立]。
將執行個體名稱設為
crdhost
。按一下 [建立]。
建立執行個體需要一些時間。
建立執行個體之後,按一下執行個體清單中的「SSH」SSH連線至新執行個體:
在 VM 執行個體上安裝 Chrome 遠端桌面
在 VM 執行個體的 SSH 視窗中,將 Debian Linux Chrome 遠端桌面存放區新增至
apt
套件清單,然後安裝chrome-remote-desktop
套件。curl https://dl.google.com/linux/linux_signing_key.pub \ | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/chrome-remote-desktop.gpg echo "deb [arch=amd64] https://dl.google.com/linux/chrome-remote-desktop/deb stable main" \ | sudo tee /etc/apt/sources.list.d/chrome-remote-desktop.list sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive \ apt-get install --assume-yes chrome-remote-desktop
DEBIAN_FRONTEND=noninteractive
參數會略過為直接連線至 VM 執行個體之鍵盤設定配置的提示。
安裝 X Windows System 桌面環境
您需要安裝 X Window System 桌面環境與視窗管理員,才能使用 Chrome 遠端桌面。常用選項如下:
您可以使用其他桌面環境,但是 Chrome 遠端桌面不支援 3D 圖形加速功能。如果您選擇使用 3D 圖形加速功能的桌面環境,則需要停用該功能,否則遠端桌面服務不會啟動。
針對透過較慢網路進行的遠端連線,我們建議使用 Xfce,因為它只有少量圖形元素和動畫。
Xfce
在連線至 VM 執行個體的「SSH」視窗中,安裝 Xfce 桌面環境與基本桌面元件:
sudo DEBIAN_FRONTEND=noninteractive \ apt install --assume-yes xfce4 desktop-base dbus-x11 xscreensaver
由於 Xfce 預設的螢幕鎖定程式 (Light Locker) 無法與 Chrome 遠端桌面搭配使用 (Light Locker 會顯示空白畫面,且無法解鎖),因此必須使用 XScreenSaver。
將 Chrome 遠端桌面設定為預設使用 Xfce:
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
由於執行個體未連接任何顯示器,請停用執行個體上的顯示器管理員服務:
sudo systemctl disable lightdm.service
選用:安裝完整的 Linux 桌面應用程式套件,以及 Xfce 桌面環境:
sudo apt install --assume-yes task-xfce-desktop
選用:在執行個體上安裝 Chrome 瀏覽器:
curl -L -o google-chrome-stable_current_amd64.deb \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install --assume-yes --fix-broken ./google-chrome-stable_current_amd64.deb
Cinnamon
在連線至 VM 執行個體的「SSH」視窗中,安裝 Cinnamon 桌面環境與基本桌面元件:
sudo DEBIAN_FRONTEND=noninteractive \ apt install --assume-yes cinnamon-core desktop-base dbus-x11
將您的 Chrome 遠端桌面工作階段設定為預設會在 2D 模式下使用 Cinnamon (2D 模式的 Cinnamon 不會使用 3D 圖形加速功能):
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/cinnamon-session-cinnamon2d" > /etc/chrome-remote-desktop-session'
選用:安裝完整的 Linux 桌面應用程式套件,以及 Cinnamon 桌面環境:
sudo apt install --assume-yes task-cinnamon-desktop
選用:在執行個體上安裝 Chrome 瀏覽器:
curl -L -o google-chrome-stable_current_amd64.deb \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install --assume-yes --fix-broken ./google-chrome-stable_current_amd64.deb
地精
在連線至 VM 執行個體的 SSH 視窗中,安裝完整的 Gnome 桌面環境:
sudo DEBIAN_FRONTEND=noninteractive \ apt install --assume-yes task-gnome-desktop
將 Chrome 遠端桌面工作階段設定為使用 Gnome
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/gnome-session" > /etc/chrome-remote-desktop-session'
停用執行個體上的 Gnome 顯示器管理員服務,因為該服務與 Chrome 遠端桌面服務發生衝突。
sudo systemctl disable gdm3.service sudo reboot
這個指令會重新啟動 VM。
請先透過 SSH 重新連線再繼續操作。
選用:在執行個體上安裝 Chrome 瀏覽器:
curl -L -o google-chrome-stable_current_amd64.deb \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install --assume-yes --fix-broken ./google-chrome-stable_current_amd64.deb
Gnome-Classic
在連線至 VM 執行個體的 SSH 視窗中,安裝完整的 Gnome 桌面環境:
sudo DEBIAN_FRONTEND=noninteractive \ apt install --assume-yes task-gnome-desktop
DEBIAN_FRONTEND=noninteractive
參數會略過為直接連線至 VM 執行個體之鍵盤設定配置的提示。將 Chrome 遠端桌面工作階段設定為使用 Gnome-Classic 桌面:
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/gnome-session-classic" > /etc/chrome-remote-desktop-session'
停用執行個體上的 Gnome 顯示器管理員服務,因為該服務與 Chrome 遠端桌面服務發生衝突。
sudo systemctl disable gdm3.service sudo reboot
這個指令會重新啟動 VM。
請先透過 SSH 重新連線再繼續操作。
選用:在執行個體上安裝 Chrome 瀏覽器:
curl -L -o google-chrome-stable_current_amd64.deb \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install --assume-yes --fix-broken ./google-chrome-stable_current_amd64.deb
KDE Plasma
在連線至 VM 執行個體的「SSH」視窗中,安裝完整的 KDE Plasma 桌面環境:
sudo DEBIAN_FRONTEND=noninteractive \ apt install --assume-yes task-kde-desktop
DEBIAN_FRONTEND=noninteractive
參數會略過為直接連線至 VM 執行個體之鍵盤設定配置的提示。將 Chrome 遠端桌面工作階段設定為使用 KDE Plasma
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/startplasma-x11" > /etc/chrome-remote-desktop-session'
選用:在執行個體上安裝 Chrome 瀏覽器:
curl -L -o google-chrome-stable_current_amd64.deb \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install --assume-yes --fix-broken ./google-chrome-stable_current_amd64.deb
設定及啟動 Chrome 遠端桌面服務
如要啟動遠端桌面伺服器,您需要擁有您欲用以連線至伺服器的 Google 帳戶所需的授權金鑰:
前往 Google Cloud 控制台的「VM Instances」(VM 執行個體) 頁面:
按一下「SSH」SSH按鈕,連線至執行個體。
在您的本機電腦上使用 Chrome 瀏覽器,前往 Chrome 遠端桌面指令列設定頁面:
如果您尚未登入,請使用 Google 帳戶登入。這是將會用於授權遠端存取權的帳戶。
在「Set up another computer」頁面上,按一下 [Begin]。
按一下 [授權]。
您需要允許 Chrome 遠端桌面存取您的帳戶。如果您允許,頁面會顯示類似以下這樣的 Debian Linux 指令列:
DISPLAY= /opt/google/chrome-remote-desktop/start-host \ --code="4/xxxxxxxxxxxxxxxxxxxxxxxx" \ --redirect-url="https://remotedesktop.google.com/_/oauthredirect" \ --name=$(hostname)
您可以在 VM 執行個體上使用這個指令設定及啟動 Chrome 遠端桌面服務,並使用授權碼將服務連結至 Google 帳戶。
將指令複製到連線至執行個體的「SSH」視窗,然後執行指令。
當您看到提示時,請輸入 6 位數的 PIN 碼。這個數字會在您之後連線時用於進一步的授權。
您可能會看到
No net_fetcher
或Failed to read
等錯誤。您可以忽略這些錯誤。使用下列指令確認服務是否正在執行。
sudo systemctl status chrome-remote-desktop@$USER
如果服務正在執行中,您會看見包含
active
狀態的輸出:chrome-remote-desktop.service - LSB: Chrome Remote Desktop service Loaded: loaded (/lib/systemd/system/chrome-remote-desktop@USER.service; enabled; vendor preset: enabled) Active: active (running) since DATE_TIME; ELAPSED_TIME
連線至 VM 執行個體
您可以使用 Chrome 遠端桌面網頁應用程式連線至 VM 執行個體。
在本機電腦上,前往 Chrome 遠端桌面網站。
按一下「存取我的電腦」。
如果您尚未登入 Google,請使用您用於設定 Chrome 遠端桌面服務的 Google 帳戶登入。
您會在「Remote Devices」清單中看見新的 VM 執行個體
crdhost
。按一下遠端桌面執行個體的名稱。
系統出現提示時,輸入您之前建立的 PIN 碼,然後按一下箭號按鈕進行連線。
您現在已連線至遠端 Compute Engine 執行個體上的桌面環境。
如果系統顯示提示,請一律允許遠端桌面應用程式讀取剪貼簿,並讓您在本機和遠端應用程式之間複製及貼上內容。
如果您安裝了 Xfce 桌面,當您第一次連線時,系統會提示您設定桌面面板。按一下 [Use Default Config] (使用預設設定) 可在頂部看見標準工作列,並在底部看見快速啟動面板。
改善遠端桌面體驗
本節提供變更設定的操作說明,可協助您改善遠端桌面體驗。
安裝 Chrome 遠端桌面應用程式
Chrome 遠端桌面應用程式可提供獨立的視窗體驗,並允許在遠端系統上使用 Chrome 通常會攔截的鍵盤快速鍵。
如果未安裝這個應用程式,請按照下列步驟操作:
- 將滑鼠移至視窗側邊,然後使用 chevron_left 按鈕開啟「工作階段選項」面板。
- 在「安裝應用程式」部分中,按一下「開始」。
- 按一下 [安裝]。
遠端桌面工作階段會在自己的應用程式視窗中重新開啟。
只要在網址列中按一下「Open With」open_in_new 圖示,即可將任何遠端桌面工作階段從 Chrome 分頁移至應用程式視窗。
停用 Cinnamon 的動畫與效果
Cinnamon 桌面使用數種圖形功能與動畫,例如可以漸入與漸出的半透明視窗和選單。由於這些動畫在遠端連線時需要較長時間顯示,因此會使您感覺使用者介面比較慢。
如要停用這些效果:
在 Cinnamon 桌面中,選取 [Menu] (選單) > [Preferences] (偏好設定) > [Effects] (特效)。
停用以下每一種效果:
設定使用者密碼
Compute Engine 建立的使用者帳戶沒有密碼。不過,部分桌面環境需要使用密碼才能解鎖螢幕保護程式,並授權執行管理操作。因此,為使用者設定密碼非常重要:
- 就像您第一次設定執行個體一樣,使用 SSH 連線至執行個體。
為使用者建立密碼:
sudo passwd $(whoami)
停用螢幕保護程式和鎖定螢幕
由於您會從遠端電腦存取桌面,因此通常不需要使用螢幕保護程式或螢幕鎖定程式,因此您可以停用這類功能。
Xfce
- 在「Applications」選單中,依序選取「Settings」>「Screensaver」。
- 將「Mode」(模式) 設定為 [Disable Screen Saver] (停用螢幕保護程式)。
Cinnamon
- 在桌面上,依序選取「選單」>「偏好設定」>「螢幕保護程式」。
- 在「Settings」(設定) 分頁中,將「Delay」(延遲) 設定為「Never」(永不),然後停用下列兩個鎖定設定,即可自動鎖定螢幕。
地精
- 在電腦上按一下「活動」,然後輸入
Settings
。 - 選取「設定」應用程式。
- 在「設定」應用程式中,依序選取「隱私權」「螢幕鎖定」。
- 停用「自動螢幕鎖定」並關閉對話方塊。
- 依序選取「裝置」>「鍵盤」。
- 在鍵盤快速鍵清單中,前往「系統」部分,然後按一下「螢幕鎖定」。
- 按下
Backspace
鍵來停用捷徑,然後點選「設定」。 - 選取「電源」,然後將「空白畫面」設為「永不」。
Gnome-Classic
- 在桌面上,依序選取「應用程式」>「系統工具」>「設定」。
- 在「設定」應用程式中,依序選取「隱私權」「螢幕鎖定」。
- 停用「自動螢幕鎖定」並關閉對話方塊。
- 依序選取「裝置」>「鍵盤」。
- 在鍵盤快速鍵清單中,前往「系統」部分,然後按一下「螢幕鎖定」。
- 按下
Backspace
鍵來停用捷徑,然後點選「設定」。 - 選取「電源」,然後將「空白畫面」設為「永不」。
KDE Plasma
- 在桌面上,按一下 KDE 選單按鈕,然後輸入
Screen Locking
。 - 選取「Screen Locking」應用程式。
- 在「Configure Screen Locking」應用程式中,停用「Lock Screen after」,然後按一下 按鈕,清除鍵盤快捷鍵。
- 按一下 [確定]。
增加桌面解析度
如果您擁有超高解析度顯示器,可能會發現預設的最大遠端桌面大小 1600 x 1200 太小。若是如此,您可以將該解析度增加到顯示器的解析度。
- 使用 SSH 連線至執行個體。
設定
CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES
環境變數,使其包含顯示器的解析度:echo "export CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES=1600x1200,3840x2560" \ >> ~/.profile
重新啟動服務:
sudo systemctl restart chrome-remote-desktop@$USER
啟用進階影片編解碼器:
採用高品質色彩的 AV1 轉碼器可改善影像品質,並可更妥善地編碼純色資訊 (例如文字):
- 將滑鼠移至視窗側邊,然後使用 chevron_left 按鈕開啟「工作階段選項」面板。
- 在「Video Codec」欄位中,選取「AV1」
- 確認已啟用「高品質色彩」欄位。
選擇不同的桌面環境
在先前的章節中,您在全域 /etc/chrome-remote-desktop-session
設定檔中設定了預設的桌面環境。您也可以藉由指定主目錄中的 .chrome-remote-desktop-session
設定檔,選擇不同的桌面環境 (若已經安裝):
Xfce
echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > ~/.chrome-remote-desktop-session
Cinnamon
echo "exec /etc/X11/Xsession /usr/bin/cinnamon-session-cinnamon2d" > ~/.chrome-remote-desktop-session
地精
echo "exec /etc/X11/Xsession /usr/bin/gnome-session" > ~/.chrome-remote-desktop-session
Gnome-Classic
echo "exec /etc/X11/Xsession /usr/bin/gnome-session-classic" > ~/.chrome-remote-desktop-session
KDE Plasma
echo "exec /etc/X11/Xsession /usr/bin/startplasma-x11" > ~/.chrome-remote-desktop-session
進行此變更後,請重新啟動服務,讓變更生效:
sudo systemctl restart chrome-remote-desktop@$USER
如前文所述,Chrome 遠端桌面不支援 3D 圖形加速功能。因此,在使用這些功能的任何桌面環境中,您都必須停用 3D 圖形功能,否則工作階段將無法開始。
自動化安裝程序
需要使用 Chrome 遠端桌面設定多部機器時,手動安裝步驟可能會顯得重複性高。您可以利用下列程序,使用自訂開機指令碼自動化此流程:
為了配合本教學課程的目的,我們會使用含 Debian Linux 開機磁碟的預設機器類型。如果您要將這個環境用於自己的環境,建議您調整機器類型、名稱、地區、開機磁碟大小或其他設定。
前往 Google Cloud 控制台的「VM Instances」(VM 執行個體) 頁面:
點選「建立執行個體」。
將執行個體名稱設為
crdhost-autoinstall
。捲動至「進階選項」部分並展開。
展開「管理」部分。
複製下列殼層指令碼,並將其貼至「Automation/Startup Script」(自動化/開機指令碼) 欄位:
#!/bin/bash -x # # Startup script to install Chrome remote desktop and a desktop environment. # # See environmental variables at then end of the script for configuration # function install_desktop_env { PACKAGES="desktop-base xscreensaver dbus-x11" if [[ "$INSTALL_XFCE" != "yes" && "$INSTALL_CINNAMON" != "yes" ]] ; then # neither XFCE nor cinnamon specified; install both INSTALL_XFCE=yes INSTALL_CINNAMON=yes fi if [[ "$INSTALL_XFCE" = "yes" ]] ; then PACKAGES="$PACKAGES xfce4" echo "exec xfce4-session" > /etc/chrome-remote-desktop-session [[ "$INSTALL_FULL_DESKTOP" = "yes" ]] && \ PACKAGES="$PACKAGES task-xfce-desktop" fi if [[ "$INSTALL_CINNAMON" = "yes" ]] ; then PACKAGES="$PACKAGES cinnamon-core" echo "exec cinnamon-session-cinnamon2d" > /etc/chrome-remote-desktop-session [[ "$INSTALL_FULL_DESKTOP" = "yes" ]] && \ PACKAGES="$PACKAGES task-cinnamon-desktop" fi DEBIAN_FRONTEND=noninteractive \ apt-get install --assume-yes $PACKAGES $EXTRA_PACKAGES systemctl disable lightdm.service } function download_and_install { # args URL FILENAME if [[ -e "$2" ]] ; then echo "cannot download $1 to $2 - file exists" return 1; fi curl -L -o "$2" "$1" && \ apt-get install --assume-yes --fix-broken "$2" && \ rm "$2" } function is_installed { # args PACKAGE_NAME dpkg-query --list "$1" | grep -q "^ii" 2>/dev/null return $? } # Configure the following environmental variables as required: INSTALL_XFCE=yes INSTALL_CINNAMON=yes INSTALL_CHROME=yes INSTALL_FULL_DESKTOP=yes # Any additional packages that should be installed on startup can be added here EXTRA_PACKAGES="less bzip2 zip unzip tasksel wget" apt-get update if ! is_installed chrome-remote-desktop; then if [[ ! -e /etc/apt/sources.list.d/chrome-remote-desktop.list ]]; then echo "deb [arch=amd64] https://dl.google.com/linux/chrome-remote-desktop/deb stable main" \ | tee -a /etc/apt/sources.list.d/chrome-remote-desktop.list fi apt-get update DEBIAN_FRONTEND=noninteractive \ apt-get install --assume-yes chrome-remote-desktop fi install_desktop_env [[ "$INSTALL_CHROME" = "yes" ]] && ! is_installed google-chrome-stable && \ download_and_install \ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ /tmp/google-chrome-stable_current_amd64.deb echo "Chrome remote desktop installation completed"
此指令碼會在每次機器重新啟動時執行下列工作:
- 如果未安裝遠端桌面套件:
- 新增 Chrome 遠端桌面 Debian 套件存放區
- 安裝 Chrome 遠端桌面套件和依附元件。
- 安裝 Xfce 或 Cinnamon 桌面環境 (安裝何者視指令碼設定而定)。
- 如已啟用完整桌面環境選項,則會安裝必要的套件。
- 如果 Google Chrome 瀏覽器選項已啟用但未安裝:
- 下載 Google Chrome 套件。
- 安裝 Google Chrome 及其依附套件。
- 如果未安裝遠端桌面套件:
按一下 [建立]。
建立執行個體需要一些時間,且第一次啟用所有選項時,指令碼可能需要多達 10 分鐘的時間才能完成安裝。
如要監控進度,請使用 SSH 連線到 VM 執行個體,並在執行個體的終端機中執行下列指令:
sudo journalctl -o cat -f _SYSTEMD_UNIT=google-startup-scripts.service
此指令會顯示來自開機指令碼的輸出。指令碼完成後,您會看到以下內容:
INFO startup-script: Chrome remote desktop installation completed INFO startup-script: Return code 0. INFO Finished running startup scripts.
此指令碼只會安裝必要的套件,而您仍需要為使用者設定「遠端桌面服務」,如前文所述。
建立新的 VM 執行個體時,有多種方法可以指定開機指令碼:
- 將指令碼貼至 Google Cloud 主控台 (如前文所示)。
- 以檔案的方式儲存在本機,並在透過 Google Cloud CLI 建立執行個體時,使用
--metadata-from-file
標記。 - 將指令碼儲存到 Cloud Storage 值區中,並在主控台或 gcloud CLI 中指定物件的網址。
如要進一步瞭解設定開機指令碼的其他方法,請參閱 Compute Engine 說明文件中的執行開機指令碼一文。
疑難排解
本節提供本指南的疑難排解建議。
檢查 Chrome 遠端桌面服務的狀態
如果發生 Chrome 遠端桌面服務沒有回應的情形,您可以使用 SSH 連線至執行個體並執行下列指令來檢查其狀態:
sudo systemctl status chrome-remote-desktop@$USER
如果服務正在執行中,您會看見包含 active
狀態的輸出:
chrome-remote-desktop.service - LSB: Chrome Remote Desktop service Loaded: loaded (/lib/systemd/system/chrome-remote-desktop@USER.service; enabled; vendor preset: enabled) Active: active (running) since DATE_TIME; ELAPSED_TIME
如要重新啟動服務,請在「SSH」視窗中執行下列指令:
sudo systemctl restart chrome-remote-desktop@$USER
取得記錄與錯誤資訊
Chrome 遠端桌面會將記錄資訊寫入系統日誌:
journalctl SYSLOG_IDENTIFIER=chrome-remote-desktop # All logs
journalctl SYSLOG_IDENTIFIER=chrome-remote-desktop -e # Most recent logs
journalctl SYSLOG_IDENTIFIER=chrome-remote-desktop -b # Logs since reboot
您可以檢查這些記錄檔中的錯誤訊息。
重新啟用服務
如果您在用戶端應用程式中錯誤地停用了遠端執行個體的連線,可以重新設定服務並按照「設定及啟動 Chrome 遠端桌面服務」的操作說明重新啟用連線。
檢查全域和使用者專屬的工作階段設定檔。
檢查全域 /etc/chrome-remote-desktop-session
設定檔和特定使用者 ~/.chrome-remote-desktop-session
設定檔的內容,確認已安裝指定的桌面環境。
清除所用資源
如要避免系統向您的 Google Cloud 帳戶收取本教學課程中所用資源的相關費用,請刪除含有該項資源的專案,或者保留專案但刪除個別資源。
刪除專案
如要避免付費,最簡單的方法就是刪除您為了本教學課程所建立的專案。
如要刪除專案:
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
刪除 Compute Engine 執行個體
您不必刪除完整專案,而是可以刪除針對本教學課程建立的 VM 執行個體:
找出您之前建立的執行個體名稱 (
crdhost
),並選取旁邊的核取方塊。點選頁面頂端的 [Delete] (刪除) 按鈕。
刪除執行個體需要一些時間。
取消執行個體的 Chrome 遠端桌面授權
如果您不想再連線至 VM 執行個體,可以將其停用,並從「Remote Devices」清單中移除該執行個體。
- 在本機電腦上,前往 Chrome 遠端桌面遠端裝置清單網站。
- 按一下執行個體名稱
crdhost
旁的 。 - 按一下 [OK] 以確認停用該遠端裝置連線。
後續步驟
- 瞭解如何在 Windows 虛擬機器上設定 Chrome 遠端桌面。
- 瞭解建立虛擬工作站的其他選項。
- 探索 Google Cloud 的參考架構、圖表和最佳做法。歡迎瀏覽我們的 雲端架構中心。