Set up Chrome Remote Desktop for Linux on Compute Engine

Last reviewed 2022-11-16 UTC

This tutorial shows you how to set up the Chrome Remote Desktop service on a Debian Linux virtual machine (VM) instance on Compute Engine. For separate instructions for Windows VMs, see Windows virtual machines. Chrome Remote Desktop lets you remotely access applications with a graphical user interface from a local computer or mobile device.

When following this tutorial, the default firewall rules allow Chrome Remote Desktop connections; you don't need to configure any additional firewall rules. SSH access is required only for the initial setup.

The VM does need access to the internet (either with an external IP address or through Cloud NAT), and you use your Google Account for authentication and authorization.

This tutorial assumes that you are familiar with the Linux command line and with installing Debian packages.

For information about other options for creating virtual workstations, see Creating a virtual workstation.

Objectives

  • Create a headless Compute Engine VM instance to run Chrome Remote Desktop on.
  • Install and configure the Chrome Remote Desktop service on the VM instance.
  • Set up an X Window System desktop environment in the VM instance.
  • Connect from your local computer to the desktop environment on the VM instance.

Costs

This tutorial uses billable components of Google Cloud, including:

  • Compute Engine

Use the Pricing Calculator to generate a cost estimate based on your projected usage.

Before you begin

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Compute Engine API.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Compute Engine API.

    Enable the API

  8. When you finish the tasks that are described in this document, you can avoid continued billing by deleting the resources that you created. For more information, see Clean up.

  9. Make sure that you have the following role or roles on the project: roles/compute.admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find the row that has your email address.

      If your email address isn't in that column, then you do not have any roles.

    4. In the Role column for the row with your email address, check whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your email address.
    5. In the Select a role list, select a role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  10. You use the Google Chrome browser on your local machine.

Create a Compute Engine instance

For the purposes of this tutorial, the default machine type with a Debian Linux boot disk is used. If you are using this for your own environment, you may want to adjust the machine type, name, region, boot disk size, or other settings.

  1. In the Google Cloud console, go to the VM Instances page.

    Go to VM Instances

  2. Click Create.

  3. Set the instance name to crdhost.

  4. Click Create.

    It takes a few moments to create your instance.

  5. After the instance has been created, connect to your new instance by clicking SSH in the instance list:

    Creating an SSH connection to the VM instance.

Install Chrome Remote Desktop on the VM instance

  1. In the SSH window for your VM instance, add the Debian Linux Chrome Remote Desktop repository to your apt package list, and install the chrome-remote-desktop package.

    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
    

    The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to configure a layout for a keyboard that would be directly connected to the VM instance.

Install an X Windows System desktop environment

You need to install an X Window System desktop environment and window manager for Chrome Remote Desktop to use. Common options are:

You can use other desktop environments, but Chrome Remote Desktop does not support 3D graphics acceleration. If you do choose a desktop environment that uses 3D graphics acceleration, you need to disable that feature, or the remote desktop service won't start.

For remote connections over slower networks we recommended Xfce because it has minimal graphical elements and few animations.

Xfce

  1. In the SSH window connected to your VM instance, install the Xfce desktop environment and basic desktop components:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes xfce4 desktop-base dbus-x11 xscreensaver
    

    XScreenSaver is required because the Xfce default screen locker (Light Locker) doesn't work with Chrome Remote Desktop (Light Locker displays a blank screen that cannot be unlocked).

  2. Configure Chrome Remote Desktop to use Xfce by default:

    sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
    
  3. Because there is no display connected to your instance, disable the display manager service on your instance:

    sudo systemctl disable lightdm.service
    
  4. Optional: Install the full suite of Linux desktop applications, including the Firefox browser, LibreOffice office application suite, and the Evince PDF viewer:

    sudo apt install --assume-yes task-xfce-desktop
    
  5. Optional: Install the Chrome browser on your instance:

    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

  1. In the SSH window connected to your VM instance, install the Cinnamon desktop environment and basic desktop components:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes cinnamon-core desktop-base dbus-x11
    
  2. Set your Chrome Remote Desktop session to use Cinnamon in 2D mode (which does not use 3D graphics acceleration) by default:

    sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/cinnamon-session-cinnamon2d" > /etc/chrome-remote-desktop-session'
    
  3. Optionally, install the full suite of Linux desktop applications, including the Firefox browser, the LibreOffice office application suite, and the Evince PDF viewer:

    sudo apt install --assume-yes task-cinnamon-desktop
    
  4. Optional: Install the Chrome browser on your instance:

    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

  1. In the SSH window connected to your VM instance, install the full Gnome desktop environment, including the Firefox browser, the LibreOffice office application suite, and the Evince PDF viewer:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes  task-gnome-desktop
    
  2. Set your Chrome Remote Desktop session to use Gnome

    sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/gnome-session" > /etc/chrome-remote-desktop-session'
    
  3. Disable the Gnome display manager service on your instance, because it conflicts with the Chrome Remote Desktop service.

    sudo systemctl disable gdm3.service
    sudo reboot
    

    This command reboots the VM.

  4. Reconnect through SSH before continuing.

  5. Optional: Install the Chrome browser on your instance:

    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

  1. In the SSH window connected to your VM instance, install the full Gnome desktop environment, including the Firefox browser, the LibreOffice office application suite, and the Evince PDF viewer:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes  task-gnome-desktop
    

    The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to configure a layout for a keyboard that would be directly connected to the VM instance.

  2. Set your Chrome Remote Desktop session to use the Gnome-Classic desktop:

    sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/gnome-session-classic" > /etc/chrome-remote-desktop-session'
    
  3. Disable the Gnome display manager service on your instance, because it conflicts with the Chrome Remote Desktop service.

    sudo systemctl disable gdm3.service
    sudo reboot
    

    This command reboots the VM.

  4. Reconnect through SSH before continuing.

  5. Optional: Install the Chrome browser on your instance:

    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

  1. In the SSH window connected to your VM instance, install the full KDE Plasma desktop environment, including the Firefox browser, the LibreOffice office application suite, and the Evince PDF viewer:

    sudo DEBIAN_FRONTEND=noninteractive \
        apt install --assume-yes  task-kde-desktop
    

    The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to configure a layout for a keyboard that would be directly connected to the VM instance.

  2. Set your Chrome Remote Desktop session to use KDE Plasma

    sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/startplasma-x11" > /etc/chrome-remote-desktop-session'
    
  3. Optional: Install the Chrome browser on your instance:

    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
    

Configure and start the Chrome Remote Desktop service

To start the remote desktop server, you need to have an authorization key for the Google Account that you want to use to connect to it:

  1. In the Google Cloud console, go to the VM Instances page:

    Go to the VM Instances page

  2. Connect to your instance by clicking the SSH button.

  3. On your local computer, using the Chrome browser, go to the Chrome Remote Desktop command line setup page:

    https://remotedesktop.google.com/headless

  4. If you're not already signed in, sign in with a Google Account. This is the account that will be used for authorizing remote access.

  5. On the Set up another computer page, click Begin.

  6. Click Authorize.

    You need to allow Chrome Remote Desktop to access your account. If you approve, the page displays a command line for Debian Linux that looks like the following:

    DISPLAY= /opt/google/chrome-remote-desktop/start-host \
        --code="4/xxxxxxxxxxxxxxxxxxxxxxxx" \
        --redirect-url="https://remotedesktop.google.com/_/oauthredirect" \
        --name=$(hostname)
    

    You use this command to set up and start the Chrome Remote Desktop service on your VM instance, linking it with your Google Account using the authorization code.

  7. Copy the command to the SSH window that's connected to your instance, and then run the command.

  8. When you're prompted, enter a 6-digit PIN. This number will be used for additional authorization when you connect later.

    You might see errors like No net_fetcher or Failed to read. You can ignore these errors.

  9. Verify that the service is running using the following command.

    sudo systemctl status chrome-remote-desktop@$USER
    

    If the service is running, you see output that includes the state 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
    

Connect to the VM instance

You can connect to the VM instance using the Chrome Remote Desktop web application.

  1. On your local computer, go to the Chrome Remote Desktop website.

  2. Click Access my computer.

  3. If you're not already signed in to Google, sign in with the same Google Account that you used to set up the Chrome Remote Desktop service.

    You see your new VM instance crdhost in the Remote Devices list.

  4. Click the name of the remote desktop instance.

  5. When you're prompted, enter the PIN that you created earlier, and then click the arrow button to connect.

    You are now connected to the desktop environment on your remote Compute Engine instance.

  6. If you are prompted, always allow the Remote Desktop application to read your clipboard and let you copy and paste between local and remote applications.

  7. If you installed the Xfce desktop, the first time you connect, you are prompted to set up the desktop panels. Click Use Default Config to get the standard taskbar at the top and the quick launch panel at the bottom.

xfce desktop showing the taskbar and quick launch panel.

Improve the remote desktop experience

This section provides instructions for changing settings in order to improve the remote desktop experience.

Install the Remote Desktop Chrome app

The Remote Desktop Chrome app gives a separate windowed experience and allows keyboard shortcuts that would normally be intercepted by Chrome to be used on the remote system.

If this app is not installed, do the following:

  1. Open the Session Options panel using the button that appears when you move the mouse to the side of the window.
  2. In the Install App section, click