Wednesday, January 25, 2012

12 Steps to Install and Configure Alfresco on UNIX / Linux


Alfresco is the best open source content management system. This has a rock solid document management foundation, with several functionality built on top of it. Alfresco provides web based content management, collaboration platform, Content Management Interoperability Services (CMIS), records management and image management.
Alfresco has enterprise edition and free community edition.  See the difference between themhere. If you have an in-house IT team, just go with the Alfresco community edition. It is straight-forward to install and configure Alfresco.
In this article, let us review how to install and configure alfresco community edition on UNIX / Linux platform using 12 easy steps.

1. Install Alfresco Community Tomcat Bundle

Download Alfresco from the community edition download page.
# cd ~

# wget -O alfresco-community-tomcat-3.3.tar.gz http://dl.alfresco.com/release/community/build-2765/alfresco-community-tomcat-3.3.tar.gz?dl_file=release/community/build-2765/alfresco-community-tomcat-3.3.tar.gz

# mkdir /opt/alfresco/

# cd /opt/alfresco/

# tar xvfz ~/alfresco-community-tomcat-3.3.tar.gz

2. Modify Alfresco Global Properties

alf_data parameter identifies the location of alfresco data store, where all the documents will be stored. Make sure this is pointing to an absolute path as shown below. Initially this directory will not be present. This alf_data directory will be created when we start the alfresco for the 1st time.
# vi /opt/alfresco/tomcat/shared/classes/alfresco-global.properties
dir.root=/opt/alfresco/alf_data

# ls -l /opt/alfresco/alf_data
ls: /opt/alfresco/alf_data: No such file or directory

3. Verify MySQL connector is installed

Just double-check to make sure the mysql connector is installed in the proper location, as shown below.
# ls -l /opt/alfresco/tomcat/lib/mysql-connector-java-5.1.7-bin.jar
-rwxr-xr-x 1 root root 709922 Jan 12 11:59 /opt/alfresco/tomcat/lib/mysql-connector-java-5.1.7-bin.jar

4. Create the Alfresco MySQL databases

If you don’t have MySQL, install it as using yum groupinstall, or based on LAMP install article, or based on mysql rpm article.
After installing MySQL, create the alfresco database using the db_setup.sql script as shown below.
# cd /opt/alfresco/extras/databases/mysql

# mysql -u root -p 

5. Verify that Alfresco MySQL databases got created

# mysql -u root -p
Enter password:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| alfresco           |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql>

6. Update the db.url in the global property files

Update the db.url parameter in the alfresco-global.properties file to point to localhost:3306 as shown below.
# vi /opt/alfresco/tomcat/shared/classes/alfresco-global.properties
db.url=jdbc:mysql://localhost:3306/alfresco

7. Start Alfresco Server

Start the alfresco server. This will start the tomcat application server that was bundled with the alfresco.
# cd /opt/alfresco

# ./alfresco.sh start
Using CATALINA_BASE:   /opt/alfresco/tomcat
Using CATALINA_HOME:   /opt/alfresco/tomcat
Using CATALINA_TMPDIR: /opt/alfresco/tomcat/temp
Using JRE_HOME:       /usr/java/jdk1.6.0_18
While the alfresco tomcat server is starting up, check the /opt/alfresco/alfresco.log for any possible issues.
When alfresco.sh is executed for the 1st time, it will do some database setup, and you’ll see following messages in the alfresco.log (only the 1st time).
  • Executing database script /opt/alfresco/tomcat/temp/Alfresco/*.sql
  • All executed statements: /opt/alfresco/tomcat/temp/Alfresco/*.sql
  • Applied patch – [org.alfresco.repo.admin.patch.PatchExecuter]
Look for the line in the log file where it says “Alfresco started”, which indicates that Alfresco was started successfully.
Following are few sample lines from alfresco.log.
# tail -f /opt/alfresco/alfresco.log
21:29:25,431 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] Executing database script /opt/alfresco/tomcat/temp/Alfresco/AlfrescoSchema-MySQLInnoDBDialect-Update-3892772511531851057.sql (Copied from classpath:alfresco/dbscripts/create/3.3/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-3.3-RepoTables.sql).
21:29:27,245 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] All executed statements:  /opt/alfresco/tomcat/temp/Alfresco/AlfrescoSchema-MySQLInnoDBDialect-All_Statements-4724137490855924607.sql.
=== Applied patch                 ===
ID: patch.db-V3.0-0-CreateActivitiesExtras
RESULT:
Script completed
=====================================
21:30:03,756 INFO  [org.alfresco.service.descriptor.DescriptorService] Alfresco JVM - v1.6.0_21-b06; maximum heap size 910.250MB
21:30:03,756 INFO  [org.alfresco.service.descriptor.DescriptorService] Alfresco started (Community): Current version 3.3.0 (2765) schema 4009 - Originally installed version 3.3.0 (2765) schema 4009

8. Verify the alf_data directory creation

When you start the alfresco for the 1st time, it will create the alfresco data repository as shown below.
# ls -l /opt/alfresco/alf_data
total 32
drwxr-xr-x 2 root root 4096 Mar 25 16:26 audit.contentstore
drwxr-xr-x 2 root root 4096 Mar 25 16:26 contentstore
drwxr-xr-x 2 root root 4096 Mar 25 16:26 contentstore.deleted
drwxr-xr-x 3 root root 4096 Mar 25 16:26 lucene-indexes

9. Verify that Alfresco Server is Running

Make sure alfresco server is running successfully. View the alfresco.log file to make sure there are no errors.
# ps -ef | grep -i alf
root      9280     1 51 16:25 pts/0    00:00:30 /usr/java/jdk1.6.0_18/bin/java -Xms128m -Xmx512m -XX:MaxPermSize=160m -server -Dalfresco.home=. -Dcom.sun.management.jmxremote -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/opt/alfresco/tomcat/conf/logging.properties -Djava.endorsed.dirs=/opt/alfresco/tomcat/endorsed -classpath :/opt/alfresco/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/alfresco/tomcat -Dcatalina.home=/opt/alfresco/tomcat -Djava.io.tmpdir=/opt/alfresco/tomcat/temp org.apache.catalina.startup.Bootstrap start

# tail -f /opt/alfresco/alfresco.log

10. Login to Alfresco Explorer or Alfresco Share

Alfresco has two ways to access the application — Alfresco Explorer and Alfresco Share.
Go to http://localhost:8080/alfresco – to launch the Alfresco explorer Go to http://localhost:8080/share – to launch the Alfresco share
Default alfresco administrator uid/pwd is admin/admin. Change it immediately after you login.

11. Change the default password for the alfresco database

Use the mysql update command to change the password for the alfresco user as shown below.
# mysql -u root -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 51
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> UPDATE user SET password=PASSWORD('donttellanybody') WHERE user='alfresco';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql>

12. Modify the configuration file to reflect the new alfresco password.

Update the db.password parameter in the alfresco-global.properties file as shown below.
# vi /opt/alfresco/tomcat/shared/classes/alfresco-global.properties
db.name=alfresco
db.username=alfresco
db.password=donttellanybody
After this, stop/start MySQL database and restart Alfresco Tomcat server. As a final step, make sure to take a backup of alfresco mysql database using mysqldump or mysqlhotcopyand /opt/alfresco directory.
# service mysqld restart

# /opt/alfresco/alfresco.sh stop

# /opt/alfresco/alfresco.sh start