天天看點

Centos 5.6_x64 安裝VNC

1、檢查是否安裝VNC

[root@jw-back ~]# rpm -qa |grep vnc

vnc-4.1.2-14.el5_6.6

gtk-vnc-0.3.8-3.el5

gtk-vnc-python-0.3.8-3.el5

vnc-server-4.1.2-14.el5_6.6

2、沒有安裝繼續安裝

[root@jw-back ~]# yum -y install vnc* 

3、VNC啟動/停止/重新開機

[root@jw-back ~]# service vncserver start/stop/restart

    關閉具體的vncserver指令:vncserver -kill :1 vncserver -kill :2

4、設定VNC密碼

 [root@jw-back ~]# vncserver :1

You will require a password to access your desktops. 

Password:              //設定密碼

Verify:                   //确認密碼

xauth:  creating new authority file /root/.Xauthority 

New 'testdb:1 (root)' desktop is testdb:1  

Creating default startup script. /root/.vnc/xstartup 

Starting applications specified in /root/.vnc/xstartup 

Log file is /root/.vnc/testdb:1.log 

 5、VNC服務使用的端口号與桌面号的關系

     VNC服務使用的端口号與桌面号相關,VNC使用TCP端口從5900開始,對應着關系如下:

      桌面号為“1” --------------- 端口号為“5901”

      桌面号為“2” --------------- 端口号為“5902”

      ......以此類推

       基于Java的VNC客戶程式Web服務TCP端口從5800開始,也是與桌面号相關,對應關系如下

       桌面号為“1” --------------- 端口号為“5801”

       桌面号為“2” --------------- 端口号為“5802”

6、如果linux開啟防火牆的功能,需要手工開啟想用的端口;

 [root@jw-back ~]#  iptables -I INPUT -p tcp --dport 5901 -j ACCEPT 

 [root@jw-back ~]#  iptables -I INPUT -p tcp --dport 5801 -j ACCEPT

7、用VNC用戶端連接配接

提示輸入密碼就成功啦!~~

8、報錯

假如連接配接失敗,檢查一下防火牆是否關閉,或者是端口問題。

本文轉自 kuangling 51CTO部落格,原文連結:http://blog.51cto.com/kling/1181565