Unable to open X display when trying to run google-chrome on Centos (Rhel 7.5)

后端 未结 3 1420
广开言路
广开言路 2021-02-08 13:50

I need to run Google Chrome remotely on a virtual machine using SSH. I do not want xforwarding - I want to utilize the GPU available on the vm. When I try running google-

3条回答
  •  攒了一身酷
    2021-02-08 14:25

    You can try with Xvfb. it does not require additional hardware.

    Install Xvfb if you didn't install yet and do the following steps.

    sudo apt-get install -y xvfb

    Dependencies to make "headless" chrome/selenium work:

    sudo apt-get -y install xorg xvfb gtk2-engines-pixbuf

    sudo apt-get -y install dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable

    Optional but nifty: For capturing screenshots of Xvfb display:

    sudo apt-get -y install imagemagick x11-apps

    Make sure that Xvfb starts every time the box/vm is booted:

    Xvfb -ac :99 -screen 0 1280x1024x16 & export DISPLAY=:99

    Now execute google-chrome

提交回复
热议问题