Installing Alfresco Community WAR on Centos 5
From AlfrescoWiki
[edit] A Few Important Words
It should be made clear that 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.
[edit] Note
PLEASE feel free to edit or expand on what is written here.
[edit] Here we go
Start with a new clean install of Centos 5, and make sure it's updated with yum.
yum update
[edit] Install tomcat5 and MySQL and OpenOffice
(OpenOffice is probably already installed on your system, but running this command with the openoffice packages specified won't hurt)
[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
Just to check
yum update
[edit] Get All Software Needed for Install
become root
[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
(please note: these last 2 files are just an 'easy' way to get the SUN Java RPM and MySQL Connector -- you are also free to poke around on the Sun and MySQL websites to find them)
[edit] Install JDK 1.6
First we need to go to Sun and get the Java files:
http://java.sun.com/javase/downloads/index.jsp[1]
Select "Download" for:
JDK 6 Update 6
Select from the Platform drop down list:
Linux
Select "Agree" if you decide too:
Agree
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
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:
There are 2 programs which 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 hit enter. If, for some reason, 1 is selected, then type 2 and 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
[edit] 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.
[edit] 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 won't need it until later.
[root@localhost alfresco]# tar -xzf alfresco-community-war-2.1.0.tar.gz
[edit] 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 < ./extras/databases/mysql/db_setup.sql
If you want to verify that the database was created properly, you can always jump into MySQL and run "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
[edit] Creating the Alfresco repository
[root@localhost alfresco]# mkdir -p /var/lib/alfresco/alf_data/
[root@localhost alfresco]# chown -R tomcat:tomcat /var/lib/alfresco
Don't forget that second step -- turns out it's important, or bad things happen later.
[edit] 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
[edit] 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 ]
[edit] 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
Then - get back into your MySQL database and run the following command:
[root@localhost alfresco]# mysql
mysql> set password for 'alfresco'@'localhost' = PASSWORD('newpassword');
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
[edit] Start Tomcat
[root@localhost alfresco]# chkconfig tomcat5 on
[root@localhost alfresco]# service tomcat5 start
[edit] 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 shouldn't have to restart the machine, but if the install isn't 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 Pass: admin
[edit] Ad 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

