Ubuntu 安装 VNC
realvnc
前往
https://www.realvnc.com/en/connect/download/vnc/
下载并启动
VNC Server
并完成配置
x11vnc(备选方案)
安装
sudo apt-get install x11vnc
sudo x11vnc -storepasswd /etc/x11vnc.pass
设置密码
自启动
sudo vim /etc/systemd/system/x11vnc.service
输入
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
运行
sudo systemctl enable x11vnc
sudo service x11vnc start
sudo Xorg :1 -configure
sudo cp /root/xorg.conf.new /usr/share/X11/xorg.conf.d/xorg.conf
sudo apt install xserver-xorg-video-dummy
sudo vim /usr/share/X11/xorg.conf.d/xorg.conf
在最后添加
Section "Monitor"
Identifier "Monitor1"
HorizSync 1.0 - 2000.0
VertRefresh 1.0 - 200.0
# Add 16:9 modes, others are automatically detected.
Modeline "1280x720" 74.48 1280 1336 1472 1664 720 721 724 746
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
Section "Device"
Identifier "Card1"
Driver "dummy"
VideoRam 256000
EndSection
Section "Screen"
DefaultDepth 24
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
并将开头修改为
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
->
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection