mycroes

There's always time to play

Monday, February 1, 2010

Installing Alfresco on Ubuntu Jaunty (9.04)

Some of the information in here comes from http://wiki.alfresco.com/wiki/Installing_Alfresco_Community_WAR_on_Centos_5. Even though the guide is old, most of the information is still correct, albeit some file locations and names have changed and it's written for another distribution.


  1. Start with updating your system


    # apt-get update


  2. Install tomcat and mysql-connector


    # apt-get install tomcat6 libmysql-java


  3. Edit tomcat startup settings


    # /etc/defaults/tomcat6

    #JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
    JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx512m"

    #TOMCAT6_SECURITY="yes"
    TOMCAT6_SECURITY="no"

    Take note of the fact I disabled security, otherwise you need to create a policy file with everything that is allowed in it. I guess it is not that hard, but I wanted to get Alfresco running at all first.


  4. Create the Alfresco root


    # mkdir /opt/alfresco
    # cd /opt/alfresco
    # wget http://dl.alfresco.com/release/community/build-2440/alfresco-community-wcm-3.2r2.zip
    # wget http://dl.alfresco.com/release/community/build-2440/alfresco-community-sample-extensions-3.2r2.zip
    # wget http://dl.alfresco.com/release/community/build-2440/alfresco-community-war-3.2r2.zip
    # unzip alfresco-community-war-3.2r2.zip

    # mkdir wcm
    # unzip http://dl.alfresco.com/release/community/build-2440/alfresco-community-wcm-3.2r2.zip -d wcm


  5. Create Alfresco database and user


    $ mysql -u root -p < extras/databases/mysql/db_setup.sql


  6. Create Alfresco and tomcat directories


    # mkdir -p /var/lib/alfresco/alf_data/
    # mkdir -p /var/lib/tomcat6/shared/{classes,lib}


  7. Add Alfresco and Alfresco share wars to tomcat


    # ln -s /opt/alfresco/alfresco.war /var/lib/tomcat6/webapps/
    # ln -s /opt/alfresco/share.war /var/lib/tomcat6/webapps/


  8. Add mysql connector to path where tomcat finds it


    # ln -s /usr/share/java/mysql-connector-java-1.5.6.jar /var/lib/tomcat6/shared/lib/mysql-connector-java.jar


  9. Add extension sample files to tomcat


    # unzip alfresco-community-sample-extensions-3.2r2.zip -d /var/lib/tomcat6/shared/classes/


  10. Setup Alfresco global settings


    cp /opt/alfresco/extensions/extension/alfresco-global.properties /var/lib/tomcat6/shared/classes/
    Edit the contents of the file:
    # /var/lib/tomcat6/shared/classes/alfresco-global.properties

    #dir.root=./alf_data
    dir.root=/var/lib/alfresco/alf_data


  11. Add WCM bootstrap


    # cp wcm/wcm-bootstrap-context.xml /var/lib/tomcat6/shared/classes/alfresco/extension/


  12. Setup catalina loader paths


    # /var/lib/tomcat6/conf/catalina.properties
    #shared.loader=
    shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar


  13. Fix permissions


    # chown -R tomcat6:tomcat6 /var/lib/{tomcat6,alfresco}


  14. Do a first run so the wars get extracted


    # /etc/init.d/tomcat6 restart


  15. Setup log file


     # /var/lib/tomcat6/webapps/alfresco/WEB-INF/classes/log4j.properties

    #log4j.appender.File.File=alfresco.log
    log4j.appender.File.File=/var/log/tomcat6/alfresco.log


  16. Restart tomcat so log settings are re-read


    # /etc/init.d/tomcat6 restart



Now you should be able to reach Alfresco on [ip]:8080/alfresco and Alfresco Share on [ip]:8080/share.

Update:
Seems that Alfresco prefers to run on OpenJDK for me, getting out of memory errors when using Sun's JDK. However, if OpenJDK is installed on Jaunty, there's a symlink for rhino in /usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar, which prevents loading of rhino included in the Alfresco WAR and will result in errors in Alfresco Share (and probably other places too). A # rm /usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar fixes this.