CentOS 6安装和配置VNCpython
VNC是Linux上的一款很是优秀的远程控制工具软件,一般咱们在Windows上面安装vnc客户端软件来远程访问Linux机器(Windows上经常使用的客户端RealVNC),要远程链接到Linux首先要确保Linux上面已经安装了VNC server,下面以CentOS 6为例来讲明:vim
1. 检查是否已经安装了VNC serverwindows
[root@centos6 ~]# rpm -qa | grep vnc tigervnc-1.0.90-0.17.20110314svn4359.el6.i686 gtk-vnc-0.3.10-3.el6.i686 tigervnc-server-1.0.90-0.17.20110314svn4359.el6.i686 gtk-vnc-python-0.3.10-3.el6.i686
若是上面的几个rpm包已经存在,说明VNC server已经安装好了,接下来跳转步骤3启动vncserver就能够了,不然执行步骤2centos
2. 安装VNC server安全
# yum install tigervnc # yum install tigervnc-server
3. 启动vncserverapp
第一次启动vncserver须要输入密码两次tcp
[root@centos6 mnt]# vncserver You will require a password to access your desktops. Password: Verify: New 'oospace.com:1 (root)' desktop is oospace.com:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/oospace.com:1.log
能够看到已经生成了一个desktop:oospace.com:1svn
为了方便,可见将vncserver添加到开机启动的服务中,使用setup->System services, 选择vncserver保存便可工具
接下来在VNC客户端输入上面的desktop就能够链接上Linux的desktop,若是发现链接不上,有多是下面两个缘由致使的:ui
(1) 本地windows的hosts文件中没有配置远程Linux的hostname,解决方案也很简单,只须要将desktop的hostname替换为IP地址或者在本地windows的hosts文件中添加相应的hostname与IP的映射关系便可
(2) 是因为Linux的防火墙阻止了,这时咱们能够选择关闭防火墙或者将VNC的服务端口加入到Linux防火墙的信任列表
关闭防火墙
# /sbin/service ipstables stop
如何将VNC server添加到Linux的防火墙信任列表,能够参见Linux防火墙策略配置。
为了系统的安全性考虑,最好不要关闭防火墙,咱们能够把vnc的访问端口配置在/etc/sysconfig/iptablest的行人列表中
[root@centos6u2 ~]# vim /etc/sysconfig/iptables # then add below line to this file -A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5910 -j ACCEPT # restart iptables [root@centos6u2 ~]# service iptables restart