DEV Community

Victor Leung
Victor Leung

Posted on • Originally published at Medium on

Install ubuntu desktop on AWS instance with Chrome Remote Desktop

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:

  1. Logon to AWS console and launch an instance using the ubuntu server AMI.

  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. 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'
Enter fullscreen mode Exit fullscreen mode
  1. Install xscreensaver as an alternative to the default Xfce locker, which doesn’t work with remote desktop:
$ sudo apt install --assume-yes xscreensaver
Enter fullscreen mode Exit fullscreen mode
  1. Disable display manager as there is no display connected:
$ sudo systemctl disable lightdm.service
Enter fullscreen mode Exit fullscreen mode
  1. Add your user account to the Linux group then logout:
$ sudo usermod -a -G chrome-remote-desktop $USER
$ logout
Enter fullscreen mode Exit fullscreen mode
  1. 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=
Enter fullscreen mode Exit fullscreen mode
  1. 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.

Written by Victor Leung who is a keen traveller to see every country in the world, passionate about cutting edge technologies. Follow me on Twitter

Originally published at https://victorleungtw.com.

Top comments (0)