How to View the Remote Desktop of a Headless Server

This is applicable to those people who do most of their works on CLI. But how about if a certain task requires that your server has a running X windows which is frequently not available on most linux-based servers? The answer is a virtual X server together with VNC.

We'll not tackle what is X server nor what is VNC, instead you may use the power of Google or just visit Wikipedia.

Requirements

  • Xvnc
  • SSH client (e.g. PuTTY)
  • VNC Viewer (e.g. portable TightVNC)


Procedures

Before anything else, have a copy of an ssh client like PuTTY.

1. Install Xvnc

Using your ssh client, log in to the remote server and execute this command:

$ sudo yum install vnc-server

Or use this if you're using Ubuntu:

$ sudo apt-get install vnc4server

2. Start Xvnc

Once Xvnc is installed, start vncserver using the default display which is :0

$ sudo vncserver :0

Please note that Xvnc will ask for password on its first run. Better memorize it or write it down.

3. Start VNC Viewer

- On your local PC, lauch your VNC Viewer (which is portable TightVNC in my case)
- Enter the address of the remote server that you want to access
- Enter the passsword we used on step 2
- Then wait for VNC viewer to connect

You would see a gray background environment and that's it, you're now viewing your remote server's desktop.

To do a further test you may want to launch Firefox by issuing a command on your ssh client.

$ sudo export DISPLAY=:0
$ sudo firefox google.com

Comments

Popular posts from this blog

Remote Deployment with Ant and Rsync

How to Install CruiseControl