Views
Installing Alfresco Community 3.2 WAR on Centos 5.3
From alfrescowiki
A few important words
This document borrows heavily from an excellent wiki post located at the following url:
http://wiki.alfresco.com/wiki/Installing_Alfresco_Community_WAR_on_Centos_5
Thanks goes to:
- Alfresco team for creating Alfresco and opensourcing the project; and
- the original group of wiki contributors, whom made this revision possible.
Getting started
Caution! The following instructions require root access. Please be cognizant that you could negatively affect your system due to inadvertent commands. Mind what you type!!
Start with a new clean install of Centos 5, and make sure it is updated with yum:
user@localhost:~> sudo yum update
Install tomcat5, MySQL, and OpenOffice
Some packages may already be installed on your system, but proceeding with this section should not present a problem. It should skip already installed packages gracefully.
Install the required underlying packages with the following command:
user@localhost:~> sudo 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
Remove the openjdk and openjdk-devel packages with the following command:
user@localhost:~> sudo rpm -e java-1.6.0-openjdk java-1.6.0-openjdk-devel
Update your system again with the following command:
user@localhost:~> sudo yum update
Get all the main packages needed for installation
Make the working directory with the following command:
user@localhost:~> cd /opt
user@localhost:/opt> sudo mkdir alfresco
user@localhost:/opt> cd alfresco
Download the required main packages into the working directory with the following command:
user@localhost:/opt/alfresco> sudo wget \ http://dl.alfresco.com/release/community/build-2039/alfresco-community-war-3.2.tar.gz \ http://dl.alfresco.com/release/community/build-2039/alfresco-community-sample-extensions-3.2.tar.gz \ http://dl.alfresco.com/release/community/build-2039/alfresco-community-wcm-3.2.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 packages are just an easy way to get the Sun Java package; as well as the MySQL connector required for MySQL database use. You may choose to download the appropriate packages from their respective sources. If so, navigate to the Sun and MySQL sites and do so.
Install JDK 1.6
Navigate to the Sun site and acquire the java binary package. To do so, proceed with the following procedure:
- In your web browser of choice, navigate to the following url: http://java.sun.com/javase/downloads/index.jsp[1]
- Select Download for JDK 6 Update 6.
- Select Linux from the Platform drop down list.
- Select Agree to proceed.
- Select Continue.
- Proceed with downloading the file named: jdk-6u6-linux-i586-rpm.bin
Now, set the execution bit and proceed to execute the acquired java binary package with the following commands:
user@localhost:/opt/alfresco> sudo chmod +x jdk-6u6-linux-i586-rpm.bin user@localhost:/opt/alfresco> sudo ./jdk-6u6-linux-i586-rpm.bin
You will be presented with a few questions. Answer accordingly. The binary package will install various java packages for you.
Install the compatibility package to ease use of your new installation of the sun java packages with the following command:
user@localhost:/opt/alfresco> sudo rpm –Uvh java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm
You may receive the following error on stderr while attempting to install java-1.6.0-sun-compat:
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
If so, navigate to the following url and acquire a different JDK version: http://java.sun.com/products/archive/j2se/6u6/index.html[2]. Proceed to download this particular java binary package in the same manner as the procedure stated previously.
To make sure your system is configured to use this latest version of Java by default, run the command:
user@localhost:/opt/alfresco> sudo alternatives --config java
You should see that there are two or more java installations. The "+" character indicates the selected java installation for use in your system at this time.
Selection Command
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-sun/bin/java
Select the sun java installation by means of the appropriate numeric digit located at the left most extent of your terminal. If the sun java installation is already chosen, then simply press Enter.
To ensure that all the neccessary java packages have been successfully installed, proceed with the following command:
user@localhost:/opt/alfresco> sudo rpm -qa | grep java
You should be presented with output similiar to the following:
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 -XX:MaxPermSize=256M"
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-3.2.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 < ./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
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 ]
Extract Alfresco Extensions
At this point, un-tar the alfresco-community-sample-extensions-3.2.tar.gz into the appropriate Tomcat extensions directory:
[root@localhost alfresco]# cd /var/lib/tomcat5/shared/classes
[root@localhost classes]# tar -xzf /opt/alfresco/alfresco-community-sample-extensions-3.2.tar.gz
Modifying the basic Alfresco properties
Then rename the primary configuration sample files:
[root@localhost alfresco]# mv /var/lib/tomcat5/webapps/alfresco/WEB-INF/classes/alfresco-global.pro perties.sample /var/lib/tomcat5/webapps/alfresco/WEB-INF/classes/alfresco-global.properties
edit the file alfresco-global.properties
vi alfresco-global.properties
In the same file (alfresco-global.properties) make sure you uncomment the following lines:
dir.root=/var/lib/alfresco/alf_data db.username=alfresco db.password=alfresco db.driver=org.gjt.mm.mysql.Driver db.url=jdbc:mysql://localhost/alfresco
Copy file to tomcat share library directory
cp /var/lib/tomcat5/webapps/alfresco/WEB-INF/classes/alfresco-global.properties /var/lib/tomcat5/shared/classes/alfresco-global.properties
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 alfresco-global.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 wcm]# tar -zxvf ../alfresco-community-wcm-3.2.tar.gz
[root@localhost wcm]# cp wcm-bootstrap-context.xml /var/lib/tomcat5/shared/classes/alfresco/extension/
[root@localhost wcm]# service tomcat5 start