Centos6.0开启VNC服务

来源:互联网 发布:淘宝网长袖连衣裙棉麻 编辑:程序博客网 时间:2024/06/08 12:56

首先讲述一下vnc的机制:

Linux下的VNC可以同时启动多个vncserver,各个vncserver之间用显示编号(display number)来区分,每个vncserver服务监听3个端口,它们分别是:

5800+显示编号:  VNC的httpd监听端口,如果VNC客户端为IE,Firefox等非vncviewer时必须开放

5900+显示编号:  VNC服务端与客户端通信的真正端口,必须无条件开放

6000+显示编号:  X监听端口,可选显示编号、开放的端口分别由/etc/sysconfig/vncservers文件中的VNCSERVERS和VNCSERVERARGS控制。

-geometry 桌面分辨率,默认1024x768;

-nohttpd 不监听HTTP端口(58xx端口); 

-nolisten tcp 不监听X端口(60xx端口); 

-localhost 只允许从本机访问; 

-AlwaysShared 默认只同时允许一个vncviewer连接,此参数允许同时连多个vncviewer;

-SecurityTypes None 登录不需要密码认证VncAuth默认值,要密码认证。 


1、首先确认系统上有没有vnc,vnc-server

rpm -qa | grep 'vnc'

否则安装之

yum install vnc vnc-server


2、配置/etc/sysconfig/vncserver

[plain] view plaincopyprint?
  1. # The VNCSERVERS variable is a list of display:user pairs.  
  2. #  
  3. # Uncomment the lines below to start a VNC server on display :2  
  4. # as my 'myusername' (adjust this to your own).  You will also  
  5. # need to set a VNC password; run 'man vncpasswd' to see how  
  6. # to do that.    
  7. #  
  8. # DO NOT RUN THIS SERVICE if your local area network is  
  9. # untrusted!  For a secure way of using VNC, see this URL:  
  10. # http://kbase.redhat.com/faq/docs/DOC-7028  
  11.   
  12. # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.  
  13.   
  14. # Use "-localhost" to prevent remote VNC clients connecting except when  
  15. # doing so through a secure tunnel.  See the "-via" option in the  
  16. # `man vncviewer' manual page.  
  17.   
  18. VNCSERVERS="2:cshi"  
  19. VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"  

即uncomment最后二行,并改成实际的用户名

重启VNC服务:


3、安装libXfont和pixman等

若此时执行vncserver,则会有如下报错:

[plain] view plaincopyprint?
  1. vncext:      VNC extension running!  
  2.  vncext:      Listening for VNC connections on all interface(s), port 5902  
  3.  vncext:      created VNC server for screen 0  
  4. [dix] Could not init font path element /usr/share/X11/fonts/misc, removing from list!  
  5. [dix] Could not init font path element /usr/share/X11/fonts/100dpi, removing from list!  
  6. [dix] Could not init font path element /usr/share/X11/fonts/Type1, removing from list!  
  7. [dix] Could not init font path element /usr/share/fonts/default/Type1, removing from list!  
  8. [dix] Could not init font path element built-ins, removing from list!  
  9.   
  10. Fatal server error:  
  11. could not open default font 'fixed'  

经调查得知:yum install libXfont可解决之

再执行vncserver,又有如下错误:

[plain] view plaincopyprint?
  1. /usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids  
  2. /usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids  

解决办法:yum install pixman


4、准备登陆


用vncviewer客户端进行登陆。如果没有指定Xvnc的显示号,则


指定显示号后:


若系统中安装了智能卡软件,则会有如下反应,可不管:

或者停止该服务:service pcscd stop


0 0