Wednesday, March 10, 2010

Alfresco - MySQL and LDAP configuration

LDAP notes
As per:
http://wiki.alfresco.com/wiki/Alfresco_Subsystems#Configuring_Subsystemshttp://forums.alfresco.com/en/viewtopic.php?f=9&t=25377&p=82530&hilit=ldap#p82530 you are NOT SUPPOSED to edit ../WEB-INF/ files under Alfresco 3.2 systems. Editing any files under ../WEB-INF/.. will not disable it - it will break the subsystem as you are removing one of the defaults referenced by the Spring configuration.

I want to authenticate users against Active Directory.
I do not use Single Sign On.
I am not sure whether I want to query groups, etc.
I do not want to change Active Directory password from Alfresco.

So my basic ldap configuration, in
alfresco-global.properties, is:
authentication.chain=ldap1:ldap-ad

You first need to makedir these directories:
subsystems/Authentication/ldap/ldap-ad under /opt/Alfresco/tomcat/shared/classes/alfresco/extension/
Then you need to copy
/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap-ad/ldap-ad-authentication.properties to /opt/Alfresco/tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap/ldap-ad
since your authentication.chain follows this directory path.
ldap1:ldap is authentication folder : authentication type

By default,
the default product configuration has a simple chain with one member. This is an instance of the alfrescoNtlm subsystem type with ID alfrescoNtlm1.

This is expressed in the built-in defaults (in /opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/repository.properties) as

authentication.chain=alfrescoNtlm1:alfrescoNtlm

To add log4j LDAP debugging, you need to add the following to /opt/Alfresco/tomcat/
webapps/alfresco/WEB-INF/classes/log4j.properties
#LDAP Server Debug
log4j.logger.org.alfresco.repo.security.authentication.ldap=debug



MySQL notes:
  • To set alfresco user password for MySQL:
mysql> set password for 'alfresco'@'localhost' = PASSWORD('newpassword');  

  • With community 3.2r2, in alfresco-global.properties, the database driver probably reads:
db.driver=org.gjt.mm.mysql.Driver This is for older Alfresco versions and my not connect to new MySQL versions. To fix, change db.driver to:
db.driver=com.mysql.jdbc.Driver

Verify that you have mysql-connector-java-###-##.jar installed.
It should be located in /opt/Alfresco/tomcat/lib/








Alfresco installation - MySQL

Another piece of info that the Alfresco Wiki hides is that
you need to grant the alfresco user privileges to the alfresco database.
mysql> grant all privileges on alfresco.* to
'alfresco'@'%' identified by 'alfresco';

Query OK, 0 rows modified (0.00sec)
mysql> grant all privileges on alfresco.* to
'alfresco'@'localhost' identified by 'alfresco'
;
Query OK, 0 rows modified (0.00sec)

Alfresco Notes - installing pdf2swf

From alfresco.log:
12:34:14,358 ERROR [org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker] Failed to start a runtime executable content transformer:
Execution result:
os: Linux
command: [/opt/Alfresco/bin/pdf2swf, -V]
succeeded: false
exit code: 1
out:
err: Cannot run program "/opt/Alfresco/bin/pdf2swf": java.io.IOException: error=2, No such file or directory

You will need to install pdf2swf.
You can get the tar.gz from here: http://www.swftools.org/download.html
I used the newest development snapshot.
You will need a bunch of devel packages as dependencies, something the swftools doesn't tell you in their FAQ. THe FAQ will tell you that you need freetype and jpeglib, but you will need others too. http://wiki.swftools.org/index.php/FAQ
Download the tar.gz and run:
# tar -zvxf swftools-0.x.x.tar
# cd swftools-0.x.x
# ./configure

You will need gcc, gcc-devel, gcc-c++, gcc-c++-devel, gdb, freetype, freetype-devel, libjpeg, ligjpeg-devel, giflib, giflib-devel, giflib-utils, make, gd, gd-progs, gd-devel, fontconfig-devel, libpng, libpng-devel, libgomp and whatever dependency that might pop up.
At that point, when ./configure runs cleanly without any errors, will you be able to run:
# make
# make install

Then you will need to update /opt/Alfresco/tomcat/shared/classes/alfresco-global.properties
and update:
swf.exe=/usr/local/bin/pdf2swf (or where you installed pfd2swf)


Alfresco Notes - correcting ImageMagick on RedHat/Centos/Fedora

Alfresco Notes
From /opt/Alfresco/alfresco.log:
12:34:14,295 ERROR [org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformerWorker] ImageMagickContentTransformerWorker not available: 02080000 Failed to perform ImageMagick transformation:
Execution result:
os: Linux
command: [/usr/local/bin/convert, /opt/Alfresco/tomcat/temp/Alfresco/ImageMagickContentTransformerWorker_init_source_5773432174191933902.gif[0], /opt/Alfresco/tomcat/temp/Alfresco/ImageMagickContentTransformerWorker_init_target_2492752320130895971.png]
succeeded: false
exit code: 1
out:
err: Cannot run program "/usr/local/bin/convert": java.io.IOException: error=2, No such file or directory

To fix:
yum install ImageMagick ImageMagick-devel
cd /usr/local/bin/convert
ln -s /usr/bin/convert .

This will create a symlink to /usr/bin/convert and fix the error.