ubuntu安裝vnc,遠程鏈接時出現灰屏,配置文檔不對嗎
阿新 • • 發佈:2017-09-07
dma 但是 cows mach comment get 宋體 not in ger pasting
摘自:https://zhidao.baidu.com/question/1949169099296473348.html
1.在Ubuntu上首先需要安裝vnc4server
# apt-get install vnc4server
2.第一次執行vncserver的時候需要為客戶端連接設置8位的密碼
3.打開服務後,根據客戶端號連接。也可以指定客戶端號
$vncserver -geometry 1366x768 :1
// 其中-geometry 指定客戶端窗口的大小,:1 指的是客戶端連接號
// 客戶端在vnc viewer中輸入 192.168.0.253:1 來連接服務器
4.出現灰色屏幕和×型鼠標是因為vncserver找不到指定的圖形化軟件
在該網站處,其中有位網友指出:
There are a number of things which can cause the grey screen problem.
Your best bet is to look at the log file in .vnc to see what the error
is. The log file name is hostName:display#.log, for example, on my
machine, whose name is “golden”, it was golden:1.log.
In my case the ./vnc/xstartup file did not have the right permissions,
so chmod +x ./vnc/xstartup fixed the problem. I could have fiddled with
the contents of xstartup until the cows came home and it wouldn’t have
helped.
我們通過查看~/.vnc/xxx:1.log可以查看出現問題的原因。
說明一下,此處的日誌1.log表示客戶端號為1的連接日誌。
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
在Ubuntu15.10 下沒有看到相關的文件夾,可能是版本路徑的改變問題,我們通過find指令找到fonts其實是在/usr/share/fonts/下。
此處需我們創建指定目錄,然後用ln 軟連接將後者的路徑指過來,拼接成日誌中的路徑名。
配置完成後還會出現下面的幾個錯誤,但是並不會報錯了。
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
5.需要更改~/.vnc/xstartup文件
在安裝之前,我們先安裝如下軟件:
$sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
然後修改xstartup文件
#!/bin/sh
# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &
重啟VNCserver就ok了。
令註:
vncserver :1 開啟服務
vncserver -kill :1 關閉這個連接號
ubuntu安裝vnc,遠程鏈接時出現灰屏,配置文檔不對嗎