Ubuntu 15.10安裝VNC灰屏問題解決

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!

在Ubuntu 15.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 關閉這個連接號

CentOS 6.7下VNC安裝  http://www.linuxidc.com/Linux/2017-09/146884.htm

CentOS 7 安裝配置 VNC 詳解  http://www.linuxidc.com/Linux/2017-05/143324.htm

CentOS7.1安裝VNC,讓Win7遠程桌面Linux  http://www.linuxidc.com/Linux/2017-05/143346.htm

CentOS下VNC連接黑屏問題解決  http://www.linuxidc.com/Linux/2017-01/139995.htm 

Ubuntu下安裝配置VNC遠程工具  http://www.linuxidc.com/Linux/2017-03/141936.htm

更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2

本文永久更新鏈接地址http://www.linuxidc.com/Linux/2017-10/147524.htm

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