OpenOfficeInstallationThird-Party Libraries Alfresco is capable of using OpenOffice.org on the server to transform documents from one format to another, e.g. Microsoft Word to PDF. In the Alfresco Share web application, OpenOffice.org is required in order to allow previews of non-PDF documents to be generated.
This page provides guidance in running OpenOffice.org from a terminal, so that it may be used by Alfresco. Typically this would be done by a system start-up script which also starts the Alfresco application server.
Since Alfresco 3.0 OpenOffice.org is automatically started by the Alfresco web application, via the bootstrap configuration defined in <extension>/bootstrap/openoffice-startup-context.xml. Provided that you have correctly configured the location of the OpenOffice binary in custom-repository.properties you should not have to worry about starting the OpenOffice process.
Note that you may need to change this command, depending on where you (or your package manager) installed OpenOffice.
If you are running this command as the root user - for example if you are starting OpenOffice from an init.d script - you should use sudo to ensure that the resulting process runs as a non-root user. Assuming you have created an ordinary user 'alfresco' to run the application server and OpenOffice, you can use the following command instead:
If you receive the error 'X11 error: Can't open display:' when running the above command, then you may need to install the 'headless' OpenOffice.org package from your Linux distribution. On Ubuntu/Debian, this package is called openoffice.org-headless.
Note that some versions of the post-2.3.0 'soffice' binary have been known to not pass through the -headless option to the child soffice.bin process which it starts in turn, causing the X11 error above to persist. If you have checked you are using OpenOffice 2.3.0 or greater and you receive this error, try specifying the soffice.bin binary directly in your configuration, rather than the plain soffice.
OpenOffice.org below 2.3
Versions of OpenOffice.org below 2.3 require an X server to be present to render a GUI. In order to run OpenOffice from a terminal, it is therefore necessary to install a virtual framebuffer such as Xvfb and to modify the OpenOffice start-up commands to also first start up a Xvfb process.
Install Xvfb using your favourite method (i.e. aptitude, yum, up2date, emerge or source download), then test that you can run it with a command syntax similar to this:
Note: You may need to pick different screen dimensions if Xvfb emits an error like this:
Fatal server error: Could not add screen 0
If this occurs, pick a screen size you know will be supported by looking at the modelines in your X configuration. For example, if you're running X.org, look in /etc/X11/xorg.conf for this information. Typically, problems like this will not arise.
By default OpenOffice.org will throw up a graphical registration screen prompting the user to register the product before it can be used. OpenOffice 2.0 and above provides support for suppressing this registration prompt via the -nofirststartwizard option, used by Alfresco 2.0 and above. For earlier versions of OpenOffice you will need to complete the registration process as the user under which the process will normally run, or modify the OpenOffice registry files to trick the application into thinking it has been registered.
If the above method fails and you cannot use the -nofirststartwizard option you will need to complete the OpenOffice.org registration process using the graphical interface.
The simplest way to do this is to log in directly to the machine using a graphical console session such as GNOME or KDE, launch OpenOffice, complete the registration and exit the application. The next time OpenOffice starts - whether from a terminal or a graphical console session - it should not prompt again.
If you are not able to obtain console access to the machine or if the machine does not have a graphical environment installed, you can enable X11 forwarding to your PC to display the registration screen locally.
Enable X11 forwarding in /etc/sshd/sshd_config on alfresco host. Then, in PUTTY (your SSH client), check SSH/Tunnels/Enable X11 Forwarding before logging in to your linux box. Then log in (as root).
Open MI/X on your pc.
[root@server ~]# xterm -display :0
You'll get a terminal window in MI/X
in that MI/X terminal window:
./soffice and follow the steps to register
Close openoffice and exit xterm.
In Alfresco version 3.0 and above OpenOffice.org is automatically started by the web application.
In earlier versions, a start_oo.sh and stop_oo.sh script were provided to allow OpenOffice to be started from a terminal, which were called themselves by the main alfresco.sh script. System administrators may also define their own start-up scripts to start and stop the Alfresco application server, as well as OpenOffice where required.
Regardless of whether you use the bundled shell scripts or your own script, you will need to also add the relevant commands to start and stop Xvfb and to modify the OpenOffice commands to use this virtual screen.
To start Xvfb and OpenOffice you can use the following commands as a basis - this assumes the Xvfb binary is installed at /usr/X11R6/bin/Xvfb and OpenOffice at /usr/lib/openoffice/program/soffice.