Ubuntu 20.04 设置虚拟显示器用于远程桌面连接

Ubuntu 20.04 设置虚拟显示器用于远程桌面连接
Photo by Gabriel Heinzer / Unsplash

最近用Ubuntu做服务器,由于里面部署了虚拟机,必要时刻需要远程连接上去进行一些操作,于是就想配置远程桌面,远程桌面就用自带的就行了,但连上去之后有个问题,就是拔掉显示器就会无法连接,这种情况淘宝可以买一个显卡欺骗器插上去,另一种方案就是软件解决

配置方法

  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 文件,把下面内容复制进去

Section "Device"
    Identifier  "Configured Video Device"
    Driver      "dummy"
EndSection
Section "Monitor"
    Identifier  "Configured Monitor"
    HorizSync 31.5-48.5
    VertRefresh 50-70
EndSection
Section "Screen"
    Identifier  "Default Screen"
    Monitor     "Configured Monitor"
    Device      "Configured Video Device"
    DefaultDepth 24
    SubSection "Display"
    Depth 24
    Modes "1920x1080"
    EndSubSection
EndSection

3. 重启电脑,默认会进入虚拟显示器,进入系统后真实显示器里会空白,这点要注意

到此结束!