I installed libreoffice.x86_64 using yum from the CentOS repository on my CentOS basic server. When running the following command from the shell, I get the following X11 error. xhost is installed on my box but X does not appear to be. What causes this error and how do I fix it?
[root@desktop ~]# HOME=/tmp/ayb; /usr/bin/libreoffice --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_12.xlsx/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)[root@desktop ~]#
EDIT
Per comments, I did the following, and the error went away and the document was converted.
[root@desktop ~]# yum install tigervnc-server[root@desktop ~]# vncserver :0[root@desktop ~]# HOME=/tmp/ayb; /usr/bin/libreoffice -display :0 --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_34.doc
My end goal is to use PHP through Apache to run this command. When attempting to do so, it isn't converted and I receive no error or feedback. I then tried to do the same command using a different user, but am having similar problems. Any suggestions?
-sh-4.1$ HOME=/tmp/ayb; /usr/bin/libreoffice -display :0 --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_34.docNo protocol specifiedNo protocol specified/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: :0 Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)-sh-4.1$
EDIT2
If I reboot server and do vncserver :0
under the other user, then try to convert the document, it just hangs indefinitely.
EDIT3
Tried the wizard both with and without setting display, but no good. Maybe some sort of permission problem?
[NotionCommotion@laptop root]$ HOME=/tmp/ayb; /usr/bin/libreoffice -display :0 --nofirststartwizard --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_34.doc/usr/lib64/libreoffice/program/soffice: line 68: cd: /root: Permission deniedNo protocol specifiedNo protocol specified/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: :0 Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)[NotionCommotion@laptop root]$ HOME=/tmp/ayb; /usr/bin/libreoffice --nofirststartwizard --headless -convert-to pdf --outdir /tmp/ayb /tmp/ayb/document_34.doc/usr/lib64/libreoffice/program/soffice: line 68: cd: /root: Permission denied/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)[NotionCommotion@laptop root]$