遠程桌面環境在很多情況下可以帶來好處,對於一般的公司來說,開發人員一般都會有一臺辦公機同時有一臺開發機,有時,開發機和辦公機不在同一個地方,如果需要同時操作兩臺機器,那麼在不同的地點之間來回走動必然帶來很多的不便。可以使用telnet或ssh等字符登陸界面,這對於熟悉shell命令的開發者來說是比較省事的方法,最好的方法是使用遠程桌面環境。
下面的過程啓動VNC服務器端的vncserver服務:
1. 使用vncpasswd命令設置一個vnc server密碼。如果不設置密碼,vncserver將無法啓動。
2. 編輯/etc/sysconfig/vncservers配置文件。下面的文件爲一個實例:
# The VNCSERVERS variable is a list of display:user pairs. # # Uncomment the line below to start a VNC server on display :1 # 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/vnc/sshvnc.html>. VNCSERVERS="1:fred 2:joe" # fred's VNC options VNCSERVERARGS[1]="-geometry 1024x768" # joe's VNC options VNCSERVERARGS[2]="-geometry 1280x1024" |
其中VNCSERVERS變量表示提供幾個桌面和每個桌面的用戶名。VNCSERVERARGS是啓動vncserver時的參數,一般只要設置分辨率就足夠了。
3. 使用chkconfig vncserver on命令使系統開機時啓動vncserver。
4. 使用service vncserver start命令立即啓動vncserver。
5. VNC的默認桌面是一個非常簡單的環境,即twm窗口管理器。如果要使VNC看起來和本地登陸界面差不多,可以編輯~/.vnc/xstartup文件,並將文件中
Uncomment the following two lines for normal desktop
後面的兩行取消註解。
在客戶端需要使用vncview軟件來連接到vncserver上,可以到http://www.tightvnc.com/download.html#stable上下載tightvnc的window客戶端軟件。啓動vncviewer之後,在VNC server提示處輸入
10.239.56.94:1
其中,前者爲vncserver的IP地址,後者是需要登陸的VNC桌面。在輸入密碼後,VNC遠程桌面環境就出現了。快捷鍵Ctl Alt Shift F可以進行全屏和非全屏的切換。