Translate

Wednesday, January 25, 2012

Virtual Network Computing (VNC)

Guys !!! VNC(Virtual Network Computing), as you all know is such a cool protocol you could find to make remote desktop available among cross platforms. But how do you get it work. Lot of people use to ask my hand for this simple issue and obviously that is the reason why you see this post in my BLOG.

First : Keep in mind that these software we typically use here are kind of client server products.

Assume : You have already installed your VNC client tool in your Windows desktop. Vnc viewer is such a cool tool for this. Upon successful installation you must be seeing the following window. BTW You want to see the GUI as well. That is why you use VNC. Lol. To have GUI, we all know that we must have installed xwindows in our linux machine.

Oops …
What the hell? How could I connect my Linux server using this !!!

As I told you before, these VNC software works on client server principles. Well, you already have got your VNC client installed in your windows Box. Now you need to install your VNC Server in the Linux Box. That is how you are going to remote desktop a linux server from Windows. Not only that, then you also need to set the Users for the VNC. At the same time you need to give them proper permissions too. Don’t forget, if you want to see the thrilling Linux UI in remote, you also have to enable the desktop (Desktop Manager or KDE) in your user configurations. Lets move on. I have a Nice sexy redhat box with me. Oh !!! my mine… I am the root: Look its a Linux 32 bit box indeed !!!

[root@cmb1u123 domino]# uname -a

Linux cmb1u123.cmb1.fast.no 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:39:47 EDT 2008 i686 i686 i386 GNU/Linux

Guys!!! Now we are going to up and run the vnc server.

  1. Locate the vnc-server-xxx.rpm package. You can download one free from the web. (http://rpm.pbone.net/index.php3/stat/4/idpl/3066972/dir/redhat_other/com/vnc-server-4.1.1-10.1.0.0.1.i386.rpm.html)
  2. Eg: Install a rpm package of VNC server. I assumed you use one redhat:D
    rpm -Uvh vnc-server-xxx.rpm
  3. VNC server is using different set of login authentication than the Linux /etc/passwd. Therefore you have to create VNC login password for individual Linux login accounts who are granted remote access with VNC client. To create VNC login password, just execute vncpasswd command and enter a valid password twice as usual.
  4. To start an instance of VNC server, just execute vncserver command, which will create the $HOME/.vnc directory with VNC default startup scripts inside (if $HOME/.vnc is not currently exists).
    Eg : VNC command line control (VNC restart)
    [root@8nbj42s ~]# /etc/init.d/vncserver restart
    Shutting down VNC server: 1:apsaras [ OK ]
    Starting VNC server: 1:apsaras
    New '8nbj42s:1 (apsaras)' desktop is 8nbj42s:1

    Starting applications specified in /home/apsaras/.vnc/xstartup
    Log file is /home/apsaras/.vnc/8nbj42s:1.log

  5. The vncserver command will startup a VNC server that open 3 next available TCP/IP port, starting from 5801, 5901, and 6001 respectively.
    Port 5801 is for VNC client connection over HTTP protocol, port 5901 is for VNC client connection over RFB protocol, and port 6001 is to allows X applications to connect to the VNC server.
  6. To kill the VNC server in Linux, just execute vncserver -kill :1 will kill the first VNC server that bind and listen to port 5801, 5901, and 6001. The vncserver -kill :2 will kill the second VNC server, and so on.

How to get KDE or Gnome Desktop Manager running in Linux VNC server?

Don’t worry, it’s just 3-seconds ahead !!! Edit the default VNC server startup scripts $HOME/.vnc/xstartup and uncomment the two “critical” lines, as per the scripts suggestion:

Finally What does it look like :


Conclusion:

Software are cool, only when we feel them. Don’t you think this apply to our life as well. Lol.