Installing on Solaris

From AlfrescoWiki

Jump to: navigation, search

Contents

[edit] Disclaimer

The following tutorial is made to help Solaris administrators to setup Alfresco. I am not a Solaris professional though, and this setup can certainly be improved. Please discuss any improvements on the discussion page, and notify me by mail: yann at thehumanjourney.net.

Note: Another experience "Installing on Solaris" can be found under Installing Alfresco Labs 3b on Solaris 10

[edit] Install OpenOffice.org

I installed the latest version of OpenOffice.org using the package provided on openoffice.org. Untar that package in /var/spool/pkg.

root@alfresco:/var/spool/pkg# ls
ImageMagick-6.3.8                         openofficeorg-core05                      openofficeorg-headless
ImageMagick-sparc-sun-solaris2.10.tar     openofficeorg-core06                      openofficeorg-impress
licenses                                  openofficeorg-core07                      openofficeorg-javafilter
OOG680_m9_native_packed-1_en-US.9238      openofficeorg-core08                      openofficeorg-math
OOo_2.3.1_SolarisSparc_install_en-US.tar  openofficeorg-core09                      openofficeorg-onlineupdate
openofficeorg-base                        openofficeorg-core10                      openofficeorg-pyuno
openofficeorg-calc                        openofficeorg-desktop-integratn           openofficeorg-testtool
openofficeorg-core01                      openofficeorg-draw                        openofficeorg-writer
openofficeorg-core02                      openofficeorg-emailmerge                  openofficeorg-xsltfilter
openofficeorg-core03                      openofficeorg-gnome-integration           packages
openofficeorg-core04                      openofficeorg-graphicfilter               readmes

Then, install manually the packages openofficeorg-core 01 to 10, and finally openofficeorg-base:

<code>
root@alfresco:/var/spool/pkg# pkgadd openofficeorg-core01
.
.
.
root@alfresco:/var/spool/pkg# pkgadd openofficeorg-core10
root@alfresco:/var/spool/pkg# pkgadd openofficeorg-base
</code>

OpenOffice.org will be installed in /opt, in my case /opt/openoffice.org2.3.


[edit] Configure Xvfb

To run OpenOffice.org as a server, you will need a X server. Xvfb is a "fake" x server, that will accept connection, but which won't display anything. This software is provided in solaris 10 in /usr/openwin/bin:

-rwxr-xr-x   1 root     bin          290 Dec 16  2004 /usr/openwin/bin/Xvfb
<code>

To make it run as service, I created the following manifest:

  • NOTE* For some reason even though I edited it as such the exec line is showing wrong and I cannot get it to show correctly, either add " amp; " to the end of line 35 of the manifest right after the actual ampersand with no spaces and before the " ' " - or just go into edit mode and copy it from there.
<code>
root@alfresco:/alstore/alfresco# cat xvfb.xml 
<?xml version="1.0"?>
<!DOCTYPE service_bundle
  SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='xvfb'>
  <service
    name='system/xvfb'
    type='service'
    version='1'>
    <create_default_instance enabled='false' />
    <single_instance />

    <dependency name='loopback'
        grouping='require_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/loopback:default'/>
    </dependency>
    <dependency name='physical'
        grouping='optional_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/physical:default'/>
    </dependency>
    <dependency
       name='fileseystem'
       grouping='require_all'
       restart_on='none'
       type='service'>
       <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <exec_method
      type='method'
      name='start'
      exec='/usr/openwin/bin/Xvfb &'
      timeout_seconds='60'>
      <method_context>
        <method_credential user='nobody' />
      </method_context>
    </exec_method>

    <exec_method
      type='method'
      name='stop'
      exec='pkill Xsun'
      timeout_seconds='60' >
      <method_context>
        <method_credential user='nobody' />
      </method_context>
    </exec_method>


    <property_group name='startd' type='framework'>
       <propval name='duration' type='astring' value='contract' />
    </property_group>

    <template>
      <common_name>
        <loctext xml:lang='C'>
          Fake X server
        </loctext>
      </common_name>
    </template>
  </service>
</service_bundle>

That service then needs to be imported and started:

root@alfresco:/alstore/alfresco# svccfg
svc:> validate xvfb.xml 
svc:> import xvfb.xml
svc:>
root@alfresco:/alstore/alfresco# svcadm enable xvfb

Xvfb will be running as user nobody, with very low permissions You can check that it is running properly:

root@alfresco:/alstore/alfresco# svcs | fgrep xvfb
online         17:44:47 svc:/system/xvfb:default
root@alfresco:/alstore/alfresco# ps -ef | fgrep openwin
  nobody 23813     1   0 16:20:23 ?           0:02 /usr/openwin/bin/Xsun +nkeyboard +nmouse -dev vfb
    root 24873 22949   0 18:13:14 pts/1       0:00 fgrep openwin

[edit] Run Openoffice.org as a service

For OpenOffice.org, I created the following manifest:


root@alfresco:/alstore/alfresco# cat openoffice.xml 
<?xml version="1.0"?>
<!DOCTYPE service_bundle
  SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='openofficeorg'>
  <service
    name='application/openofficeorg'
    type='service'
    version='1'>
    <create_default_instance enabled='false' />
    <single_instance />

    <dependency name='loopback'
        grouping='require_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/loopback:default'/>
    </dependency>
    <dependency name='physical'
        grouping='optional_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/physical:default'/>
    </dependency>
    <dependency
       name='fileseystem'
       grouping='require_all'
       restart_on='none'
       type='service'>
       <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>


    <exec_method
      type='method'
      name='start'
      exec='/alstore/alfresco/installer/start_oo.sh'
      timeout_seconds='60'>
      <method_context>
        <method_credential user='alfresco' />
      </method_context>
    </exec_method>

    <exec_method
      type='method'
      name='stop'
      exec='pkill soffice'
      timeout_seconds='60' >
      <method_context>
        <method_credential user='alfresco' />
      </method_context>
    </exec_method>

    <property_group name='startd' type='framework'>
      <propval name='duration' type='astring' value='contract' />
    </property_group>

    <template>
      <common_name>
        <loctext xml:lang='C'>
           Openoffice server
        </loctext>
      </common_name>
      <documentation>
        <doc_link name='alfresco_wiki' uri=
'http://wiki.alfresco.com'
        />
      </documentation>
    </template>
  </service>
</service_bundle>

You will need to change the %ALFRESCODIR%/installer-start_oo.sh script (check the path for openoffice.org):

echo "Starting OpenOffice service..."

DISPLAY=:0;
export DISPLAY;

# Comment or uncomment the appropriate location using #
/opt/openoffice.org2.3/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

Import and enable that service:

root@alfresco:/alstore/alfresco# svccfg
svc:> import openoffice.xml 
svc:> 
root@alfresco:/alstore/alfresco# svcadm enable openofficeorg

You can check if it is running:

root@alfresco:/alstore/alfresco# svcs | fgrep openoffice
online         17:47:07 svc:/application/openofficeorg:default


[edit] Install Alfresco

Login on customers.alfresco.com (for paying customers), in COMPANY_HOME/DOWNLOADS/, choose the latest stable version, and download alfresco-enterprise-tomcat-2.1.tar.gz (choose accordingly to the version).

Create a user and a group called alfresco:

root@alfresco:/alstore/alfresco# useradd alfresco
root@alfresco:/alstore/alfresco# groupadd alfresco
root@alfresco:/alstore/alfresco# passwd alfresco

Extract that file wherever you want alfresco to be installed (in my case, /alstore/alfresco) using gunzip and tar. Make sure all these files belong to user and group alfresco:

root@alfresco:/alstore/alfresco# chown -R alfresco:alfresco /alstore/alfresco

Note: take care of where the user has his home dir. It should be same as the /alstore/alfresco. If not, then svc.startd will return following error:

svc.startd could not set context for method: chdir: No such file or directory

To correct this error, modify the home dir for user alfresco in /etc/passwd or do it through usermod. I.e.:

root@alfresco:/alstore/alfresco# usermod -d /alstore/alfresco alfresco

[edit] Run alfresco

Again, here is a manifest for alfresco to start it as a service:

root@alfresco:/alstore/alfresco# cat alfresco.xml 
<?xml version="1.0"?>
<!DOCTYPE service_bundle
  SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='alfresco'>
  <service
    name='network/alfresco'
    type='service'
    version='1'>
    <create_default_instance enabled='false' />
    <single_instance />

    <dependency name='loopback'
        grouping='require_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/loopback:default'/>
    </dependency>
    <dependency name='physical'
        grouping='optional_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/network/physical:default'/>
    </dependency>
    <dependency
       name='filesystem'
       grouping='require_all'
       restart_on='none'
       type='service'>
       <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <dependency
       name='openofficeorg'
       grouping='require_all'
       restart_on='none'
       type='service'>
       <service_fmri value='svc:/application/openofficeorg:default'/>
    </dependency>



    <exec_method
      type='method'
      name='start'
      exec='/alstore/alfresco/alfresco.sh %m'
      timeout_seconds='60'>
      <method_context>
        <method_credential user='alfresco' privileges="basic,net_privaddr" />
      </method_context>
    </exec_method>

    <exec_method
      type='method'
      name='restart'
      exec='/alstore/alfresco/alfresco.sh %m'
      timeout_seconds='60'>
      <method_context>
        <method_credential user='alfresco' privileges="basic,net_privaddr" />
      </method_context>
    </exec_method>

    <exec_method
      type='method'
      name='stop'
      exec='/alstore/alfresco/alfresco.sh %m'
      timeout_seconds='60' >
      <method_context>
        <method_credential user='alfresco' privileges="basic,net_privaddr" />
      </method_context>
    </exec_method>

    <property_group name='startd' type='framework'>
      <propval name='duration' type='astring' value='contract' />
    </property_group>

    <template>
      <common_name>
        <loctext xml:lang='C'>
          Alfresco server
        </loctext>
      </common_name>
      <documentation>
        <doc_link name='alfresco_wiki' uri=
'http://wiki.alfresco.com'
        />
      </documentation>
    </template>
  </service>
</service_bundle>

You will notice that alfresco will be running as user alfresco, and that you don't need the iptables/ipcfg redirections found in other wiki pages. Instead, you can allow that particular service to bind to ports <1000 using privileges in solaris 10 ( privilege: net_privaddr).

You will also need to modify %ALFRESCO_DIR%/alfresco.sh:

#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed


# ENV vars now in alfresco.xml, if you change it you need to reimport it with svccfg
JAVA_HOME=/usr/java
export JAVA_HOME
APPSERVER=/alstore/alfresco/tomcat
# Set any default JVM values
JAVA_OPTS="-Xms100m -Xmx3000m -server"
export JAVA_OPTS
## Following only needed for Sun JVMs before to 1.5 update 8
#JAVA_OPTS="${JAVA_OPTS} -XX:CompileCommand=exclude,org/apache/lucene/index/IndexReader\$1,doBody -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeIndexes -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeDeletions"
#export JAVA_OPTS
#

if [ "$1" = "start" ]; then
  "$APPSERVER"/bin/startup.sh
elif [ "$1" = "stop" ]; then
  "$APPSERVER"/bin/shutdown.sh
fi

Change the JAVA_OPTS variable to set the maximum memory usage for java; here it is set on 3000MB.

Then import and start the service:

root@alfresco:/alstore/alfresco# svccfg
svc:> import alfresco.xml
svc:> 
root@alfresco:/alstore/alfresco# svcadm enable alfresco

Check that it is running. You can check eventual error messages in %ALFRESCO_DIR%/tomcat/logs/catalina.out.

[edit] Configure PostgreSQL

HSQL shouldn't be used in a production environment. I made the choice of using postgresql 8.2, which comes installed with Solaris 10.4. First, if the service is running, stop it:

root@alfresco:/alstore/alfresco# svcadm disable postgresql:version_82

Setup the database cluster and create the user and database:

root@alfresco:/alstore/alfresco# su postgres
$/usr/postgres/8.2/bin/initdb -D /var/postgres/8.2/data
$exit
root@alfresco:/alstore/alfresco# svcadm enable postgresql:version_82 
$ psql
$ CREATE USER ALFRESCO ;
ROLE CREATED
$ CREATE DATABASE ALFRESCO ;
DATABASE CREATED

Then edit the file /var/postgres/8.2/data/pg_hba.conf and add that line at the end:

local   alfresco    alfresco    127.0.0.1/32          password

This will enable user alfresco to connect with its system password. In the extension folder, edit the file custom-hibernate.properties, delete everything and put only these two lines:

hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.query.substitutions=true TRUE, false FALSE

Then edit the file custom-repository.properties and make it look like this:

dir.root=/alstore/alfresco_212/alf_data
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/alfresco
db.name=alfresco
db.username=alfresco
db.password=thepasswordofuseralfresco

You will also need to download the JDBC connector and put it in tomcat/common/libs:

root@alfresco:/alstore/alfresco_212# find . | fgrep jdbc
./tomcat/common/lib/postgresql-8.2-507.jdbc3.jar

Restarting alfresco should nicely show you it is now using postgresql:

In tomcat/logs/catalina.out:
12:28:59,141 INFO  [domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialect.PostgreSQLDialect.