2010/11/09

VNC Configuration

#Configure a VNC server in Linux
*CentOS release 5.5 (Final)
*VNC-server-4.1.2-14.e15_5.4
                         
[1]check whether you installed VNC[root]
rpm -q vnc-server

[2]install VNC[root]
yum install vnc-server

[3]add an new 'VNC-user' user[root]

[4]swap to the 'VNC-user' to login, and type command 'vncserver' to build remote connection passwd[VNC-user]

[5]startup VNC[VNC-user]
/etc/rc.d/init.d/vncserver restart

[6*]entry VNC directory[VNC-user]
cd .vnc

[7*]check[VNC-user]
ls
hostname:number.pid
hostname:port.pid

[8]stop VNC connection
vncserver -kill :number

[9]edit the VNC-client environment[root]
vim /etc/sysconfig/vncservers
#VNCSERVERS="2:myusername"                                                                  //default
#VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"  //default
VNCSERVERS="20103:vnc-user-name"                      //append
VNCSERVERARGS[20103]="-geometry 1024x768"     //append, Xwindows

[10]restart VNC[root]
/etc/rc.d/init.d/vncserver restart

[11]iptables settings[root]
//allow port 65432
/sbin/iptables -I INPUT -p tcp --dport 65432 -j ACCEPT
//save rule
/etc/rc.d/init.d/iptables save
//restart
/etc/rc.d/init.d/vncserver restart

[12]VNC-Client
download> http://www.realvnc.com/products/download.html
input IP&PORT
VNC Viewer : Authentication [No Encryption]

[13]disable X-Window and employ GNOME[VNC-user]
vim ~/.vnc/xstartup
#vim ~/.vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER                          //upmark
exec /etc/X11/xinit/xinitrc                               //upmark

[14]restart VNC
/etc/rc.d/init.d/vncserver restart

[15]VNC-SERVER auto start on boot
/sbin/chkconfig vncserver on

[16]change paswd 'vncpasswd'