当前位置: > Linux服务器 > VNC >

centos 6.3 vnc连接失败—— font catalog ,appropriate font path,Xvnc: undefined symbol,vncviewer: ConnectTo

时间:2015-02-08 22:14来源:blog.csdn.net 作者:IT

摘要:linux环境下,利用VNC连接远程桌面是经常用到的。这里,我们介绍centos上,利用VNC连接远程桌面的方法和常见的两个问题的解决方法1)由于字体问题,导致VNCserver无法启动 2)由于防火墙问题,导致开启VNCserver以后,无法在VNCviewer连接过来。

 

本文来源:http://blog.csdn.net/trochiluses/article/details/10946181

一、查看是否安装 VNC


注意相关软件源的查找:
[root@xen ~]# rpm -qa|grep tigervnc
tigervnc-1.0.90-0.17.20110314svn4359.el6.x86_64
tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64

如果没有就安装下了 

[root@xen ~]# yum install tigervnc tigervnc-server

添加启动项

[root@xen ~]# chkconfig --add vncserver
[root@xen ~]# chkconfig vncserver on

 

二、设置 VNC 密码 

 



[root@xen ~]# vncserver
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/xen:1.log

会在当前用户主目录下 生成 .vnc  目录和配置文件

[root@xen ~]# vncpasswd 
Password:
Verify:

设置的密码保存在  /root/.vnc/passwd 

 

三、VNC 配置 

 


1)gnome桌面显示
修改 xstartup 文件 把最后的 twm & 删掉 加上 gnome-session & 
编辑/root/.vnc/xstartup,

 vi /root/.vnc/xstartup



如果直接 启动
[root@xen .vnc]# /etc/init.d/vncserver start
正在启动 VNC 服务器:no displays configured                [失败]

 

2)修改监听端口号、是否禁止远程监听和tcp监听

所以要修改  /etc/sysconfig/vncservers 文件添加以下内容
VNCSERVERS="2:root"
# 桌面号:用户    监听 590* 端口
VNCSERVERARGS[2]="-geometry 800x600"//这句话的意思是允许非root用户进行远程监听,而且可以使用tcp协议

 

3)启动主机的多用户登录模式

这样修改后,就算 /etc/inittab 启动模式为 3  也可以正常进入图形界面

 

 

启动 vncserver
[root@xen ~]# /etc/init.d/vncserver start
正在启动 VNC 服务器:2:root xauth: (stdin):1:  bad display name "xen:2" in "add" command

New 'xen:2 (root)' desktop is xen:2

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/xen:2.log

 

四、常见问题

 

1)由于防火墙,导致外部无法连接远程桌面

出错信息:

vncviewer: ConnectToTcpAddr: connect: No route to host
Unable to connect to VNC server

解决方法:启动完毕后使用netstat -nat查看监听端口(默认为5901,5902,5903等),如果开启了防火墙,则需要配置规则允许对应端口tcp包通过。

iptables -I INPUT 1 -p tcp --dport 5901 -j ACCEPT(其中-I INPUT 1代表插入一条规则,这条规则的位置是1,详情请查阅iptables相关配置)

原来可以发现,iptables有以下的配置(使用命令iptables -L):

 

  1. <span style="font-size:14px;">target     prot opt source               destination      
  2. ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:5902   
  3. ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:5901   
  4. ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain   
  5. ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain   
  6. ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootps   
  7. ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:bootps   
  8. ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED   
  9. ACCEPT     icmp --  anywhere             anywhere      
  10. <strong>ACCEPT     all  --  anywhere             anywhere</strong>      
  11. ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh   
  12. REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited </span>  

其中domain端口提供的是域名解析服务;从这里可以看出,如果我们不添加前面两条规则,远程桌面就没法链接

 

 

2)字体问题导致无法启动vncserver

出错提示:WARNING: the first attempt to star Xvnc failed,possibly because the font catalog is not properly configured, attempting to determine an appropriate font path 

for this system and restart Xvnc using that font path ...

解决方法:

a.查看需要更新的字体:yum list updates | grep font

b.将上一步中需要更新的字体都安装

 

3)其他相关的包缺失

启动时候,出错提示:

/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: 
pixman_composite_trapezoids

解决方法:

yum install pixman pixman-devel libXfont -y

 

外部参考:

[1]http://stonebird.blog.51cto.com/1651861/942945

[2]http://www.cnblogs.com/zhangxiaodong/archive/2013/03/29/2989495.html

(责任编辑:IT)
------分隔线----------------------------