Nowadays, we have moved many things to the cloud, including your photos, your files and your servers, what about your desktop environment? Imagine you don’t need to carry your heavy laptop any more, and you can access to the computing power of your laptop from any thin clients, such as a tablet with keyboards at anywhere. It’s possible to achieve using AWS instance with ubuntu desktop and Chrome Remote Desktop. I tried other solutions, such as AWS Workspace or VNC connection, but still, find the Chrome Remote Desktop with the lowest latency and close to native desktop performance. Here is how to do so:
- Logon to AWS console and launch an instance using the ubuntu server AMI.
Once the instance is launched, SSH to your ubuntu server. Update package manager and install wget:
$ sudo apt update $ sudo apt-get install --assume-yes wget
Download Chrome remote desktop package and install:
$ wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb $ sudo dpkg --install chrome-remote-desktop_current_amd64.deb $ sudo apt install --assume-yes --fix-broken
Next, we install the desktop GUI environment. I have tested out different distro and found that Xfce performs the best without fancy animations over a slow network.
$ sudo DEBIAN_FRONTEND=noninteractive apt install --assume-yes xfce4 desktop-base
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'
Install xscreensaver as an alternative to the default Xfce locker, which doesn’t work with remote desktop:
$ sudo apt install --assume-yes xscreensaver
Disable display manager as there is no display connected:
$ sudo systemctl disable lightdm.service
Add your user account to the Linux group then logout:
$ sudo usermod -a -G chrome-remote-desktop $USER $ logout
On your local laptop browser, open https://remotedesktop.google.com/headless Then follow the steps to set up another computer. You would probably copy command to your AWS command, similar to this:
DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/xxxxxxxxxxxxxxxxxxxxxxxx" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=
Finally, you can remote connect to your ubuntu desktop and have fun! One extra tip is that you can display your screensaver, which is not necessary:
You can now access your desktop environment from anywhere with any device. It’s especially useful as a software engineer who wants to code with a full set of tools as a development environment at any time.