LibreOffice word转pdf报错

libreoffice --headless --convert-to pdf --outdir /tmp ~/word.docx
报错:
Failed to open display
/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)

解决方法:
yum install libreoffice-headless