需求
- ubuntu主机开启远程桌面功能, 实现无显示器的情况下的远程访问。
主机环境
roger@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
roger@ubuntu:~$
虚拟显示器
- 安装虚拟显示器依赖的驱动
sudo apt-get install xserver-xorg-video-dummy
- 新增配置文件, 内容如下:
roger@ubuntu:~$ cat /etc/X11/xorg.conf
Section "Device"Identifier "Configured Video Device"Driver "dummy"
EndSectionSection "Monitor"Identifier "Configured Monitor"HorizSync 31.5-48.5VertRefresh 50-70
EndSectionSection "Screen"Identifier "Default Screen"Monitor "Configured Monitor"Device "Configured Video Device"DefaultDepth 24SubSection "Display"Depth 24Modes "1920x1080"EndSubSection
EndSectionroger@ubuntu:~$
开启远程桌面功能
重启主机生效
sudo reboot
其他
当前最大支持分辨率为 1360x768,因此即使设置了 1920x1080 也还是 1360x768,如下:
roger@ubuntu:~$ xrandr -q -display :0
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 240, current 1360 x 768, maximum 1360 x 768
default connected primary 1360x768+0+0 0mm x 0mm1360x768 60.00* 1280x720 60.00 1024x768 60.00 1024x576 60.00 960x540 60.00 800x600 60.00 56.00 640x480 60.00 684x384 60.00 680x384 60.00 640x360 60.00 512x384 60.00 512x288 60.00 480x270 60.00 400x300 60.00 56.00 320x240 60.00
roger@ubuntu:~$
参考
1, Ubuntu18.04 最简单远程桌面 https://blog.csdn.net/langyou0/article/details/107959002
2, https://askubuntu.com/questions/453109/add-fake-display-when-no-monitor-is-plugged-in