您的位置:首页 > 其它

安装和配置VNC

2014-02-07 12:25 232 查看


1 安装vnc# yum install -y tigervnc-server tigervnc-server-module libXfont pixman xterm xorg-x11-twm 安装vnc及字体库# chkconfig vncserver on 设置开机自动启动2 VNC配置修改 /etc/sysconfig/vncservers 文件,添加以下内容# The VNCSERVERS variable is a list of display:user pairs.## Uncomment the lines below to start a VNC server on display :2# as my 'myusername' (adjust this to your own). You will also# need to set a VNC password; run 'man vncpasswd' to see how# to do that.## DO NOT RUN THIS SERVICE if your local area network is# untrusted! For a secure way of using VNC, see this URL:# http://kbase.redhat.com/faq/docs/DOC-7028# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.# Use "-localhost" to prevent remote VNC clients connecting except when# doing so through a secure tunnel. See the "-via" option in the# `man vncviewer' manual page.# VNCSERVERS="2:myusername"# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"VNCSERVERS="1:root"VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -depth 24"# -alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32 #红色为新增内容3 设置VNC密码# vncpasswd Password: Verify: 连续两次输入同样的密码设置的密码保存在 /root/.vnc/passwd 4 修改防火墙配置,修改/etc/sysconfig/iptables # vi /etc/sysconfig/iptables #编辑,添加以下代码,开启5901、5902端口 -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT:wq! 保存,退出 service iptables restart # 重启5 使用VNC连接CentOS主机 直接打开VNC,输入IP地址,冒号后面的1代表桌面号,这个要根据你的配置文件定义的桌面号

如果你是Root用户登陆,会有下面的警告提示

然后输入密码,就可登陆了



6 FAQ6.1 VNC服务使用的端口号与桌面号的关系 VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下 桌面号为“1” —- 端口号为5901 桌面号为“2” —- 端口号为5902 桌面号为“3” —- 端口号为5903 基于Java的VNC客户程序Web服务TCP端口从5800开始,也是与桌面号相关,对应关系如下 桌面号为“1” —- 端口号为5801 桌面号为“2” —- 端口号为5802 桌面号为“3” —- 端口号为58036.2 error1: VNC Fatal server error: could not open default font ‘fixed’ Thu Jul 18 00:00:36 2013 vncext: VNC extension running! vncext: Listening for VNC connections on all interface(s), port 5901 vncext: created VNC server for screen 0[dix] Could not init font path element /usr/share/X11/fonts/misc, removing from list![dix] Could not init font path element /usr/share/X11/fonts/100dpi, removing from list![dix] Could not init font path element /usr/share/X11/fonts/Type1, removing from list![dix] Could not init font path element /usr/share/fonts/default/Type1, removing from list![dix] Could not init font path element built-ins, removing from list!Fatal server error:could not open default font 'fixed'解决办法:yum -y install fontforge yum update libXfont 6.3 http://www.realvnc.com/download/binary/1293/ VNC下载地址6.4 VNC的启动/停止/重启# service vncserver start/stop/restart关闭具体的vncserver命令:vncserver -kill:1 vncserver -kill:26.5 vncserver 不能重启# service vncserver restart Shutting down VNC server: [ OK ]Starting VNC server: 1:root Warning: hfracts01:1 is taken because of /tmp/.X1-lockRemove this file if there is no X server hfracts01:1A VNC server is already running as :1解决办法:# rm -rf /tmp/.X1-lock# rm -rf /tmp/.X11-unix/

如果要杀掉 vncserver 进程,可执行 vncserver :1 kill ,1表示 display 的 ID 号
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  安装和配置VNC