Ubuntu Desktop(一般桌面版) 安裝VNC

閱讀時間約 3 分鐘
sudo apt-get update
sudo apt-get upgrade
sudo apt install lightdm
sudo dpkg-reconfigure lightdm(option選項,如需要切換可以依據需求執行,參考畫面如下)
raw-image


安裝 x11VNC

sudo apt-get install x11vnc


設定連接的VNC密碼

sudo x11vnc -storepasswd /etc/x11vnc.pass
sudo chmod 755 /etc/x11vnc.pass (option,依據授權需求不一定需要執行)


指定待令Port(5900常見, 可以依據需求來進行設定)

sudo x11vnc -auth guess -rfbauth /etc/x11vnc.pass -rfbport 5900 -forever -display :0
參數說明:
rfbport 參數port
forever 參數指定前一次服務斷開後不停止服務,監聽下一個連接需求(這個參數很重要,如果你每次連線後遇到無法連入,就是需要做這個設定喔)

設定開機自動執行

sudo nano /etc/systemd/system/x11vnc.service

內容:
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target

解析設定

cd /etc/X11
sudo nano xorg.conf

內容:
## VNC-virsual montior
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 1920 1080
EndSubSection
EndSection

啟動服務

sudo systemctl daemon-reload
sudo systemctl enable x11vnc
sudo systemctl start x11vnc












    1會員
    63內容數
    記錄生活與技術的小細節
    留言0
    查看全部
    發表第一個留言支持創作者!