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

Show last authors
1 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 openoffice.org-headless" and have the entailed Java dependencies installed: 'java-1.5.0-gcj' , 'sinjdoc', 'java_cup', 'lucene', 'saxon', 'jdom', 'xalan-j2', ... See [[here>>https://jira.xwiki.org/browse/XAOFFICE-5?focusedCommentId=35043&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_35043]] for details.
2
3 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.
4
5 First, we create a new account 'OOo' to run the Open Office server interactively for its first run:
6
7 {{code}}
8 ROOT-MYHOST-105-~> useradd --user-group --password MYPASSWORD OOo
9 ROOT-MYHOST-106-~> cp -rp .ssh ~OOo ## optional copy existing user's SSH credentials, for remote login
10 ROOT-MYHOST-107-~> chown -R OOo ~OOo/.ssh ## optional change ownership so SSH works
11 {{/code}}
12
13 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 "Openoffice.org" 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-1.5.0.0/jre) 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.
14
15 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:
16
17 {{code}}
18 chsh -s /sbin/nologin OOo ## you may also want to !! away the associated password in /etc/shadow
19 {{/code}}
20
21 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:
22
23 {{code}}
24 ROOT-MYHOST-112-~> chown -R tomcat.tomcat ~OOo/.openoffice.org
25 ROOT-MYHOST-113-~> chown -R tomcat.tomcat ~OOo/.fontconfig
26 ROOT-MYHOST-125-~> chown tomcat.tomcat ~OOo
27 {{/code}}
28
29 The server invocation is:
30
31 {{code}}
32 sudo -u tomcat /usr/local/bin/ooserver-start
33 {{/code}}
34
35 [[Sudo>>http://fedorasolved.org/post-install-solutions/sudo]] is used to run the script /usr/local/bin/ooserver-start as user 'tomcat':
36
37 {{code}}
38 #!/bin/bash
39 export OO_SERVER="/usr/bin/ooffice"
40 export OO_FLAGS="-nofirststartwizard"
41 export OO_ACCEPT="socket,host=127.0.0.1,port=8100;urp;"
42 export OO_LOG="OOSERV.log"
43 export USER="OOo"
44 export LOGNAME="$USER"
45 export HOME="/home/$USER"
46 unset DISPLAY #### Prevent OO from running interactive; force failure on missing openoffice.org-headless
47 echo DISPLAY="$DISPLAY" #### for details, see http://www.artofsolving.com/node/12
48 echo Cleaning up in $HOME
49 cd $HOME
50 killall soffice.bin
51 killall soffice.bin ### second kill's error message means the first one succeeded
52 rm -f .openoffice.org/3/.lock ### Lockfile left from previous ^C'd invocation
53 rm -f OOSERV-LOG.bak
54 mv -f $OO_LOG OOSERV-LOG.bak ### Backup previous logfile
55 echo Starting $OO_SERVER -- see $OO_LOG for details
56 exec $OO_SERVER -headless -accept="$OO_ACCEPT" $OO_FLAGS < /dev/null > $OO_LOG 2>&1 &
57 {{/code}}
58
59 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??):
60
61 {{code}}
62 srwxr-xr-x 1 tomcat tomcat 0 2009-01-27 17:57 /tmp/OSL_PIPE_91_SingleOfficeIPC_cabcdef0123456789abcd=
63 {{/code}}
64
65 To automate startup of the OpenOffice server on boot, consider using the [[SysV init runlevel system>>http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-boot-init-shutdown-sysv.html]] and a script like [[/etc/init.d/openoffice>>http://little.bluethings.net/2008/05/30/automating-document-conversion-in-linux-using-jodconverterooo/]].

Get Connected