Search This Blog

Sunday, September 25, 2011

HOW TO configure vnc server and client on linux machine

Dear All,

This is one of the common task DBA needs to do :
1. HOW TO access linux server from windows machine remotely?
2. HOW TO configure vnc server on linux machine

Answer of question 1,2:
Step: 

1. Download and install vnc client version on windows machine here
2. logon to linux machine with root
3. check vnc rpm required package is installed or not
4. add a user to vnc server file
5. setting password for vnc access
6. start vnc server

login as: root
root@192.168.100.9's password:
Last login: Sun Sep 25 12:29:14 2011 from 192.168.104.114
[root@fakorapd ~]# rpm -qa | grep vnc
vnc-server-4.1.2-9.el5
[root@fakorapd ~]# cat /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# .

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
[root@fakorapd ~]# vi /etc/sysconfig/vncservers
[root@fakorapd ~]# vncpasswd
Password:
Verify:
[root@fakorapd ~]# vncserver :1
xauth:  creating new authority file /root/.Xauthority

New 'fakorapd.fakhruddin.local:1 (root)' desktop is fakorapd.fakhruddin.local:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/fakorapd.fakhruddin.local:1.log

[root@fakorapd ~]# cd
[root@fakorapd ~]# cd .vnc/
[root@fakorapd .vnc]# cat xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
[root@fakorapd .vnc]# vi xstartup
[root@fakorapd .vnc]# vncserver -kill :1
Killing Xvnc process ID 9881
[root@fakorapd .vnc]# vncserver :1

New 'fakorapd.dummy.local:1 (root)' desktop is fakorapd.dummy.local:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/fakorapd.dummy.local:1.log

[root@fakorapd .vnc]#




---you will see grey color screen but not colorful :) in linux server , because we have started xserver , comment out below lines from xstartup file---

[root@fakorapd ~]# cd .vnc/
[root@fakorapd .vnc]# cat xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
[root@fakorapd .vnc]# vi xstartup
[root@fakorapd .vnc]# vncserver -kill :1
Killing Xvnc process ID 9881
[root@fakorapd .vnc]# vncserver :1

New 'fakorapd.dummy.local:1 (root)' desktop is fakorapd.dummy.local:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/fakorapd.dummy.local:1.log

after that you will be able to see color ful desktop of linux server as below.

No comments: