ubuntu 配置 vnc server(轉)

原文地址:http://hi.baidu.com/wuxicn/item/5cfbfacb61f4dc0fad092f98

 通過將服務器配置成VNC SERVER,可以讓其他主機使用圖形方式登錄這臺服務器。
在ubuntu下配置vnc server很簡單,方法如下:

服務器端:
1、先安裝VNC服務程序:
    $ sudo apt-get install vnc4-common vnc4server

2、給當前用戶設置vnc登錄密碼:
    $ vncpasswd

3、修改vnc的默認設置,使啓動時運行gnome作爲X的桌面(如果不設置,vnc將使用twm,你可以試試,相信你會很不習慣的):
    $ vncserver :1
    $ vncserver -kill :1
注意:裏面的":1"代表display號,客戶登錄的時候得寫相同的display號才能登錄(見後面客戶端部分)。
修改~/.vnc/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" &
# twm &
gnome-session &
    
上面修改的意思是將默認啓動的twm程序改爲gnome,如果想用KDE作爲桌面的,可以改爲:startkde &

然後再次啓動VNC SERVER:
    $ vncserver :1

客戶端:
1、安裝VNC客戶程序:
    $ sudo apt-get install vnc4-common xvnc4viewer

2、然後你就通過Terminal Server Client登錄了:Applications -> Internet -> Terminal Server Client;Computer爲:服務器IP:display#,例如:12.34.56.78:1;protocol選擇:VNC。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章