The server is a headless Ubuntu 12.04 box on Amazon Web Services. The client machine is my Windows 7 laptop.
I found lots of advice about GUI interfaces for Ubuntu, but none of it worked in my situation. I encountered problems such as:
- It was often suggested to use xRDP as the server and the built in Windows Remote Desktop as the client. That would be great if it worked, but I just couldn't get it to work. Once in a while, I could log in, but most of the time I got password-related errors.
- A lot of the advice was for old versions of Ubuntu.
- The advice assumed a GUI was already installed on the server, that is, it was Ubuntu desktop rather than a headless Ubuntu server.
I finally found a solution that worked: vnc4server as the server and TightVNC Viewer as the client. Many thanks to Coddswallop's post on vnc4server setup.
Setting up vnc4server on the Ubuntu server
- Use an SSH client to connect to the server.
- Enter sudo apt-get update.
- Enter sudo apt-get install gnome-core gnome-session-fallback.
- Enter sudo apt-get install vnc4server.
- Enter vncserver.
- You'll be prompted to make up a password. Enter whatever you like, and make a note of it. You'll need this password when using the VNC client to connect.
- Re-enter the same password when prompted.
- Enter vncserver -kill :1.
- Enter cp .vnc/xstartup .vnc/xstartup.bak.
- Use your favorite text editor (I used VIM) to modify the file .vnc/xstartup, so that it looks like this:
- Enter vncserver -geometry 1200x650. You can change 1200x650 to whatever width and height suits your client machine's display, and you can add an optional depth parameter to change the color depth.
- Enable the necessary port in your firewall. In my case, this was port 5901. In the AWS Control Panel, I edited the applicable Security Group, creating an inbound rule for port 5901 for my laptop's IP address.
- Note: After rebooting the server, you'll need to reissue the command vncserver -geometry 1200x650. If you wish, you could set up your server to execute this command automatically on startup.
Setting up TightVNC Viewer on the Windows 7 client
- I visited http://www.tightvnc.com/download.php and downloaded the Installer for Windows (64-bit).
- I ran the resulting tightvnc-2.6.4-setup-32bit.msi.
- Windows asked whether I wanted to give the installer permission to run, and I said yes.
- During the installation, I was asked whether to allow the installer to create a Windows firewall rule. I said no.
- I selected custom installation and installed only the client, omitting the server component.
- From the Start Menu, I launched TightVNC Viewer.
- In the Remote Host field, I entered my server's public IP address followed by port :5901. Example: 12.34.56.78:5901. Then I clicked Connect.
- When prompted for a password, I entered the password I made up when installing the server.
- A GUI interface to my server opened. Yay!