当前位置: 首页 > Linux

CentOS6安装配置VNC(转)

时间:2023-04-06 04:38:05 Linux

CentOS6安装配置VNCVNC是Linux上一款非常优秀的远程控制工具软件。通常,我们在Windows上安装vnc客户端软件来远程访问Linux机器(Windows上常用的客户端RealVNC)。远程连接Linux首先,确保Linux上已经安装了VNC服务器。下面以CentOS6为例进行说明:1.检查VNC服务器是否已经安装[root@centos6~]#rpm-qa|grepvnctigervnc-1.0.90-0.17.20110314svn4359.el6.i686gtk-vnc-0.3.10-3.el6.i686tigervnc-server-1.0.90-0.17.20110314svn4359.el6.i686gtk-vnc-python-0.3.10-3.el6.i686如果上面几个rpm包已经存在,说明VNC服务器已经安装,然后跳到第3步启动vncserver,否则跳到第22步安装VNC服务器#yuminstalltigervnc#yuminstalltigervnc-服务器3。启动vncserver第一次启动vncserver需要输入两次密码[root@centos6mnt]#vncserver你需要输入密码才能访问你的桌面。密码:Verify:New'oospace.com:1(root)'桌面是oospace。com:1Creatingdefaultstartupscript/root/.vnc/xstartupStartingapplicationsspecifiedin/root/.vnc/xstartupLogfileis/root/.vnc/oospace.com:1.log可以看到已经生成了一个桌面:oospace。com:1为了方便,添加vncserver到启动服务,使用setup->Systemservices,选择vncserver保存,然后在VNC客户端进入上面的桌面您可以连接到Linux桌面。如果发现无法连接,可能是以下两种原因造成的:(1)本地windows的hosts文件中没有配置远程linux的hostname。解决方法也很简单。只需要将桌面的hostname替换成IP地址或者在本地的windowshosts文件中添加相应的hostname-IP映射关系即可(2)被Linux防火墙拦截。这个时候我们可以选择关闭防火墙或者将VNC服务端口添加到Linux防火墙的信任列表中关闭防火墙#/sbin/serviceipstablesstop如何将VNC服务器添加到Linux防火墙信任列表中,请教参考Linux防火墙策略配置。为了系统安全,最好不要关闭防火墙,我们可以在/etc/sysconfig/iptablest的行人列表中配置vnc访问端口[root@centos6u2~]#vim/etc/sysconfig/iptables#然后在此文件中添加以下行-AINPUT-mstate--stateNEW-mtcp-ptcp--dport5900:5910-jACCEPT#restartiptables[root@centos6u2~]#serviceiptablesrestart