Skip to content

Instantly share code, notes, and snippets.

@pseudokool
Created September 11, 2018 17:05
Show Gist options
  • Save pseudokool/c7707937f075dd74cfa905edc80de39b to your computer and use it in GitHub Desktop.
Save pseudokool/c7707937f075dd74cfa905edc80de39b to your computer and use it in GitHub Desktop.

Revisions

  1. pseudokool created this gist Sep 11, 2018.
    51 changes: 51 additions & 0 deletions desktop-mode-ubuntu-aws-ec2.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    # Ubuntu 16.04 on AWS EC2

    This guide enables desktop mode in Ubuntu 16.04 (Xenial Xerus) running off an AWS EC2.


    ## Setup

    * Launch an EC2 instance with Ubuntu 16.04 (should work on all versions greater too)
    * Ensure a security group is configured, that allows ingress on ports 22 (SSH) and 5901 (VNC, 5900+N, where N is the display number)
    * SSH into the instance, update the system, install the XFCE desktop and the lightweight VNC server:
    ```
    sudo apt-get update
    sudo apt install xfce4 xfce4-goodies tightvncserver
    ```
    * Now, initialize. Assign a password to login in via remote desktop. Finally, kill VNC server.
    ```
    vncserver
    vncserver -kill :1
    ```
    * To reconfigure VNC:
    ```
    mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
    nano ~/.vnc/xstartup
    ```
    * Add in the following to the _xstartup_ config.
    ```
    #!/bin/bash
    xrdb $HOME/.Xresources
    startxfce4 &
    ```
    * Make _xstartup_ an executable script and start the VNC server
    ```
    sudo chmod +x ~/.vnc/xstartup
    vncserver
    ```


    ## Connecting to the instance

    Once setup is complete, you can remote desktop into your instance with GUI.

    * On OS X, use screen sharing
    ```
    vnc://<instance_ip>:5901
    ```
    * On Linux, use _krdc_, _remmima_ etc

    ## References

    * [EC2-VNC] (https://help.ubuntu.com/community/EC2-VNC)
    * [How to Install and Configure VNC on Ubuntu 16.04] (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04)