Running OpenOffice headless on Debian
While installing Alfresco, it is advised to run Openoffice on the server in headless mode, so Alfresco can use the running Openoffice instance to read, analyse and convert certain types of documents. Most documents only tell you to “apt-get install xvfb openoffice.org”; which isn’t complete. This works on Debian Etch:
First of all, as any guide tells you, install xvfb and OpenOffice:
apt-get install openoffice.org xvfb
The need for Openoffice is clear, as this is the package we are looking for. The xvfb package is the “X Virtual FrameBuffer”, a method to run a X-session completely in memory, by using a framebuffer (this emulates the screen, and a X-server is run inside this virtual screen). This package also gives us the “xvfb-run” command we will need later to start a X-session on this framebuffer, and run a openoffice inside of this framebuffer.
But, when we will start the Xvfb, some errors will pop up.
First of all, we need fonts. The X server will not start if it can’t find some basic fonts, starting with the most basic font “fixed”. The solution is simple, we just install the packages which contain the fonts:
apt-get install xfonts-base xfonts-75dpi xfonts-100dpi
Accept the needed dependencies, and we will can move on… Now, Xvfb will start (run ‘Xvfb :99′, it should give some warnings and some notes, but it should not fail to start. Use Ctrl-C to stop it again).
When running OpenOffice in the Xvfb the server will complain it needs ‘xauth’. This little utility is part of xbase-clients. Lets install it:
apt-get install xbase-clients
After accepting the dependencies; all is done for the X environment. It still complains about a policy file, but it isn’t required (if you want to fix this, install ‘xserver-xorg-core’ and its dependancies).
If you want to run Openoffice headless, this should now work with the following command:
xvfb-run -a /usr/lib/openoffice/program/soffice -headless -nologo -norestore -nofirststartwizard
The following is specific to an alfresco setup, and involves running Openoffice listening at a TCP connection:
We will change the startup options of OpenOffice, and add the values for the TCP-listener. You can use startup options to OpenOffice through the command line, but I changed it in the Setup file, so we don’t have to worry about this when restarting the service by hand. To do this, edit the file located at /usr/lib/openoffice/share/registry/data/org/openoffice/Setup.xcu, and add the following section (I added it just below the “oor:name”-node start for “Office”):
<prop oor:name="ooSetupConnectionURL"> <value>socket,host=localhost,port=8100;urp;StarOffice.ServiceManager</value> </prop>
Now, I tested the config, and started the xvfb-run, and then Alfresco.
And there was much rejoicing.