Contents

Method 1

Install vncServer in Ububtu 12.04 server to create a virtual desktop on another computer

These are the instructions for installing vncserver on Ubuntu 12.04 server edition. They may also work on Desktop, but I haven't tested them on it.

First install ubuntu 12.04 server

Install Amahi using the instructions provided elsewhere on the wiki.

After reboot go to your HDA and login, then go to apps and install OpenSSH and webmin using the links in your HDA.

Reboot

sudo reboot now -h

From here on I used vim but you can use any editor you are comfortable with just replace vim with your choice.

A quick and short tutorial on vim:

Move the cursor to where you want to edit then press i
Edit as needed, when finished press esc then :wq to save your changes
If you make a mistake press :q! you exit without saving changes, then start again.

esc :wq to save the changes or :q! to start over. Now the desktop and login won't start in Ubuntu.

NOTE: This only installs a basic desktop, if you want to be able to use programs from your virtual desktop, network manager, media players, office, etc, they will need to be installed after vnc server is installed.

Reboot

sudo reboot now -h

B: We need to install VNC server to be able to interact with the gnome components for the desktop.

sudo apt-get install vnc4server

When prompted type Y and press Enter. This will install VNC Server which is required for running a virtual desktop on another machine.

Next type:

vncserver

You'll then be prompted to create and verify a new password.

We now need to kill the session we just created and make change the startup script for VNCServer to make it work properly.

NOTE: change the 1680x1050 to match the screen resolution of your Desktop computer

Press the ESC key once and type :wq and press Enter to save.

Next we need to make the file executable so, assuming you called your script StartVNC.sh then you'd type:

chmod a+x StartVNC.sh

Test the script by typing the following:

vncserver -kill :1

To make sure vncserver isn't running, then:

./StartVNC.sh

A new vnc session should start.

D: Create a cron job in webmin to run the script on boot

Stop vncserver

vncserver -kill :1

Now open your browser and go to your HDA and click on the webmin app you already installed, click continue to this website at the cert warning.

Enter user and password as required.

Within Webmin click on System and then Scheduled Cron Jobs in the left column. Then click the Create a new scheduled cron job option at the top of the screen that opens.

Click the button next to the Execute cron job as and choose the username you created when you installed Ubuntu. Hint: your username appears in a Putty/Terminal session prompt. eg. yourusernameappearshere@Myhdaserver.

Type or paste the name of your script including the full path

/home/xxxx/scripts/StartVNC.sh >/dev/null

into the Command box, replacing xxxx with your own usernam. The ">/dev/null" parameter will discard any output the script may produce.

Enter a suitable description in the Description field.

In the When to Execute - Simple schedule drop-down list choose When system boots then click the Create button at the bottom of the screen.

It should look like this:

First test that you've set the job up correctly within Webmin. You can do this by clicking on the job you've just created from the long list of cron jobs (not checking the box but clicking on the name). In the new window that opens click the Run Now button at the bottom of the screen. You should see a message similar to the one you saw when you tested it from a Putty/Terminal session.

Now let's check the script works on boot. So from the System -> Bootup and Shutdown menu within Webmin scroll down to the bottom of the screen and click the Reboot System button. Alternatively type

sudo reboot now -h

in a Putty/Terminal session.

After reboot go to your Windows machin and open Tight VNC Viewer and connect to your ubuntu virtual desktop. VNC Server now starts automatically on boot.

That's it you should now have vnc server start on boot and a virtual desktop for your server on another machine.

Most of this information was obtained from: www.havetheknowhow.com.

Method 2

This is just what I found on how to install a VNC for Ubuntu 12.04LTS after figuring out that TigerVNC (the above methods) do not work for Ubuntu. The method is copied from here. This will result in the gnome GUI, not Unity.

This will now give you a connection with the Unity desktop being displayed

Tips and Tricks

VNC does not respect the normal rules of elevating the current user through the use of entering the admin password. The only way to run many graphical programs that require the super user is to open a command line terminal within the VNC session and start the program with the "sudo" command. Two programs that may come in handy that work in this fashion are gparted and Synaptic Package Manager.