After 19 grueling hours trying to set up a VNC Client that resides on my VNC Server, here it is.
I was looking for a Java Based VNC Client, that someone could simply connect to through my existing apache web server, and enter the password. Then, they could browse the machine just like a normal VNC connection.
I thought all I had to do was apt-get the tightvnc-java package. Nope. Wouldn't give me a web interface. Besides, I wanted it integrated.
Here's how I did it.
Make sure that you have the universe repository enabled. http://www.ubuntuguide.org/#extrarepositories
Also make sure that you have the correct plugins for your browser, if you are going to be testing it on the same machine. (that means you need the java plugin for Firefox, for most of you.)
1. INSTALL APACHE (If not already done)
If you don't already have Apache installed, install it now.
That's easy, it comes all nice and configured, ready to go. Let's check the setup with the web browser. Just point it to 127.0.0.1 (Yep, "localhost" does just fine too) It should pop up with a screen that says "apache2-default/" with a little folder in front of it. If it doesn't, try logging out, and then back in.
YAY! That worked! (If not, there is a nice tutorial on how to install apache at http://www.ubuntuguide.org/#apachehttpserver that I used)
Now for our purposes, all we need is apache. We don't have to worry about any other parts other than the base installation. (IE. php, mysql, etc.)
2. ACTIVATE REMOTE DESKTOP
This is actually a VNC server that comes shipped with Ubuntu, and since I am tailoring this to be simple, I thought I would use this instead of X11VNC. Intangible wrote a nice peice on installing and configuring X11VNC if you want to check it out.
To activate this, go to System -> Preferences -> Remote Desktop. Allow other Users to view and control your desktop, and MAKE SURE TO PUT IN PASSWORD PROTECTION!! Also, turn off asking for confirmation.
3. DOWNLOAD AND INSTALL THE JAVA VNC VIEWER
This is actually pretty simple too. I didn't use the repository, because I needed all the files in one place, ready for deployment.
Download this file to your home directory:
(From http://www.tightvnc.com it's in the downloads section, under "Java
(viewer only)" and the package you want is the tar.gz of the binary format downloads)
sudo file-roller /home/user/tightvnc-1.2.9_javabin.tar.gz
(replace "user" with your user name)
extract everything to /var/www
sudo gedit /var/www/index.html
Delete all of the file, and replace it with this slightly modified version.
Save it.Code:<HTML> <TITLE> TightVNC desktop </TITLE> <APPLET CODE=VncViewer.class CODEBASE=classes/ WIDTH=800 HEIGHT=632> <param name=PORT value=5900> <param name="Open New Window" value="yes"> </APPLET> <BR> <A href="http://www.tightvnc.com/">TightVNC site</A> </HTML>
4. TRY IT OUT!
go to a browser, and go through the same steps as you did to check the apache server. It should pop up with a java window this time! That's your client! Feel free to type in your password, and give it a go, from another machine. (Bad things happen when you connect to the local computer, and share the same screen.)
To connect from a remote computer, get your IP address, ( http://www.whatsmyip.com/ ) and go type it into another computer's browser. If that computer is on your network, you need your "Private IP" which you can get from typing ifconfig into the browser.