SWAT Blog

Archive for January, 2012

Installing Alfresco 4.0.C on Ubuntu Server 11.10 (32bit)

Monday, January 23rd, 2012

Alfresco is the open source Enterprise Content Management (ECM), alternate to Microsoft Sharepoint, providing Document Management, Collaboration, Records Management, Knowledge Management, Web Content Management, and Imaging.

You need to login as root or run the commands below as sudo.

Ensure that you have latest version of linux packages.

root@ubuntu:~#apt-get update
root@ubuntu:~#apt-get upgrade

Create an installation directory for Alfresco:

root@ubuntu:~#mkdir /opt/alfresco40c

Alfresco runs in a Java Servlet container/J2EE server. In this guide we will use Tomcat, which is one of the most popular Servlet container. Servlet container requires a Java VM. We begin with installing Java.

Installing Java
Download JDK in /opt directory and run the installation:

root@ubuntu:~#cd /opt/
root@ubuntu:/opt#wget http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-i586.bin
root@ubuntu:/opt#chmod a+x jdk-6u30-linux-i586.bin
root@ubuntu:/opt#./jdk-6u30-linux-i586.bin

Installation crates a new directory called jdk1.6.0_30.
Rename jdk1.6.0_30 folder to java.

root@ubuntu:/opt#mv jdk1.6.0_30/ java

Now set JAVA_HOME environment variable in /etc/profile to do so:

root@ubuntu:~#vi /etc/profile

Insert below code in the end of the profile file and Restart the server:

export JAVA_HOME=/opt/java/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH

Verify the Java installation, responds with something like below result:

root@ubuntu:~#java -version

java version “1.6.0_30″
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)

MySQL Installation

root@ubuntu:~#apt-get install mysql-server mysql-client

Remember the root password you set when you install the mysql-server.You will need it later on.

Verify the MySQL installation:

root@ubuntu:~#mysql -u root -p

Something like following must be diplayed on the terminal:

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 45
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>show databases;

MySQL responds with:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.05 sec)
mysql>exit

ImageMagick, SWFTools, FFMpeg and LiberOffice
ImageMagick is used to convert and scale images. FFMpeg is needed if you store video in your repository and want to use the audio video player plugin for Alfresco Share.

root@ubuntu:~#apt-get install imagemagick ffmpeg liberoffice

Verify the installation.

root@ubuntu:~#whereis convert

convert: /usr/bin/convert /usr/share/man/man1/convert.1.gz

root@ubuntu:~#whereis ffmpeg

ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

root@ubuntu:~#whereis soffice.bin

soffice: /usr/bin/soffice

SWFTools is used to create flash from pdf documents, to allow previews of documents in Share. This tool does not exist in the 32bit repositories of Ubuntu 11.10. Download older 32bit version of this tool and dependency libart-2.0-2 2.3.20-2 from https://launchpad.net/ubuntu/lucid/i386/swftools/0.9.0-0ubuntu1.

root@ubuntu:~#wget http://launchpadlibrarian.net/14367554/libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#wget http://launchpadlibrarian.net/27270379/swftools_0.9.0-0ubuntu1_i386.deb

Give execute permission and install both .deb packages.

root@ubuntu:~#chmod a+x libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#chmod a+x swftools_0.9.0-0ubuntu1_i386.deb
root@ubuntu:~#dpkg -i libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#dpkg -i swftools_0.9.0-0ubuntu1_i386.deb

Verify the correct installation.

root@ubuntu:~#whereis pdf2swf

pdf2swf: /usr/bin/pdf2swf /usr/share/man/man1/pdf2swf.1.gz

Tomcat Installation.

Download the Tomcat 6 from http://tomcat.apache.org/download-60.cgi and unpack Tomcat.

root@ubuntu:~#cd /opt/
root@ubuntu:/opt#wget http://mirror.nyi.net/apache/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz

Give Execute Permission and Extract.

root@ubuntu:/opt#chmod a+x apache-tomcat-6.0.35.tar.gz
root@ubuntu:/opt#tar -xvf apache-tomcat-6.0.35.tar.gz

Rename apache-tomcat-6.0.35 to tomcat, and move it to where it should.

root@ubuntu:/opt#mv apache-tomcat-6.0.35 /opt/alfresco40c/tomcat

Verify, Tomcat is installed correctly, let’s start Tomcat.

root@ubuntu:/opt#cd /opt/alfresco40c/tomcat/bin
root@ubuntu:/opt/alfresco40c/tomcat/bin#./startup.sh

Using CATALINA_BASE: /opt/alfresco40c/tomcat
Using CATALINA_HOME: /opt/alfresco40c/tomcat
Using CATALINA_TMPDIR: /opt/alfresco40c/tomcat/temp
Using JRE_HOME: /opt/java/
Using CLASSPATH: /opt/alfresco40c/tomcat/bin/bootstrap.jar

And check a process that running contains ‘java’ in its signature.

root@ubuntu1:/opt/alfresco40c/tomcat/bin#ps -ef |grep java

root 7156 1 2 12:12 pts/0 00:00:02 /opt/java//bin/java
-Djava.util.logging.config.file=/opt/alfresco40c/tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/opt/alfresco40c/tomcat/endorsed -classpath
/opt/alfresco40c/tomcat/bin/bootstrap.jar
-Dcatalina.base=/opt/alfresco40c/tomcat
-Dcatalina.home=/opt/alfresco40c/tomcat
-Djava.io.tmpdir=/opt/alfresco40c/tomcat/temp
org.apache.catalina.startup.Bootstrap start

root 7174 908 0 12:14 pts/0 00:00:00 grep –color=auto java

Done, that works. Now,  shutdown Tomcat.

root@ubuntu:/opt/alfresco40c/tomcat/bin#./shutdown.sh

Using CATALINA_BASE: /opt/alfresco40c/tomcat
Using CATALINA_HOME: /opt/alfresco40c/tomcat
Using CATALINA_TMPDIR: /opt/alfresco40c/tomcat/temp
Using JRE_HOME: /opt/java/
Using CLASSPATH: /opt/alfresco40c/tomcat/bin/bootstrap.jar

Verify.

root@ubuntu:~#ps -ef | grep java

root 7201 908 0 12:21 pts/0 00:00:00 grep –color=auto java

There is no process running that contains ‘java’ Good.

Add additional folders for use with Alfresco.

root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared/classes
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared/lib
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/endorsed

Edit Tomcat’s catalina.properties to tell Tomcat to actually use the added directories under ‘tomcat/shared’.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/conf/catalina.properties

Change the value of the shared.loader=property to the following:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

Save and Exit.
By default,Tomcat uses ISO-8859-1 character encoding when decoding URLs that are received from a browser. This may cause problems when creating, uploading, and renaming files with international characters. Edit the server.xml file.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/conf/server.xml

Locate the Connector section, and then add the URIEncoding=”UTF-8″ property.

<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8"
connectionTimeout="20000" redirectPort="8443" >

Save and Exit.
Download the JDBC driver belonging to MySQL instance. http://www.mysql.com/downloads/connector/j/

Give Execute Permission and Extract the archive.

root@ubuntu:~#chmod a+x mysql-connector-java-5.1.18.tar.gz
root@ubuntu:~#tar -xvf mysql-connector-java-5.1.18.tar.gz

Copy the driver to Tomcat.

root@ubuntu:~#cp mysql-connector-java-5.1.18/mysql-connector-java-5.1.18-bin.jar /opt/alfresco40c/tomcat/lib

Download Alfresco Community Edition.
Download the Alfresco-community-4.0.c.zip from:https://process.alfresco.com/ccdl/?file=release/community/build-3979/alfresco-community-4.0.c.zip

root@ubuntu:~#wget http://dl.alfresco.com/release/community/build-3979/alfresco-community-4.0.c.zip

Give Execute Permission and Unzip the archive.

root@ubuntu:~#chmod a+x alfresco-community-4.0.c.zip
root@ubuntu:~#apt-get install unzip
root@ubuntu:~#unzip alfresco-community-4.0.c.zip

This will give you 3 folders; licenses, bin and web-server. Distribute as follows.

root@ubuntu:~#mv bin /opt/alfresco40c/
root@ubuntu:~#mv licenses /opt/alfresco40c/
root@ubuntu:~#mv web-server/endorsed/* /opt/alfresco40c/tomcat/endorsed
root@ubuntu:~#mv web-server/shared/* /opt/alfresco40c/tomcat/shared
root@ubuntu:~#mv web-server/lib/* /opt/alfresco40c/tomcat/lib
root@ubuntu:~#mv web-server/webapps/* /opt/alfresco40c/tomcat/webapps/

Create a folder to store database scripts.

root@ubuntu:~#mkdir /opt/alfresco40c/extras

Create the sql-script to create a database.

root@ubuntu:~#vi /opt/alfresco40c/extras/db_setup.sql

This file has the contents.

create database alfresco default character set utf8 collate utf8_bin;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;

Create the sql-script to drop the database.

root@ubuntu:~#vi /opt/alfresco40c/extras/db_remove.sql

This file has the contents:

drop database alfresco;
revoke all privileges, grant option from 'alfresco'@'localhost';
drop user 'alfresco'@'localhost';
root@ubuntu:~#mysql -u root -p < /opt/alfresco40c/extras/db_setup.sql

You need your root password after executing above script.

Now Create a file to start Alfresco.

root@ubuntu:~#vi /opt/alfresco40c/alfresco.sh

Fill below code in alfresco.sh.

#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
ALF_HOME=/opt/alfresco40c
cd "$ALF_HOME"
APPSERVER="${ALF_HOME}/tomcat"
export CATALINA_HOME="$APPSERVER"
# Set any default JVM values
#export JAVA_OPTS='-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m -server'
export JAVA_OPTS='-Xms512m -Xmx768m -Xss768k -XX:MaxPermSize=256m -XX:NewSize=256m -server'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME} -Dcom.sun.management.jmxremote"
#
if [ "$1" = "start" ]; then
"${APPSERVER}/bin/startup.sh"
# if [ -r ./virtual_start.sh ]; then
# sh ./virtual_start.sh
# fi
# if [ -r ./start_oo.sh ]; then
# sh ./start_oo.sh
# fi
elif [ "$1" = "stop" ]; then
"${APPSERVER}/bin/shutdown.sh"
# if [ -r ./virtual_start.sh ]; then
# sh ./virtual_stop.sh
# fi
# if [ -r ./start_oo.sh ]; then
# killall soffice.bin
# fi
fi

Give execute permission to the script.

root@ubuntu:~#chmod ug+x /opt/alfresco40c/alfresco.sh

Now we need valid alfresco-global.properties, we should be able to start and stop Alfresco.

root@ubuntu:~#cd /opt/alfresco40c
root@ubuntu1:/opt/alfresco40c#./alfresco.sh start

OR

root@ubuntu1:/opt/alfresco40c#./alfresco.sh stop

Check if your action was successful by validating if the process is running (or has stopped. Remind, stopping Alfresco might take a while).

root@ubuntu:~#ps -ef |grep java

root 7710 1 99 15:24 pts/0 00:02:37 /opt/java//bin/java
-Djava.util.logging.config.file=/opt/alfresco40c/tomcat/conf/logging.properties
-Xms512m -Xmx768m -Xss768k -XX:MaxPermSize=256m -XX:NewSize=256m -server
-Dalfresco.home=/opt/alfresco40c -Dcom.sun.management.jmxremote
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/opt/alfresco40c/tomcat/endorsed -classpath
/opt/alfresco40c/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/alfresco40c/tomcat
-Dcatalina.home=/opt/alfresco40c/tomcat
-Djava.io.tmpdir=/opt/alfresco40c/tomcat/temp
org.apache.catalina.startup.Bootstrap start

root 7736 908 0 15:26 pts/0 00:00:00 grep –color=auto java

Alfresco-global.properties

alfresco-global.properties may look like store in tomcat/shared/classes/alfresco-global.properties.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/shared/classes/alfresco-global.properties

This file has the contents.

###############################
 Common Alfresco Properties
###############################
 #
 # Sample custom content and index data location
 #
 dir.root=/opt/alfresco40c/alf_data
 #
 # Sample database connection properties
 #
 db.name=alfresco
 db.username=alfresco
 db.password=alfresco
 db.host=localhost
 db.port=3306
 #
 # External locations
 #-------------
 ooo.exe=/usr/bin/soffice
 ooo.enabled=true
 jodconverter.officeHome=/usr/lib/libreoffice
 jodconverter.portNumbers=8101
 jodconverter.enabled=true
 img.root=/usr
 swf.exe=/usr/bin/pdf2swf
 ffmpeg.exe=/usr/bin/ffmpeg
 #
 # 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.
 #
 db.schema.update=true
 #
 # MySQL connection
 #
 db.driver=org.gjt.mm.mysql.Driver
 db.url=jdbc:mysql://${db.host}:${db.port}/${db.name}
 #db.driver=org.gjt.mm.mysql.Driver
 #db.url=jdbc:mysql://localhost/alfresco340?useUnicode=yes& amp;characterEncoding=UTF-8
 # ALTER DATABASE alfresco SET ALLOW_SNAPSHOT_ISOLATION ON;
 #
 #db.driver=net.sourceforge.jtds.jdbc.Driver
 #db.url=jdbc:jtds:sqlserver://localhost:1433/alfresco
 #db.txn.isolation=4096
 #PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
 #db.driver=org.postgresql.Driver
 #db.url=jdbc:postgresql://localhost:5432/alfresco

 # Index Recovery Mode
 #-------------
 index.recovery.mode=AUTO

 # Outbound Email Configuration
 #-------------
 #mail.host=
 #mail.port=25
 #mail.username=anonymous
 #mail.password=
 #mail.encoding=UTF-8
 #mail.from.default=alfresco@alfresco.org
 #mail.smtp.auth=false
 #
 # Alfresco Email Service and Email Server
 #-------------
 # Enable/Disable the inbound email service. The service could be used by processes other than
 # the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
 #-------------
 #email.inbound.enabled=true
 # Email Server properties
 #-------------
 #email.server.enabled=true
 #email.server.port=25
 #email.server.domain=alfresco.com
 #email.inbound.unknownUser=anonymous
 # A comma separated list of email REGEX patterns of allowed senders.
 # If there are any values in the list then all sender email addresses
 # must match. For example:
 # .*@alfresco.com, .*@alfresco.org
 # Allow anyone:
 #-------------
 #email.server.allowed.senders=.*
 #
 # The default authentication chain
 # To configure external authentication subsystems see:
 # http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems
 #-------------
 authentication.chain=alfrescoNtlm1:alfrescoNtlm
 # The password for the default principal (only used for LDAP sync)
 #ldap.synchronization.java.naming.security.credentials=secret
 #
 # URL Generation Parameters (The ${localname} token is replaced by the local server name)
 #-------------
 #alfresco.context=alfresco
 #alfresco.host=${localname}
 #alfresco.port=8080
 #alfresco.protocol=http
 #
 #share.context=share
 #share.host=${localname}
 #share.port=8080
 #share.protocol=http
 cifs.enabled=true
 ftp.enabled=true
 cifs.serverName=${localname}
 cifs.hostannounce=true
 imap.server.enabled=false
 #imap.server.port=143
 #imap.server.host=
 # Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'.
 # This allows connections to JMX both remotely and locally.
 #
 alfresco.rmi.services.host=0.0.0.0
 #
 # RMI service ports for the individual services.
 # These seven services are available remotely.
 # Assign individual ports for each service for best performance
 # or run several services on the same port. You can even run everything on 50500 if needed.
 # Select 0 to use a random unused port.
 #avm.rmi.service.port=50501
 #avmsync.rmi.service.port=50502
 #attribute.rmi.service.port=50503
 #authentication.rmi.service.port=50504
 #repo.rmi.service.port=50505
 #action.rmi.service.port=50506
 #wcm-deployment-receiver.rmi.service.port=50507
 #monitor.rmi.service.port=50508

Stop and start Alfresco:

root@ubuntu1:/opt/alfresco40c#./alfresco.sh stop
root@ubuntu1:/opt/alfresco40c#./alfresco.sh start

Now, It’s Time To Check alfresco and share pages in the browser.

http://your_ipaddress:8080/share
http://your_ipaddress:8080/alfresco

See, if your installation was successful!

Default Login Details For alfresco and share:-
Default username=admin
Default password=admin

Convert CRLF to LF line endings recursively

Friday, January 20th, 2012

dos2unix utility converts a file from dos to unix format, i.e replaces CRLF line endings to LF line endings.

This utility can be installed on any *nix environment using apt, yum, ports, etc.

To install on Mac:

sudo port -d selfupdate
sudo port install dos2unix

To install on Debian/Ubuntu/Mint:

apt-get install dos2unix

To run this utility recursively in a directory (excluding subdirectories) cd to the directory and then run following command:

find . -name *.* -exec dos2unix {} ;

To run this utility recursively (including subdirectories) cd to the directory and then run following command:

for file in `find . -type f`; do dos2unix $file $file; done
  • © 2004-2015 Special Work & Technology Limited