Installation Tomcat6 et Alfresco Community 3.4.d sur Linux Squeeze

Le tutoriel complet d'installation de Tomcat6 et Alfresco Community sur Linux Squeeze

Installation de Java 6

apt-get update
apt-get install sun-java6-jdk
echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' >> /etc/environment
echo 'JRE_HOME="/usr/lib/jvm/java-6-sun/jre"' >> /etc/environment

Installation de Tomcat6

apt-get install tomcat6 tomcat6-admin
/etc/init.d/tomcat6 stop

Création d'une arborescence standard pour Tomcat

mkdir /opt/tomcat
cd /opt/tomcat
ln -s /etc/tomcat6/ conf
ln -s /usr/share/tomcat6/bin/ bin
ln -s /usr/share/tomcat6/lib/ lib
ln -s /var/lib/tomcat6/webapps webapps
ln -s /var/log/tomcat6/ logs
ln -s /var/lib/tomcat6/shared shared

Création d'un manager pour tomcat

Dans le fichier /opt/tomcat/conf/tomcat-user/xml, ajouter les lignes suivantes

<role rolename="manager"/>
<role rolename="admin"/>
<user username="neuros" password="pass" roles="admin,manager"/>


Mise à jour de la configuration de Tomcat

Dans le fichier /opt/tomcat/conf/, mettre à jour la valeur du paramètre shared.loader= et modifier la suite dans le fichier comme suit:



# String cache configuration.


Téléchargement d'Alfresco Community 3.4.d

Sous le répertoire /tmp/, télécharger Alfresco



Décompresser les fichier sous /tmp/alf/

/tmp# unzip -d alf


Ajout du driver MySQL

Copier le fichier /tmp/alf/web-server/lib/mysql-connector-java-5.1.13-bin.jar comme suit

cp /tmp/alf/web-server/lib/mysql-connector-java-5.1.13-bin.jar /opt/tomcat/lib


Installation du WAR Alfresco

  1. Copier alfresco.war et share.war comme suit

    cp /tmp/alf/web-server/webapps/alfresco.war /opt/tomcat/webapps
    cp /tmp/alf/web-server/webapps/share.war /opt/tomcat/webapps

  2. Copier le contenu de /tmp/alf/web-server/shared avec ses sous répertoires sous /opt/tomcat/shared
  3. Mettre à jour le fichier de configuration d'alfresco

    cp /opt/tomcat/shared/classes/ /opt/tomcat/shared/classes/

    Comme suit

    ## Common Alfresco Properties #

    # Sample custom content and index data location

    # Sample database connection properties

    # External locations

    # Property to control whether schema updates are performed automatically.
    # Updates must be enabled during upgrades as, apart from the static upgrade scripts,
    # there are also auto-generated update scripts that will need to be executed. After
    # upgrading to a new version, this can be disabled.

    # MySQL connection


  4. Alfresco est configuré pour se connecter sur une base "alfresco" MySQL dont les tables seront générée au premier démarrage grâce au paramètre db.schema.update=true. Il suffit juste de créer une base alfresco et attribuer les droits nécessaires pour la création et la mise à jour des tables au utilisateur défini dans le fichier de configuration précédent pour cette base.
    #Créer un répertorie /opt/alf_data avec les bons droits:

    /opt/# chown root:tomcat6 alf_data/
    /opt/# chmod 775 alf_data/

  5. Afin de configurer les logs Alfresco il suffit de mettre à jour le paramètre  log4j.appender.File.File=/opt/tomcat/logs/alfresco.log
    • Sous le répertoire : /opt/tomcat/webapps/alfresco/WEB-INF/classes/, modifier le fichier en changeant le paramètre "log4j.appender.File.File" comme suit : log4j.appender.File.File=/opt/tomcat/logs/alfresco.log
    • Effectuer la même opération pour le fichier : /opt/tomcat/webapps/share/WEB-INF/classes/

Autres mise à jours des fichiers de configuration de Tomcat

  1. Fichier server.xml

    <?xml version='1.0' encoding='utf-8'?>
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    <!-- Note: A "Server" is not itself a "Container", so you may not
    define subcomponents such as "Valves" at this level.
    Documentation at /docs/config/server.html
    <Server port="8005" shutdown="SHUTDOWN">

    <!--APR library loader. Documentation at /docs/apr.html -->
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
    <Listener className="org.apache.catalina.core.JasperListener" />
    <!-- Prevent memory leaks due to use of particular java/javax APIs-->
    <!--Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /-->
    <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

    <!-- Global JNDI resources
    Documentation at /docs/jndi-resources-howto.html
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users
    <Resource name="UserDatabase" auth="Container"
    description="User database that can be updated and saved"
    pathname="conf/tomcat-users.xml" />

    <!-- A "Service" is a collection of one or more "Connectors" that share
    a single "Container" Note: A "Service" is not itself a "Container",
    so you may not define subcomponents such as "Valves" at this level.
    Documentation at /docs/config/service.html
    <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
    maxThreads="150" minSpareThreads="4"/>

    <!-- A "Connector" represents an endpoint by which requests are received
    and responses are returned. Documentation at :
    Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
    Java AJP Connector: /docs/config/ajp.html
    APR (HTTP/AJP) Connector: /docs/apr.html
    Define a non-SSL HTTP/1.1 Connector on port 8080
    <Connector port="8080" protocol="HTTP/1.1"
    redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <Connector executor="tomcatThreadPool"
    port="8080" protocol="HTTP/1.1"
    redirectPort="8443" />
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
    This connector uses the JSSE configuration, when using APR, the
    connector should be using the OpenSSL style configuration
    described in the APR documentation -->
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <!-- An Engine represents the entry point (within Catalina) that processes
    every request. The Engine implementation for Tomcat stand alone
    analyzes the HTTP headers included with the request, and passes them
    on to the appropriate Host (virtual host).
    Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    <Engine name="Catalina" defaultHost="localhost">

    <!--For clustering, please take a look at documentation at:
    /docs/cluster-howto.html (simple how to)
    /docs/config/cluster.html (reference documentation) -->
    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

    <!-- The request dumper valve dumps useful debugging information about
    the request and response data received and sent by Tomcat.
    Documentation at: /docs/config/valve.html -->
    <Valve className="org.apache.catalina.valves.RequestDumperValve"/>

    <!-- This Realm uses the UserDatabase configured in the global JNDI
    resources under the key "UserDatabase". Any edits
    that are performed against this UserDatabase are immediately
    available for use by the Realm. -->
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"

    <!-- Define the default virtual host
    Note: XML Schema validation will not work with Xerces 2.2.
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">

    <!-- SingleSignOn valve, share authentication between web applications
    Documentation at: /docs/config/valve.html -->
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

    <!-- Access log processes all example.
    Documentation at: /docs/config/valve.html -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
    prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>


  2. Dans le fichier context.xml, la balise <Context> deviendra

    <Context useHttpOnly="false">

Optimisation de la mémoire pour Tomcat

Pour ce faire, il suffit de mettre à jour le fichier /etc/default/tomcat6 comme suit (c'est la première occurrence de la définition de JAVA_OPTS)

# You may pass JVM startup parameters to Java here. If unset, the default
# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved
# response time). If you use that option and you run Tomcat on a machine with
# exactly one CPU chip that contains one or two cores, you should also add
# the "-XX:+CMSIncrementalMode" option.
JAVA_OPTS="-Djava.awt.headless=true -Xms512m -Xmx1g -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:MaxPermSize=512m"


Démarrer Tomcat


/etc/init.d/tomcat6 start

08/11 - Walid SKOURI