centos 6.3 vnc连接—— catalog is not properly configured, attempting to determine an appropriate font p

摘要: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 配置 



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

 vi /root/.vnc/xstartup



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

所以要修改  /etc/sysconfig/vncservers 文件添加以下内容
VNCSERVERS="2:root"
# 桌面号:用户    监听 590* 端口
VNCSERVERARGS[2]="-geometry 800x600"

这样修改后,就算 /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)由于防火墙,导致外部无法连接远程桌面

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

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

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.将上一步中需要更新的字体都安装


外部参考:

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

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

原文地址:https://www.cnblogs.com/pangblog/p/3299667.html