歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 6安裝和配置VNC

CentOS 6安裝和配置VNC

日期:2017/2/28 15:44:46   编辑:Linux教程

VNC是Linux上的一款非常優秀的遠程控制工具軟件,通常我們在Windows上面安裝vnc客戶端軟件來遠程訪問Linux機器(Windows上常用的客戶端RealVNC),要遠程連接到Linux首先要確保Linux上面已經安裝了VNC server,下面以CentOS 6為例來說明:

1. 檢查是否已經安裝了VNC server

[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就可以了,否則執行步驟2

2. 安裝VNC server

# yum install tigervnc
# yum install tigervnc-server

3. 啟動vncserver

第一次啟動vncserver需要輸入密碼兩次

[root@centos6 mnt]# vncserver

You will require a password to access your desktops.

Password:
Verify:

New 'centos6.xman.org:1 (root)' desktop is centos6.xman.org:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/centos6.xman.org:1.log

可以看到已經生成了一個desktop:centos6.xman.org:1

接下來在VNC客戶端輸入上面的desktop就可以連接上Linux的desktop,如果發現連接不上,有可能是下面兩個原因導致的:

(1) 本地windows的hosts文件中沒有配置遠程Linux的hostname,解決方案也很簡單,只需要將desktop的hostname替換為IP地址或者在本地windows的hosts文件中添加相應的hostname與IP的映射關系即可

(2) 是由於Linux的防火牆阻止了,這時我們可以選擇關閉防火牆或者將VNC的服務端口加入到Linux防火牆的信任列表

#關閉防火牆
# /sbin/service ipstables stop

如何將VNC server添加到Linux的防火牆信任列表,可以參見Linux防火牆策略配置。

Copyright © Linux教程網 All Rights Reserved