3

I need to get familiar with some software that doesn't run on any of my home machines (windows/mac). So I decided to spin up an EC2 instance and try it there.

However, getting EC2 to support a remote desktop session is proving to be harder than it has a right to be. I have tried techniques found through web searches but all are out of date and no longer relevant.

So far I have tried all these suggested solutions - none have worked so far:

[ec2-user@ip-xxx.xxx.xxx.xxx ~]$ yum groups list
Loaded plugins: priorities, update-motd, upgrade-helper
Installed groups:
   Editors
   Legacy UNIX compatibility
   Mail Server
   Network Servers
   Perl Support
   System Tools
Available Groups:
   Console internet tools
   DNS Name Server
   Development Libraries
   Development tools
   FTP Server
   Java Development
   MySQL Database
   MySQL Database client
   NFS file server
   Networking Tools
   PHP Support
   Performance Tools
   PostgreSQL Database client (version 8)
   PostgreSQL Database server (version 8)
   Scientific support
   TeX support
   Technical Writing
   Web Server
   Web Servlet Engine
Done

Nothing that says it will give me an X session.

Has anybody worked the kinks out of the setup and got it working recently?

P.S. A few people asked why not use a VirtualBox VM - forgot to mention that I definitely tried that first and for whatever reason none of them worked. I started with the most recent and worked backwards through each version - could not get them to launch or run. (My machine is a Cintiq Companion with Windows 8).

slashdottir
  • 178
  • 1
  • 2
  • 10
  • 5
    There is nothing "special" about an ec2 instance. It's a linux server. As long as you install the requisite software and ensure that firewall rules are not interfering, you can easily use a GUI. As an aside, though, why not just install VirtualBox on your machine and play with a local VM? – EEAA Oct 08 '14 at 22:39
  • @EEAA agreed, why bother with EC2 for something that simple when VMs are local, fast, and you get full control? – Avery Payne Oct 08 '14 at 22:44
  • 3
    +1 for using a local VM. That said, `yum repolist` will tell you what repos you're subscribed to, you're probably just missing one that has the X11/gnome/kde packages you want. – Sammitch Oct 08 '14 at 22:47
  • 1
    +1 somewhat awesome username. – mfinni Oct 08 '14 at 23:53
  • Ah, forgot to mention that I tried to use a VM - I spent days installing every version working backwards from the latest to several major releases back. None would work on my machine. I have a Cintiq Companion with Windows 8 and could not for the life of me get any version of virtual box to work. – slashdottir Oct 09 '14 at 01:58
  • I would recomend a local VM too, but if you really want to use X on EC2, why not install VNC-Server on it? – ThoriumBR Oct 09 '14 at 02:59
  • 1
    I have managed to get this working before using an Ubuntu instance and VNC. The method I used was similar to the following: http://www.serverwatch.com/server-tutorials/setting-up-vnc-on-ubuntu-in-the-amazon-ec2.html – hookenz Oct 09 '14 at 03:05
  • 1
    @Matt. Thank you - I tried your suggested link - still had to fiddle and funk around but got something going at last – slashdottir Oct 10 '14 at 17:21

4 Answers4

4

Following suggestion from Matt in the comments

Set up an SSH tunnel plus a local private key using instructions from this link: http://www.serverwatch.com/server-tutorials/setting-up-vnc-on-ubuntu-in-the-amazon-ec2-page-2.html

on ec2 ran these installers (not sure which ones are overkill - only that it eventually worked)

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server
sudo apt-get install x11vnc
x11vnc -storepasswd
sudo apt-get install gnome-core gnome-session-fallback

vncserver
vncserver -kill :1  #(to get the default xstartup file)

edit $HOME/.vnc/xstartup to look like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &

had to set a password for the ubuntu user (gnome desktop seems to need this?)

sudo passwd ubuntu

had to reboot the instance

then ran

 sudo x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw

Then I could connect via TightVNC and see the Ubuntu desktop

Not sure what other troubles I may run into, but at least I got this far

Thank you Matt

slashdottir
  • 178
  • 1
  • 2
  • 10
1

I noticed you said you tried X2Go but it failed; I am using it successfully right now on two Ubuntu 14.04 instances, one is an EC2 micro on AWS, the other is a small DigitalOcean droplet (it also works on a number of other distros, but you'll have to modify step 3 below based on these instructions). While VNC will certainly work, X2go is faster and much more responsive, as well as supporting SSH proxy by default.

I went through the exact same frustration of finding outdated or irrelevant articles and suggestions for setting up a cloud desktop, but once I figured out the X2Go solution, its actually very simple to get up and running in ~10 mins.

Here are the steps I used to set everything up:

  1. SSH key -- since it's a remote server, you should already be able to login via SSH normally, but if not, you'll need an SSH login via RSA key for a user with sudo privileges

  2. System update -- not required, but depending on when you last updated the remote machine, doing so now may avoid incompatibilities or headaches:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get autoremove
    
  3. Install X2Go Server -- create a new file on the remote machine and paste the following contents into it:

    #!/usr/bin/env bash
    # note: this script may take some time to run, particularly
    # the steps involving the install of xubuntu as it has many
    # packages included as dependencies
    
    printf "\ninstalling required packages...\n"
    sudo apt-get install python-software-properties
    sudo apt-get install software-properties-common
    
    printf "\ninstalling xubuntu...\n"
    sudo apt-get install xubuntu-desktop
    
    printf "\nadding x2go ppa repository...\n"
    sudo add-apt-repository ppa:x2go/stable
    sudo apt-get update
    
    printf "\ninstalling x2go server...\n"
    sudo apt-get install x2goserver x2goserver-xsession
    
    printf "\nxubuntu and x2go server have been installed.\n"
    echo "don't forget to reboot your instance as well!"
    

    Execute the file to install everything (. ./<filename>); you may need to modify the file permissions first to make it executable -- typically I've had it take between 5-10 minutes, however, ymmv

  4. Install X2Go Client -- the last step is to install the client for the OS you want to access the remote machine from; installation instructions for Windows, Mac, and various flavors of Linux can be found here

Now you can use the client to connect to the machine via your configured host, user, key, port and access your GUI cloud desktop; make sure you select XFCE as the session type when setting up the connection.

-1

If you are using NoMachine on an Amazon instance, you should follow the instructions here: https://www.nomachine.com/AR10K00710 (NoMachine on headless servers)

Rich T
  • 1
  • Welcome to Server Fault! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – masegaloeh Oct 09 '14 at 12:53
  • forgot to include that one in the list of things I already tried. Xvfb is not available – slashdottir Oct 09 '14 at 19:05
-3

No, you can't. Amazon Linux does not have a Repo for X-server packages. Also, It was meant to be used for Server side roles and hence all he X related stuff is not available.

Thanks slayedbylucifer

Form https://stackoverflow.com/a/21273694/1105231

XY WANG
  • 1
  • 1