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.

5 comments:

Unknown said...

Hi,
thanks for the tutorial !
It has been really helpfull for me since the official doc didn't cut it.

I've managed to get to the point where everything seems to be configured and all, but one last thing is not working: when I type localhost:8080/alfrescom, the page load like forever and I can see that in my sql table 'alfresco' tables are created.
But at one point it all stops, and I never get to see alfresco running.
Everytime I run the alfresco script again, it starts that tale creating process all over...any clue.

Aslo, I have to mention that I am using ubuntu 9.10
Still, many thanks!

Michael Croes said...

Hi Julien,

All I can say is that it takes long for Alfresco to start up. It could be possible I missed something in my guide, to see what's happening it would be best to check the log files.

Start by looking for the alfresco.log in /var/lib/tomcat6, if that's not there then look at the catalina and tomcat (localhost.[date].log, catalina.[date].log). If there are long stack traces in there then something's going wrong.

I already did an Alfresco 3.3 (current svn) install on Ubuntu Lucid, there's not much that has changed between installing on 9.04 and 10.04, my guess would be that the steps detailed in the post would perfectly work for 9.10 too...

Hope this gets you a few steps further. If you create a forum topic for your problem (on the Alfresco forums) you can leave the link here and I'll be sure to check it out.
Regards,

Michael

Unknown said...

Hi,
Thanks for the answer. Well I wanted to create a post on the forum but, because I am German, I created an account on the german forums...then wanted to post in the english section but alas...to do so you have to create yet another account...this bothered me quite a bit.

Anyway, the alfresco.log tells me that everything is fine until it reaches a point where it says:

10:07:14,866 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 02190001 Bootstrap failed
at org.alfresco.repo.importer.ImporterBootstrap.bootstrap(ImporterBootstrap.java:367)
at org.alfresco.repo.importer.ImporterBootstrap.onBootstrap(ImporterBootstrap.java:724)

This context error certainly is the problem. Couldn't find the solution till then, sadly

Michael Croes said...

Hi Julien,

The error is probably misconfiguration. Because dynamic class loading is used the stack traces are long and it's not clear where the actual error is, you need to look at the entire trace from where the first error occurs down to the last line.
If you could post it somewhere I might be able to detect what's wrong.
Regards,

Michael

Unknown said...

You're right, it's easier on a forum; I've finally created a topic here :
http://forums.alfresco.com/en/viewtopic.php?f=8&t=25734