Saturday, March 20, 2010

How to configure or setup VNC server in linux rhel5 / centos5

Sponsored Links
Sometimes we need to access remote servers. Most times we just ssh into them. But what if we required graphical access. VNC server comes there. It helps us to login to remote server graphically. Just as in remote desktop in Windows. VNC is Virtual network Computing.

How to Configure a VNC server In linux?
###VNC Server configuration###
#yum -y install vnc*

For using this we need to setup a password for the server. We can set it by the linux command vncpasswd.
###Set the password###
#vncpasswd

###Restart the service###
#service vncserver start

To make VNC server we need to run the following command. While executing it. it will create some files.
###Run the server command###
#vncserver
or
#vncserver :13 The display number. Default will be one. If available.

This file will be generated when executing the above command. We need to do a small change in that in order to make it was server.
# vi .vnc/xstartup
uncomment the following lines.
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

#service vncserver restart

###VNC Client configuration###
[Accessing the VNC server from the client]
###Run the vncviewer command###
#vncviewer
Server : 192.168.1.101:2 Give the IP of Server with the display ID
Password: ****** Give the password

Its over. Have fun


###Installation through VNC###

boot: linux vnc vncpassword=redhat ip=192.168.1.101 netmask=255.255.255.0 gateway=192.168.1.10 //if more than one ethernet device is present u have to select one from them. But no need to configure the ips again.

language selection
network selection //if more than one is present

client
vncviewer ip:1
password: redhat

If you are getting grey screen when login via vnc, configure the vnc as follows.


[root@server ~]# cat /root/.vnc/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" &
gnome-session &
#twm &
[root@server ~]#


Kill all the processes associated with vnc and restart the service and execute vncserver command again.
done!!
Sponsored Links

No comments:

Post a Comment

Be nice. That's all.