歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux桌面 >> VNCViewerWindows下遠程連接Linux桌面

VNCViewerWindows下遠程連接Linux桌面

日期:2017/3/3 12:18:15   编辑:Linux桌面
一:服務器端(Centos6.5)
1:安裝桌面:
# yum groupinstall "GNOME Desktop Environment"(CentOS 5.x安裝GNOME桌面環境)
# yum groupinstall "X Window System""Desktop"(CentOS 6.x安裝GNOME桌面環境)
2:安裝vncserver
(1) 檢查是否已經安裝了VNCServer
[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

<span >如果上面的幾個rpm包已經存在,說明VNC server已經安裝好了,接下來跳轉步驟(3)啟動vncserver就可以了,否則執行步驟(2)</span>

(2) 安裝vncServer
# 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

注意:
# /etc/init.d/vncserver restart
注:有時候上面的命令啟動會報錯,直接運行就可以:
# vncserver
注:關閉具體的vncserver命令:vncserver -kill :1vncserver -kill :2
(4) 設置遠程登陸到gnome桌面的配置:
# vim /etc/sysconfig/vncservers(SUSE企業版不用配置此文件)
再最後面加入如下兩行:
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -alwaysshared-depth 24"
注意:如果windows連接的時候出現黑屏(在ip地址和端口沒有輸出錯誤的情況下),可將這裡的分辨率改為800x600.
(5)防火牆的設置
不設置防火牆連接的時候有可能會被阻止,這是可以選擇關閉防火牆或者將VNC的服務器端口號加入到防火牆的信任列表中:
關閉防火牆:service iptables stop
或者:將VNC server添加到linux的防火牆信任列表中
[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

防火牆的其它操作可見:http://blog.csdn.net/jemlee2002/article/details/7042991
二:客戶端(windows)
接下來可以在網上下載http://vnc-pe.softonic.cn/vncviewer進行安裝。打開輸入ip地址和端口號。這裡的端口號我也沒有弄清楚,我這裡輸入的是1,你可以試試2 或者5901或者5902,具體我沒有研究,有明白的也可以告訴我。

參考文獻:1:http://www.cnblogs.com/wise-man/archive/2012/07/23/2604023.htmlCentOS 6安裝和配置VNC
2:http://www.ha97.com/4634.html#comment-322709 CentOS Linux下VNC Server遠程桌面配置詳解
3:http://blog.sina.com.cn/s/blog_6e0c0fdf010198pl.html TightVNC Windows下遠程連接Linux桌面
Copyright © Linux教程網 All Rights Reserved