x11vnc是連接到真實的X會話,相比vnc4server和tightvncserver自己創建不同分辨率的xserver來說,畫面延時和顯示效果應該要好一些。兩種服務都試過,個人感覺x11vnc要好。
1. 安裝x11vnc
sudo apt-get install x11vnc
2. 創建vnc連接密碼
sudo x11vnc -storepasswd <password> /etc/x11vnc.pass
3. 配置x11vnc開機啟動
創建文件/etc/init/x11vnc.conf,並添加如下代碼
start on login-session-start script x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -shared -noxdamage -xrandr "resize" -rfbport 5900 end script
其中,/var/run/lightdm要根據實際的桌面管理器修改,gdm或者kdm。
4. 配置虛擬分辨率
服務器如果沒有外接外接顯示器,x-session不能從外部獲取分辨率,需要在xorg.conf中設置虛擬分辨率。
參考:http://askubuntu.com/questions/100604/set-desktop-resolution-for-standard-11-10-vnc-server
ubuntu默認已經沒有/etc/X11/xorg.conf,也沒有必要用Xorg -configure創建,直接手動創建就行,並添加如下代碼(客戶端顯示屏分辨率是1680x1050,可以根據實際情況修改Virtual參數)
Section "Device" Identifier "Configured Video Device" EndSection Section "Monitor" Identifier "Configured Monitor" EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" SubSection "Display" Depth 24 Virtual 1680 1050 EndSubSection EndSection
*[吐槽] 那些要安裝xserver-xorg-video-dummy,再用gft或cvt獲取Modeline的方法都是不管用滴!
