在centos5下安裝配置VNC

來源:互聯網
上載者:User
在centos5下安裝配置VNC

          今天在公司安裝了一下vnc,晚上沒事,就記錄一下吧,要不下次安裝就又得google了^_^

VNC簡介

         不能免俗,簡單說介紹下VNC吧。

        VNC,全稱為Virtual Network Computing,是一個桌面共用系統。它的功能,類似於windows中的遠端桌面功能。VNC使用了RFB(Remote FrameBuffer,遠程幀緩衝)協議來實現遠端控制另外一台電腦。它把鍵盤、滑鼠動作發送到遠端電腦,並把遠端電腦的螢幕發回到本地。
  VNC技術與平台無關,VNC Viewer可以和VNC Server在不同的作業系統上。VNC幾乎支援所有的作業系統,也支援Java,甚至可以通過支援Java的瀏覽器來訪問VNC Server。多個VNC用戶端可以同時串連到一個VNC Server上。

在centos5下安裝配置VNC

1.檢查VNC用戶端和伺服器端是否已經安裝

執行如下命令:

rpm -q vnc vnc-server

如果返回類似如下資訊,

package vnc is not installed
vnc-server-4.0-8.1

 

則說明系統已經預設安裝了vnc伺服器端(一般來說,系統都預設安裝了vnc server)。

2. 將使用者名稱加入到設定檔中

使用如下命令編輯設定檔,添加帳戶資訊:

vi /etc/sysconfig/vncservers 

做如下修改(紅色部分為添加的部分):

#
# 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:myusername"

# VNCSERVERS="1:gavin 2:john" # use the method for more user
VNCSERVERS="2:root"

# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768"

3.設定 root使用者的密碼

使用如下命令設定密碼:

 vncpasswd

當提示Verify時,再次輸入密碼確認。

4.啟動VNC服務

使用如下命令啟動VNC SERVER

sbin/service vncserver start

當顯示如下資訊時,表示啟動成功:

Starting VNC server: 2:root                [   OK   ]

5.修改VNC SERVER的視窗管理器

vnc server預設使用的視窗管理器是twn,這是一個非常簡單的視窗管理器,我們可以改成常用的GNOME或者KDE。

先使用如下命令進入使用者的home目錄:

cd ~/.vnc

編輯啟動項:

vi xstartup 

按照如下方式修改啟動項:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &     #以GNOME作為VNC的視窗管理器
#startkde &                 #kde desktop
#twm &                        #注掉系統預設的視窗管理器

6.重啟VNC SERVER

/sbin/service vncserver restart

當系統提示如下資訊時,表示重啟成功:

Shutting down VNC server: 2:root                           [   OK   ]
Starting VNC server: 2:root                [   OK   ] 

windows登入到VNC SERVER

1.從IE登入

直接從IE瀏覽器中輸入如下地址:

http://xxx.xxx.xxx.xxx:5802

輸入密碼即可使用。

2.從VNC view登入

在windows上安裝vnc view,然後輸入xxx.xxx.xxx.xxx:2,串連登入,輸入密碼即可。

備忘:如果從vnc view登入時,提示connection refused(10061),則是因為linux防火牆的問題,登入centos系統,選擇System-->Preferences-->Remote Desktop,勾選sharing中的兩項,Security兩項不勾,點擊關閉,然後再重新用vnc view登入即可。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.