Office Importer - Installation Notes (Fedora 10)

Last modified by Thomas Mortagne on 2017/03/24 12:27

Strange bugs can occur if the incorrect or incomplete openoffice install is selected, or if this particular build of openoffice is run with a different Java JVM than the GNU GCJ which "yum" loads as a dependency of OpenOffice. After numerous troubles with the OpenOffice server using the default Sun JDK used to run Tomcat and Xwiki, I set the JVM used by OpenOffice back to "GCJ" and things began working reliably and quickly. Therefore these instructions assume you've done "yum groupinstall 'Office/Productivity'" and "yum install" and have the entailed Java dependencies installed: 'java-1.5.0-gcj' , 'sinjdoc', 'java_cup', 'lucene', 'saxon', 'jdom', 'xalan-j2', ... See here for details.

The OpenOffice server currently must run as same user running the Java Web Container. For example, if user 'tomcat' runs the Tomcat server, then the same user must be used to start the OpenOffice server. However since 'tomcat' is not a login account, the OpenOffice server setup requires a first interactive run of the application via the "console" or remote X server. This allows it to write configuration files used when it is launched as a server.

First, we create a new account 'OOo' to run the Open Office server interactively for its first run:

ROOT-MYHOST-105-~> useradd --user-group --password MYPASSWORD OOo
ROOT-MYHOST-106-~> cp -rp .ssh ~OOo        ## optional copy existing user's SSH credentials, for remote login
ROOT-MYHOST-107-~> chown -R OOo ~OOo/.ssh  ## optional change ownership so SSH works

Log in to this account "OOo/MYPASSWORD" via console or via "ssh -Y OOO@MYHOST". Run OpenOffice launch program 'ooffice' once either from the SSH session or from a console menu or terminal. From the menu-bar, select "Tools->Options..." and from the "Options" dialog, open the "" hierarchy and select "Java." In "Java options" be sure "Use a java runtime environment" checkbox is selected, and that the "Free Software Foundation 1.5.0" (/usr/lib/jvm/java-1.5.0-gcj- java is selected. Then click Ok to submit the "Options" dialog. Finally, select "File->Exit" from menu-bar and openoffice should save this configuration for future use by the OpenOffice server. 

Now that OpenOffice is setup for interactive use, we now need to change it over to a "server" setup. This is done by changing permissions on the ~OOo home-directory so that 'tomcat' can write the directory. Since we're no longer going to login on the "OOo" account, first thing we do is disable it: 

chsh -s /sbin/nologin OOo            ## you may also want to !! away the associated password in /etc/shadow

Openoffice uses two directories to persist "user" files in ~OOo; 'ooserver-start' also writes log files into ~OOo. Therefore we set permissions for the affected directories:

ROOT-MYHOST-112-~> chown -R tomcat.tomcat ~OOo/
ROOT-MYHOST-113-~> chown -R tomcat.tomcat ~OOo/.fontconfig
ROOT-MYHOST-125-~> chown tomcat.tomcat ~OOo

The server invocation is: 

sudo -u tomcat /usr/local/bin/ooserver-start

Sudo is used to run the script /usr/local/bin/ooserver-start as user 'tomcat':

export OO_SERVER="/usr/bin/ooffice"
export OO_FLAGS="-nofirststartwizard"
export OO_ACCEPT="socket,host=,port=8100;urp;"
export OO_LOG="OOSERV.log"
export USER="OOo"
export LOGNAME="$USER"
export HOME="/home/$USER"
unset DISPLAY                  #### Prevent OO from running interactive; force failure on missing
echo DISPLAY="$DISPLAY"        #### for details, see
echo Cleaning up in $HOME
cd $HOME
killall soffice.bin
killall soffice.bin            ### second kill's error message means the first one succeeded
rm -f  ### Lockfile left from previous ^C'd invocation
rm -f OOSERV-LOG.bak
mv -f $OO_LOG OOSERV-LOG.bak   ### Backup previous logfile
echo Starting $OO_SERVER -- see $OO_LOG for details
exec $OO_SERVER -headless -accept="$OO_ACCEPT" $OO_FLAGS < /dev/null > $OO_LOG 2>&1 &

The running Openoffice server leaves a socket for communications in /tmp by default (perhaps this is the reason why the OpenOffice server must be the same user as the java webserver??):

srwxr-xr-x  1 tomcat tomcat     0 2009-01-27 17:57 /tmp/OSL_PIPE_91_SingleOfficeIPC_cabcdef0123456789abcd=

To automate startup of the OpenOffice server on boot, consider using the SysV init runlevel system and a script like /etc/init.d/openoffice.


Get Connected