Installing Alfresco Community WAR on Centos 5

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



THIS IS OUT OF DATE FOR VERSION 3.2 AND IS NOT TESTED, thanks.
InstallationCentosLinux


A few important words


This document borrows heavily from an excellent wiki post located at

http://crashcourse.ca/wiki/index.php/Alfresco_on_Fedora_8

My company was looking to install Alfresco on Linux, and the war package had proven to be our preferred method. We had originally considered using the Alfresco package offered by Red Hat Exchange, but the supported version is currently at version 2.0, which, as I understand it, does not include WCM (which we need).

So this is how we got Alfresco up and running on Centos 5, but these instructions should work for most rpm-based distributions.


Getting started


Start with a new clean install of Centos 5, and make sure it is updated with yum:

yum update

Install tomcat5, MySQL, and OpenOffice


(OpenOffice is probably already installed on your system, but running this command with the OpenOffice packages specified will not be an issue)

[root@localhost alfresco]# yum install tomcat5 tomcat5-common-lib tomcat5-jasper \
tomcat5-jsp-2.0-api tomcat5-server-lib tomcat5-servlet-2.4-api openoffice.org-base \
openoffice.org-calc openoffice.org-core openoffice.org-draw openoffice.org-graphicfilter \
openoffice.org-impress openoffice.org-math openoffice.org-writer openoffice.org-xsltfilter \
mysql-server mysql xml-commons-apis wget

Update with yum again:

yum update

Get all software needed for install


Ensure that you are root user.

[root@localhost ~]# cd /opt

[root@localhost opt]# mkdir alfresco

[root@localhost opt]# cd alfresco

[root@localhost alfresco]# wget \
http://superb-west.dl.sourceforge.net/sourceforge/alfresco/alfresco-community-war-2.1.0.tar.gz \
http://superb-west.dl.sourceforge.net/sourceforge/alfresco/alfresco-community-sample-extensions-2.1.0.tar.gz \
http://easynews.dl.sourceforge.net/sourceforge/alfresco/alfresco-community-wcm-2.1.0.tar.gz \
http://mirrors.dotsrc.org/jpackage/1.7/generic/non-free/RPMS/java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm \
http://download.softagency.net/MySQL/Downloads/Connector-J/mysql-connector-java-5.1.5.tar.gz



Note that these last two files are just an easy way to get the SUN Java RPM and MySQL Connector. You may wish to look on the Sun and MySQL websites to find them.


Install JDK 1.6


The best way to install JDK1.6 is to login as root and run this in the shell.

[root@localhost alfresco]# yum install java-1.6.0-openjdk.i386

After this you should be able to have the jdk 1.6 installed.

If this does not work, then fallow the instructions at the button.



First we need to go to Sun and get the Java files:

http://java.sun.com/javase/downloads/index.jsphttp://java.sun.com/javase/downloads/index.jsp

Select Download for JDK 6 Update 6

Select Linux from the Platform drop down list.

Select Agree if you decide too.

Select Continue.

Download this file jdk-6u6-linux-i586-rpm.bin

[root@localhost alfresco]# chmod +x jdk-6u6-linux-i586-rpm.bin

[root@localhost alfresco]# ./jdk-6u6-linux-i586-rpm.bin

You will have to agree to a few things, but it self installs.

[root@localhost alfresco]# rpm –Uvh java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm

You might get the error described below while trying to install java-1.6.0-sun-compat. If you do, get a different JDK version from here http://java.sun.com/products/archive/j2se/6u6/index.htmlhttp://java.sun.com/products/archive/.../index.html and select 'Download' for JDK 6 Update 6:

error: Failed dependencies:
jdk = 2000:1.6.0_06-fcs is needed by java-1.6.0-sun-compat-1.6.0.06-1jpp.i586



To make sure your system is configured to use this latest version of Java by default, run the command:

[root@localhost alfresco]# alternatives --config java

You should see that there are two programs that provide Java.

   Selection    Command

    1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2           /usr/lib/jvm/jre-1.6.0-sun/bin/java

If number 2 has the *+ next to it, you should be fine. There is no need to do anything, just press Enter. If, for some reason, 1 is selected, then type 2 and press Enter.

As a final Java configuration test, you can run:

[root@localhost alfresco]# rpm -qa | grep java

Check to see that java-1.6.0-sun-compat-1.6.0.06-1jpp is listed

[root@localhost alfresco]#rpm -qa | grep java
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
sun-javadb-demo-10.3.1-4.1
java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.112
sun-javadb-common-10.3.1-4.1
sun-javadb-docs-10.3.1-4.1
gcc-java-4.1.2-14.el5
sun-javadb-core-10.3.1-4.1
sun-javadb-javadoc-10.3.1-4.1
sun-javadb-client-10.3.1-4.1
java-1.6.0-sun-compat-1.6.0.06-1jpp

Configuring Tomcat


To configure proper usage of system memory, edit /etc/sysconfig/tomcat5 and add the following to the bottom of the file:

vi /etc/sysconfig/tomcat5

add the following to the bottom of the file:

JAVA_OPTS='$JAVA_OPTS -Xms512m -Xmx512m'

These values seem to work well on our system, which has 2 GB memory.


Unpack Alfresco Community WAR tarball


Un-tar that first WAR bundle tarball, but just leave the sample extensions tarball where it is for now. You will not need it until later.

[root@localhost alfresco]# tar -xzf alfresco-community-war-2.1.0.tar.gz

Creating the Alfresco MySQL database


[root@localhost alfresco]# chkconfig mysqld on

[root@localhost alfresco]# service mysqld start

Make the necessary changes to set your new MySQL admin password, then import the Alfesco database, included in the extras directory.

[root@localhost alfresco]# mysql -u root -p show databases; to make sure the new alfresco database is there.

[root@localhost alfresco]# mysql

mysql> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| alfresco           |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)



mysql> exit

Creating the Alfresco repository


[root@localhost alfresco]# mkdir -p /var/lib/alfresco/alf_data/

[root@localhost alfresco]# chown -R tomcat:tomcat /var/lib/alfresco

Note that is is important that you do the second step.


mysql-connector-java


[root@localhost alfresco]# tar -xzf mysql-connector-java-5.1.5.tar.gz

[root@localhost alfresco]# cd mysql-connector-java-5.1.5

[root@localhost alfresco]# cp mysql-connector-java-5.1.5-bin.jar /usr/share/java/

[root@localhost alfresco]# cd /var/lib/tomcat5/common/endorsed/

[root@localhost alfresco]# rebuild-jar-repository /var/lib/tomcat5/common/endorsed mysql-connector-java-5.1.5-bin.jar

Installing Alfresco under Tomcat


Install the Alfresco .war file under Tomcat:

[root@localhost alfresco]# cd /opt/alfresco/

[root@localhost alfresco]# cp alfresco.war /var/lib/tomcat5/webapps

[root@localhost alfresco]# service tomcat5 start

Starting tomcat5:                                          [  OK  ]

[root@localhost alfresco]# service tomcat5 stop

Stopping tomcat5:                                          [  OK  ]


Modifying the basic Alfresco properties


At this point, un-tar the alfresco-community-sample-extensions-2.1.0.tar.gz into the appropriate Tomcat extensions directory:

[root@localhost alfresco]# cd /var/lib/tomcat5/shared/classes

[root@localhost alfresco]# tar -xzf /opt/alfresco/alfresco-community-sample-extensions-2.1.0.tar.gz

Then rename the primary configuration sample files:

[root@localhost alfresco]# cd /var/lib/tomcat5/shared/classes/alfresco/extension

[root@localhost alfresco]# cp custom-repository-context.xml.sample custom-repository-context.xml

[root@localhost alfresco]# cp custom-repository.properties.sample custom-repository.properties

[root@localhost alfresco]# cp custom-hibernate-dialect.properties.sample custom-hibernate-dialect.properties

Make the following changes:

edit the file custom-repository.properties

vi custom-repository.properties

paste dir.root=/var/lib/alfresco/alf_data under the line #dir.root=/srv/alfresco/data

In the same file (custom-repository.properties) make sure you uncomment the following lines:



db.username=alfresco
db.password=alfresco (change this to your own custom password)
db.pool.initial=10
db.pool.max=100
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco

Edit the file custom-hibernate-dialect.properties and ensure the only line uncommented is this one:



hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

Then, go back into your MySQL database and run the following command:

[root@localhost alfresco]# mysql

mysql> set password for 'alfresco'@'localhost' = PASSWORD('newpassword');  

Note that this is the password you just edited in custom-repository.properties.

Quit out of MySQL:

mysql> exit

cd /var/lib/tomcat5/webapps/alfresco/WEB-INF/classes

Edit the file log4j.properties:

vi log4j.properties

Under ###### File appender definition ####### be sure to insert the line:

log4j.appender.File.File=/var/log/tomcat5/alfresco.log

Start Tomcat


[root@localhost alfresco]# chkconfig tomcat5 on

[root@localhost alfresco]# service tomcat5 start

Firewall settings


In the Centos 5 GUI, you need to change the firewall settings to open TCP port 8080.

You can also do this by editing iptables from the command line, but using the GUI seemed to work better for some reason.

You may need to restart the system. I was doing some troubleshooting post-install, and everything worked fine after the restart. Correlation is not causation, and you should not have to restart the machine, but if the install is not working, you might want to try it.

You should now be able to see the Alfresco start page by navigating to:

http://serverIP:8080/alfresco/

Login: admin
Password:  admin


Add WCM Component


[root@localhost alfresco]# service tomcat5 stop

[root@localhost alfresco]# mkdir wcm

[root@localhost alfresco]# cd wcm

[root@localhost alfresco]# tar -zxvf ../alfresco-community-wcm-2.1.0.tar.gz

[root@localhost alfresco]#  cp wcm-bootstrap-context.xml /var/lib/tomcat5/shared/classes/alfresco/extension/

[root@localhost alfresco]# service tomcat5 start

Attachments

    Outcomes