VNCServer 配置 
1、vncserver服务的启动redhat一般都自动安装了vncserver了 只要在服务列表中选中启动一下就可以了) 
  命令:
Java代码   收藏代码
  1. service vncserver start/restart/stop  

  启动桌面:vncserver(第一次启动时需要设置密码) 

2、vncserver的桌面配置 
  通过编辑文件$HOME/.vnc/xstartup来启动你喜欢的窗口管理器。 
  使用startkde &来启动KDE,使用gnome-session &来启动GNOME,fvwm2 &来启动FVWM2。 
例如: 
##################################################### 
#!/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 
#startkde 
#twm & 
########################################################## 

3、关闭服务器上自己的vnc连接 
  
Java代码   收藏代码
  1. vncserver -kill  :桌面号  

如:vncserver -kill  :1 

4、修改密码 
--删除密码文件 
rm -f $HOME/.vnc/passwd 
--重新启动vncserver,根据提示输入新的密码即可 
vncserver 

5、如何使服务器开机自动运行vncserver 不需要自己telnet 
   设置vncserver启动脚本实现系统自启动时启动vncserver。 
编辑/etc/sysconfig/vncservers,例如: 
Java代码   收藏代码
  1. # The VNCSERVERS variable is a list of  
  2. # display:user pairs.  
  3. #  
  4. # Uncomment the line below to start a VNC server on  
  5. # display :1 as my 'myusername' (adjust this to your  
  6. # own). You will also need to set a VNC password;  
  7. # run 'man vncpasswd' to see how to do that.  
  8. #  
  9. # DO NOT RUN THIS SERVICE if your local area network  
  10. # is untrusted! For a secure way of using VNC, see  
  11. # <URL:http://www.uk.research.att.com/vnc/sshvnc.html>.  
  12.   
  13. VNCSERVERS="2:oracle"  
  14. #VNCSERVERARGS[2]="-geometry 800*600 -nolisten tcp -nohttpd -localhost"  


在VNCSERVERS中修改myusername为你希望运行VNC桌面的用户。VNCSERVERS中的1表示VNC以桌面1运行,如果希望添加其他的桌面,可以修改配置如下: 
Java代码   收藏代码
  1. VNCSERVERS="1:root 2:oracle".  


VNCSERVERARGS可以设定对具体桌面连接的限定,具体参数说见文件开头说明,一般注释掉即可。 

6、防火墙会阻止vnc服务 
防火墙关闭和开启的命令:service iptables stop/start(及时生效) 
或编辑/etc/sysconfig/iptables 

7、如果想要删除当前配置的vnc,直接删除当前用户下的.vnc 目录即可 
例如: 
Java代码   收藏代码
  1. # cd /home/oracle  
  2. # rm -rf .vnc  




在Solaris下 
Java代码   收藏代码
  1. # vncserver  
  2. vncserver: couldn't find "Xvnc" on your PATH.  

执行如下即可 
Java代码   收藏代码
  1. #su root  
  2. #  
  3. # ln -s /usr/openwin/bin/xauth /usr/bin/  
  4. # ln -s /usr/X11/bin/Xvnc /usr/bin/  


另外说明下在Solaries下的vnc配置和linux的一样,区别在于useradd用户后 
Java代码   收藏代码
  1. root用户  
  2. su -  
  3. # groupadd dba  
  4. # groupadd oinstall  
  5. # useradd -g oinstall -G dba -m -d /export/home/oracle -s /usr/bin/bash oracle  
  6. # passwd oracle  


用户所在目录有变化: 
/home is an auto mount directory. The home directory for user in Solaris should be created in  /export/home