I followed this one
http://wiki.centos.org/HowTos/VNC-Server
ssh
root@xxxxxxxxxxxx -L 5901:localhost:5901
root@xxxxxxxxxxxx’s password:
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 5901
Could not request local forwarding.
Last login: Tue Dec 22 15:01:10 2009 from 192.168.1.1
tapas@tapas-laptop:~$ vncviewer 192.168.1.10
192.168.1.10 5900
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.(Socket.java:372)
at java.net.Socket.(Socket.java:186)
at rfbProto.(rfbProto.java:93)
at vncviewer.connectAndAuthenticate(vncviewer.java:193)
at vncviewer.run(vncviewer.java:122)
at java.lang.Thread.run(Thread.java:619)
java.net.ConnectException: Connection refused
Other way which I tried was
From the CentOS Wiki
http://wiki.centos.org/HowTos/VNC-ServerI read and did
Here is what I did
added a user tapas on 192.168.1.10
for using vnc
VNCSERVERS="1:tapas"
VNCSERVERARGS[1]="-geometry 640x480"
also did # service vncserver start
went to /home/tapas/.vnc and edited
xstartup
removed the comment from these two lines
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
also added following lines to the start of the file
( while true ; do xterm ; done ) &
So that xterm session is available
restarted vncserver
service vncserver restart
But VNC Server is running which we can verify from the following outcome
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5902
vncext: Listening for HTTP connections on port 5802
vncext: created VNC server for screen 0
error opening security policy file /usr/lib64/xserver/SecurityPolicy
/home/tapas/.vnc/xstartup: line 9: xsetroot: command not found
/home/tapas/.vnc/xstartup: line 11: xterm: command not found
/home/tapas/.vnc/xstartup: line 12: twm: command not found
Could not init font path element unix/:7100, removing from list!
Connections: accepted: 192.168.1.3::56069
SConnection: Client needs protocol version 3.8
SConnection: Client requests security type VncAuth(2)
Tue Dec 22 23:07:48 2009
VNCSConnST: Server default pixel format depth 16 (16bpp) little-endian rgb565
VNCSConnST: Client pixel format depth 16 (16bpp) little-endian rgb565