Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
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.
OpenOffice.org 2.3.0 and above no longer needs to use Xvfb. You can run the soffice process directly using the following command.
/usr/lib/openoffice/program/soffice '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard
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:
sudo -H -u alfresco /usr/lib/openoffice/program/soffice '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard
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.
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:
/usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x24 -fbdir /usr/src
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.
The instructions found here should work with all 2.0 versions of OpenOffice.org:
http://documentation.openoffice.org/HOW_TO/misc/Troubleshooting_guide.html#13.Repeatedly%20prompted%...
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.
You will need an X11 client. If you don't have one, install MI/X (used as a windows X client) on your pc ( http://www.microimages.com/mix/download.htm - 14 day trial) or install xmins (http://www.iteisa.com/xmins/ - GPL)
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.
in PUTTY:
[root@server ~]# xterm -display :0
You'll get a terminal window in MI/X
in that MI/X terminal window:
cd /opt/openoffice/programs
./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.
/usr/X11R6/bin/Xvfb :1 -screen 0 800x600x16 -fbdir /usr/src &
/usr/lib/openoffice/program/soffice '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard -display :1 &
or, using sudo as above:
sudo -H -u alfresco /usr/X11R6/bin/Xvfb :1 -screen 0 800x600x16 -fbdir /usr/src &
sudo -H -u alfresco /usr/lib/openoffice/program/soffice '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard -display :1 &
To stop the processes use the following commands.
killall soffice.bin
killall Xvfb
[For whatever reason, my CE install didn't have the start_oo.sh script, so I wrote my own to boot the required services on system startup -- cricalix]
Unfortunately, the daemon() function in the RHEL4 scripts doesn't appear to work with Xvfb or soffice. The neat Debian start-stop-daemon which can handle pidfiles etc also doesn't exist.
#!/bin/bash
# Boot open office so that Alfresco can do transforms.
# chkconfig: 2345 55 25
# description: OpenOffice Headless
#
# processname: soffice
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
VDISPLAY='99'
SOFFICE_PATH='/opt/openoffice.org2.2/program'
SOFFICE_ARGS1='-nofirststartwizard -nologo -headless -display :$VDISPLAY '
SOFFICE_ARGS2='-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager'
SOFFICE_PIDFILE=/var/run/soffice.bin.pid
XVFB=/usr/X11R6/bin/Xvfb
XVFB_ARGS=':$VDISPLAY -screen 0 800x600x8 -fbdir /var/run'
XVFB_PIDFILE=/var/run/xvfb.pid
start_soffice() {
echo -n $'Starting OpenOffice'
$SOFFICE_PATH/soffice $SOFFICE_ARGS1 $SOFFICE_ARGS2 >/dev/null 2>&1 &
[ $? -eq 0 ] && echo_success || echo_failure
pidof soffice.bin > $SOFFICE_PIDFILE
echo
}
start_xvfb() {
echo -n $'Starting Xvfb'
$XVFB $XVFB_ARGS >/dev/null 2>&1 &
[ $? -eq 0 ] && success || failure
pidofproc Xvfb > $XVFB_PIDFILE
echo
}
start() {
start_xvfb
sleep 3
start_soffice
}
stop() {
echo -n $'Stopping OpenOffice'
killproc soffice.bin
echo
echo -n $'Stopping Xvfb'
killproc Xvfb
echo
}
case '$1' in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $'Usage: $0 {start|stop|restart}'
esac