No se puede ejecutar el servidor X en un servidor VPS remoto usando xvfb

No se puede ejecutar el servidor X en un servidor VPS remoto usando xvfb

Mi aplicación usa la biblioteca.https://github.com/wkhtmltopdf/wkhtmltopdfque requiere servidor X. Aquí hay una solución alternativa:

echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh
chmod a+x /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com output.pdf

Instalé xvfb a través de pacman y seguí los pasos del enlace. Sin embargo, nada ha cambiado: todavía devuelve un error.

  wkhtmltopdf http://www.google.com output.pdf

===>

 "qt.qpa.screen: QXcbConnection: Could not connect to display :0.0"

Y

$ which wkhtmltopdf
/usr/local/bin/wkhtmltopdf

Respuesta1

Debería intentar ejecutar wkhtmltopdf.sh en lugar de solo wkhtmltopdf. Parece que está llamando al binario original en lugar del contenedor xvfb que creó.

Para asegurarse de cuál está ejecutando, intente ejecutar "cuál wkhtmltopdf".

información relacionada