1、安装软件,用中软安装虚拟显示器软件
sudo apt-get install xserver-xorg-core-hwe-18.04
sudo apt-get install xserver-xorg-video-dummy
2、添加配置文件
进入 /usr/share/X11/xorg.conf.d/
文件夹下创建xorg.conf
文件
# 创建xorg.conf文件
touch xorg.conf
# 编辑xorg.conf文件
sudo nano xorg.conf
添加以下内容到xorg.conf文件中
Section "Device"
Identifier "Device0"
Driver "dummy"
VideoRam 256000
EndSection
Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Screen"
DefaultDepth 24
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
SubSection "Display"
Depth 24
Modes "1920x1080_60.00"
EndSubSection
EndSection
3、重启电脑后就可不接物理显示器也能正常远程
4、如果需要切换会使用物理显示器,需要卸载xserver-xorg-core-hwe-18.04
与xserver-xorg-video-dummy
包。
sudo apt-get --purge remove xserver-xorg-core-hwe-18.04
sudo apt-get --purge remove xserver-xorg-video-dummy
5、删除xorg.conf
文件
sudo rm /usr/share/X11/xorg.conf.d/xorg.conf