红联Linux门户
Linux帮助

如何在CentOS 5.2中安装vnc

发布时间:2008-10-10 01:02:20来源:红联作者:rotvnx
作者:李书鹏

本文介绍VNC 4.1.2在CentOS5.2中的安装过程。将从RealVNC官方下载的vnc-4_1_2-x86_linux.tar.gz

将其放到任意目录,如/home/xxx下。

1.解压。
执行命令
#tar -zxvf vnc-4_1_2-x86_linux.tar.gz

2.安装vnc。
依次执行命令:
#cd vnc-4_1_2-x86_linux
#./vncinstall /usr/local/bin /usr/local/man

3.创建/usr/share/X11在/usr/X11R6/lib目录的连接(*注1)。
mkdir /usr/X11R6/lib
cd /usr/X11R6/lib
ln -s /usr/share/X11 X11

4.安装完成,运行vncserver
执行命令
#vncserver

之后按提示输入连接vncserver需要的密码

最后尝试使用vnc客户端连接,注意端口应为5901。至此,安装已经完成。

*注1:vncserver默认寻找的X系统的字体路径在/usr/X11R6/lib/X11/fonts/下,但CentOS5.2却在/usr /share/X11/fonts/下。因此才需要第3步的操作,建立连接,以便vncserver找到字体。否则vncserver将不能正常运行,并在log文件中记录以下内容:

Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'

Xvnc Free Edition 4.1.2 - built May 12 2006 17:42:24
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40201000, The XFree86 Project, Inc

Wed Sep 24 21:09:19 2008
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5901
vncext: Listening for HTTP connections on port 5801
vncext: created VNC server for screen 0
error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!

Fatal server error:
could not open default font 'fixed'
xsetroot: unable to open display 'localhost.localdomain:1'
vncconfig: unable to open display "localhost.localdomain:1"
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm Xt error: Can't open display: %s
文章评论

共有 2 条评论

  1. wang3442562 于 2009-08-28 23:46:08发表:

    拜读了,看OK不楼主

  2. lippe 于 2008-10-10 10:16:17发表:

    很好,顶一下
    呵呵