Ubuntu Server 安裝 x11vnc Server 並設定開機自動啟動 for Raspberry Pi - MIS 腳印
MIS 腳印 logo

MIS 腳印

記錄 IT 學習的軌跡

Ubuntu Server 安裝 x11vnc Server 並設定開機自動啟動 for Raspberry Pi

Raspberry Pi 4 使用 Ubuntu Server 透過 x11vnc Server 軟體並設定開機自動啟用,即可讓遠端電腦使用 VNC 連結。

Raspberry Pi

安裝和設定

安裝 x11vnc server:

sudo apt-get install x11vnc

建立密碼:

x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /home/ubuntu/.vnc/passwd?  [y]/n y
Password written to: /home/ubuntu/.vnc/passwd

啟用 x11vnc Server:

x11vnc -forever -usepw -display :0
13/04/2020 15:13:47 -usepw: found /home/ubuntu/.vnc/passwd
13/04/2020 15:13:47 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 2762
13/04/2020 15:13:47 Using X display :0
13/04/2020 15:13:47 rootwin: 0x299 reswin: 0x2400001 dpy: 0xe777b230

# ... 中間省略 ...

The VNC desktop is:      ubuntu:0
PORT=5900

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

# 當有連結時會顯示哪個 IP
13/04/2020 15:13:53 Got connection from client 192.168.0.25

連結

這裡使用 Google Chrome 擴充功能的應用程式 VNC® Viewer for Google Chrome™ 連結 x11vnc Server:

《address》輸入 x11vnc Server 的 IP:5900 (預設 port 5900 可省略):

點擊《connect》連結。

輸入《Password》密碼點擊《OK》:

成功連結:

設定開機自動啟用

新增用來放置自動啟用檔案的目錄:

mkdir ~/.config/autostart

將開機自動啟用 x11vnc Server 的設定新增至檔案並儲存:

vim ~/.config/autostart/x11vnc.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -display :0
StartupNotify=false
Terminal=false
Hidden=false

重新開機即可使用 VNC® Viewer for Google Chrome™ 連結 x11vnc Server:

sudo reboot

發表迴響