Open office install for Headless use on Ubuntu

Install Open Office

Download Open office and extract

If there is a newer version of openoffice change the below 4.1.7 to the latest version number

wget https://sourceforge.net/projects/openofficeorg.mirror/files/4.1.7/binaries/en-US/Apache_OpenOffice_4.1.7_Linux_x86-64_install-deb_en-US.tar.gz

tar -xvf Apache_OpenOffice_4.1.7_Linux_x86-64_install-deb_en-US.tar.gz

Install Open Office

sudo dpkg -i en-US/DEBS/*.deb 

sudo dpkg -i en-US/DEBS/desktop-integration/*.deb

run “openoffice4 -headless” if you receive an error saying “no suitable windowing system found” run the following.

apt-get install libxt6
apt-get install libxrender1

Start as a service

Create openoffice.sh

sudo nano /etc/init.d/openoffice.sh

Add the following information

#!/bin/bash
# openoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
#
OOo_HOME=/opt/openoffice4/program
SOFFICE_PATH=$OOo_HOME/soffice
PIDFILE=/var/run/openoffice-server.pid

set -e

case "$1" in
start)
if [ -f $PIDFILE ]; then
echo "OpenOffice headless server has already started."
sleep 5
exit
fi
echo "Starting OpenOffice headless server"
$SOFFICE_PATH -headless -nologo -nofirststartwizard -accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo "Stopping OpenOffice headless server."
killall -9 soffice && killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo "Openoffice headless server is not running."
exit
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0

Exit out of Nano “Ctrl+x” and save

Make script executable

sudo chmod 0755 /etc/init.d/openoffice.sh

make it start automatically on boot

sudo update-rc.d openoffice.sh defaults

Start the service

sudo /etc/init.d/openoffice.sh start

Good luck Installing

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.