Chrome Remote Desktop headless
This tutorial shows you how to set up the
Chrome Remote Desktop service on a Debian Linux virtual machine (VM) instance on
Compute Engine. Chrome Remote Desktop allows you to remotely access
applications with a graphical user interface from a local computer or mobile
device. For this approach, you don't need to open firewall ports, 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.
For the purposes of this tutorial, the default 1 vCPU (n1-standard-1) machine type with Debian Linux boot disk works fine, so you don't need to change the default settings.
Installing Chrome Remote Desktop on the VM instanceThe next step is to install Chrome Remote Desktop on the VM instance.
Installing an X Windows System desktop environmentYou 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.
In the SSH window connected to your VM instance, install the Xfce
desktop environment and basic desktop components: The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to
configure a layout for a keyboard that would be directly connected to
the VM instance. 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). Configure Chrome Remote Desktop to use Xfce by default: Optionally, install the full suite of Linux desktop applications,
including the Firefox browser, LibreOffice office application
suite, and the Evince PDF viewer: In the SSH window connected to your VM instance, install the
Cinnamon desktop environment and basic desktop components: The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to
configure a layout for a keyboard that would be directly connected to
the VM instance. Set your Chrome Remote Desktop session to use Cinnamon in 2D mode
(which does not use 3D graphics acceleration) by default: Optionally, install the full suite of Linux desktop applications,
including the Firefox browser, the LibreOffice office application
suite, and the Evince PDF viewer: 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: The DEBIAN_FRONTEND=noninteractive parameter suppresses a prompt to
configure a layout for a keyboard that would be directly connected to
the VM instance. Set your Chrome Remote Desktop session to use Gnome
Regardless of which desktop environment you've installed, complete the installation process by following these steps:
Configuring and starting the Chrome Remote Desktop serviceTo 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:
Connecting to the VM instanceYou can connect to the VM instance using the Chrome Remote Desktop web application.
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. Improving the remote desktop experienceThis section provides instructions for changing settings in order to improve the remote desktop experience. Enable Clipboard SynchronizationClipboard Synchronization allows the contents of the clipboard to be shared between the local and remote machines. If this feature is not already enabled, do the following:
Install the Remote Desktop Chrome appThe 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:
The remote desktop session reopens in its own application window. You can move any remote desktop sessions from a Chrome tab to the app window by clicking the Open With open_in_new icon in the URL bar. Disable animations and effects in CinnamonThe Cinnamon desktop uses several graphical features and animations, such as semi-transparent windows and menus that fade in and out. Because these animations take more time to render over a remote connection, it can make the user interface feel slow. To disable these effects:
Set a user passwordThe user account created by Compute Engine doesn't have a password. However, several desktop environments require one for unlocking screensavers and authorizing administrative actions. It is therefore important to set a password for your user:
Disable screensavers and lock screensBecause you're accessing your desktop from a remote computer, it's normally not necessary to use a screensaver or screen locker, so you can disable these.
Increase the desktop resolutionIf you have an ultra high-resolution monitor, you might find that the default maximum remote desktop size of 1600 x 1200 is too small. If so, you can increase it to the resolution of your monitor.
Choose a different desktop environmentIn the preceding section, you set a default desktop environment in the global /etc/chrome-remote-desktop-session configuration file. You can also choose a different desktop environment (if it's installed) by specifying it in the .chrome-remote-desktop-session configuration file in your home directory:
After you make this change, restart the service so the change takes effect: sudo systemctl restart chrome-remote-desktop@$USERAs mentioned before, Chrome Remote Desktop does not support 3D graphics acceleration. Therefore, for any desktop environments that uses these features, you need disable 3D graphics, or the session will not start. Automating the installation processWhen you need to set up multiple machines with Chrome Remote Desktop, the manual installation steps can become repetitive. You can use a custom startup script to automate this process, using the following procedure:
This script only installs the required packages; you still need to configure the Remote Desktop Service for your user, as described previously. There are various ways to specify a startup script when creating a new VM instance:
For more information on the alternative methods of how to configure the startup script, see Running Startup scripts in the Compute Engine documentation. TroubleshootingCheck the status of the Chrome Remote Desktop serviceIf at any point the Chrome Remote Desktop service is not responding, you can check its status by using SSH to connect to the instance and running the following command: sudo systemctl status chrome-remote-desktop@$USERIf 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/; enabled; vendor preset: enabled) Active: active (running) since DATE_TIME; ELAPSED_TIMETo restart the service, use the following command in the SSH window: sudo systemctl restart chrome-remote-desktop@$USERChrome Remote Desktop writes log information to the system journal: 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 rebootYou can check these log files for error messages. Re-enable the serviceIf you have mistakenly disabled connections to the remote instance in the client app, you can reconfigure the service and re-enable it by following the instructions in Configuring and starting the Chrome Remote Desktop service. Check the global and user-specific session configuration files.Check the contents of the global /etc/chrome-remote-desktop-session configuration file and the user-specific ~/.chrome-remote-desktop-session configuration file and confirm that the specified desktop environments are installed. To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources. Deleting the projectThe easiest way to eliminate billing is to delete the project that you created for the tutorial. To delete the project:
If you plan to explore multiple tutorials and quickstarts, reusing projects can help you avoid exceeding project quota limits. Delete the Compute Engine instanceAs an alternative to deleting the entire project, you can delete the VM instance you created for this tutorial:
If you no longer want to connect to the VM instance, you can disable it and remove the instance from the Remote Devices list.
|