Question

I know that cloud instances such as EC2 on AWS have minimal installation of linux OS hence the UI is not available to use via any Remote desktop protocol such as VNC.

I would like to know if there are any way through which i can have the standard ubuntu UI installed on my AWS/EC2 which then i can access using some remote desktop protocol ?

Was it helpful?

Solution

Yes you can install xfce and use it using a VNC viewer on your remote system.

You need to follow the following steps:

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install vnc4server
  4. sudo apt-get install gnome-core xfce4 xfce4-goodies firefox nano -y --force-yes
  5. Backup default configuration

    mv ~/.vnc/xstartup ~/.vnc/xstartup.bak

  6. Create new basic conf file:

    vim ~/.vnc/xstartup

    paste these lines into it

    #!/bin/bash
    xrdb $HOME/.Xresources
    startxfce4 &
    
  7. sudo chmod +x ~/.vnc/xstartup

  8. Setting up as service:

    sudo vim /etc/init.d/vncserver

    paste the following code into it:

    #!/bin/bash
    PATH="$PATH:/usr/bin/"
    export USER="user"
    DISPLAY="1"
    DEPTH="16"
    GEOMETRY="1024x768"
    OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
    . /lib/lsb/init-functions
    case "$1" in
    start)
    log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
    ;;
    stop)
    log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
    ;;
    restart)
    $0 stop
    $0 start
    ;;
    esac
    exit 0
    
  9. sudo chmod +x /etc/init.d/vncserver

  10. sudo service vncserver start
  11. ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip_address
  12. sudo update-rc.d vncserver defaults

These guides has been a great help.

Linode: Using VNC to operate a desktop on ubuntu

DigitalOcean: Installing and configuring VNC

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top