Pages

Thursday, November 17, 2011

[SUSE] VNC server

VNC 就是跨平台的遠端桌面,可以在Windows跟非Windows的系統中連遠端桌面,通常是在需要用圖形介面連Linux伺服器時用的,平常都是用SSH比較多

---------------------------------以下是複製貼上的-----------------------------------------------------------------------

步驟1.啟動 VNC Service

輸入指令 vncserver 來啟動 VNC Service 產生 VNC 設定檔,執行 vncserver 指令後會請您輸入屆時登入 VNC 的密碼,若未指令 VNC Service 時的 Port 則預設為 Port 5901

 #vncserver                                                   //輸入指令啟動 VNC Service
 You will require a password to access your desktops.
 Password:                                                    //設定 VNC Password
 Verify:                                                      //確認 VNC Password
 Would you like to enter a view-only password (y/n)? n        //是否要設定 View Only 的 VNC Password
 New 'X' desktop is weithenn:1                                //VNC Listen Port 為 5901
 Creating default startup script /root/.vnc/xstartup          //產生的 VNC 設定檔路徑
 Starting applications specified in /root/.vnc/xstartup
 Log file is /root/.vnc/weithenn:1.log

步驟2.修改 vncserver 設定檔

修改 VNC 設定檔內容使屆時登入 OpenSuse 時桌面環境為 Gnome.

 #vi ~/.vnc/xstartup                                          //設定 VNC 設定檔
 #!/bin/sh
 xrdb $HOME/.Xresources
 xsetroot -solid grey
 xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
 #twm &                                                       //註解此行 (預設值)
 gnome-session &                                              //新增此行,採用 Gnome 桌面環境

修改完畢後將 VNC Service 停止以便等一下重新載入 VNC 設定檔內容

 #vncserver -kill :1                                          //刪除剛才 Listen Port 5901 的 VNC Service
 Killing Xvnc process ID 15878

步驟3.啟動 VNC Service

下列指令為將 VNC Service 啟動且 Listen Port 6000 (5900 + :100 => 6000)

 #vncserver :100
 New 'X' desktop is weithenn:100
 Starting applications specified in /root/.vnc/xstartup
 Log file is /root/.vnc/weithenn:100.log

啟動成功後確認系統是否有 Listen Port 6000

 #netstat -tnl |grep '6000'
 tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN

確認系統是否有 VNC Service 的 Process

 #ps aux |grep vnc
 root     15952  0.2  0.3  86264 24564 pts/2    S    09:32   0:00 Xvnc :100 -desktop X -httpd /usr/share/vnc/classes -auth /root/.Xauthority...








*************************************
1.這種的是只能開啟自己的遠端登入,其他的帳號要他登入自己開啟

2. 如果出現'cannot acquire name on session bus'的錯誤訊息的話,其實是因為你這個帳號已經有遠端登入gnome(一種圖形介面的模式)了,同一個帳號不能同時用兩個gnome
如果當初開啟vncserver是在圖形介面下,那當然就已經占用了gnome了

所以解決方法就是: 用SSH(文字介面)下開啟vncserver,再用vnc軟體遠端連上去

3.  中文版yast的  '遠端管理(VNC)'  是xorg-x11-vnc,在防火牆允許規則中翻作 'VNC伺服器',只開 5901,另一個是只有 'VNC'三個字,port是 5800-5900 全開

原文出處
http://www.weithenn.org/cgi-bin/wiki.pl?OpenSuse-VNC_Server%E9%81%A0%E7%AB%AF%E9%80%A3%E7%B7%9A%E4%BC%BA%E6%9C%8D%E5%99%A8

其餘參考文章
http://opensuse.swerdna.org/susefirewall.html

(大陸網頁)
http://www.sparelife.net/?p=82

No comments:

Post a Comment