關於在Linux系統中配置VNC Server的方法,網上有很多的教程或者文章,但應用在我們的環境中時都不能完整解決我們的問題,所以這裡我將在RedHat 6.0中配置VNC Server中的方法,以及可能遇到問題的解決辦法總結在這裡,供大家參考。
相關閱讀:
VNC的安裝配置 http://www.linuxidc.com/Linux/2013-05/84941.htm
CentOS 6.3安裝和配置VNC http://www.linuxidc.com/Linux/2013-05/84668.htm
Linux下強制不檢測依賴安裝VNC http://www.linuxidc.com/Linux/2013-05/84075.htm
CentOS6 VNC服務安裝配置 http://www.linuxidc.com/Linux/2013-04/82510.htm
VNC遠程控制安裝和設置 http://www.linuxidc.com/Linux/2013-01/77769.htm
Windows遠程桌面訪問Ubuntu 12.04 之安裝VNC http://www.linuxidc.com/Linux/2012-07/64801.htm
1、 查詢系統是否安裝vnc-server
[root@localhost ~]# rpm –qa | grep vnc
如果有返回值,類似於vnc-server-的值,說明已經安裝了vnc-server
2、 安裝vnc-server
網上大都搜到的方法是輸入
[root@localhost ~]# yum install tigervnc-server
但是在我們的環境中執行時卻提示:No package tigervnc-server available.
所以只能采用另一種辦法,就是先執行
[root@localhost ~]# yum search vnc
在返回結果中找到可用的包,再相應執行對應的包即可。
[root@localhost ~]# yum install vnc-server
3、 配置vnc-server的配置文件
輸入
[root@localhost ~]# vi /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
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# 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 -nohttpd -localhost"
按照注釋的說明就可以知道該如何配置了。
在文件最後加上
VNCSERVERS="1:root"
這樣即完成了root用戶的配置,VNCSERVERARGS參數這一行可以不進行設置。
這裡有兩點要注意:
1)VNCSERVERS=後面可以支持多用戶,以空格隔開。如:
VNCSERVERS="1:myusername 15:otheruser"--->這裡的1 和15是端口號,用於連接時的端口
2)VNCSERVERARGS後面的[]裡面的數據要與VNCSERVERS後面對應用戶的值要一致。
VNCSERVERARGS基本參數有:
-geometry 桌面大小,缺省是1024x768
-nohttpd 不監聽HTTP端口
-nolisten tcp 不監聽X端口
-localhost 只允許從本機訪問
-AlwaysShared 默認的, 同時只能有一個vncviewer連接(跟客戶端配置也有關), 一旦第2個連上去, 第1個就被斷開了. 此參數允許同時連多個vncviewer
-SecurityTypes None登錄不需要密碼認證 VncAuth默認值,要密碼認證