Installing Liferay 6.1.1 on CentOS 6.2

This guide will show how to install Liferay 6.1.1 onto CentOS 6.2. Assumption is, that the mimimum version of CentOS 6.2 is installed and updated.

1. Install VMWare Tools if required (check the other article for that)

2. Install the latest JDK as rpm. Download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html . In my example, I have used JDK 7u6 64bit and copied it to /root
cd /root
rpm -Uvh jdk-7u6-linux-x64.rpm
java -version # verify if you see the correct Java version

3. Install the latest Apache Tomcat. Download it from http://tomcat.apache.org/download-70.cgi . In my example, I used Core 7.0.29 tar.gz and copied it to /usr/share
cd /usr/share
wget http://mirror.arcor-online.net/www.apache.org/tomcat/tomcat-7/v7.0.29/bin/apache-tomcat-7.0.29.tar.gz
tar -xzf apache-tomcat-7.0.29.tar.gz
mv apache-tomcat-7.0.29 tomcat
cd /etc/init.d
vi tomcat

Now copy the code below into the tomcat startup script:

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/tomcat

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)   
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac    
exit 0

 

#continue with these commands
chmod 755 tomcat
chkconfig --add tomcat
chkconfig --level 234 tomcat on
# don't forget to open the relevant firewall port!

 

Install liferay

 


download war, dependencies,

#wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip
cd temp
wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-6.1.1-ce-ga2-20120731132656558.war
unzip liferay-portal-6.1.1-ce-ga2-20120731132656558.war
rm /usr/share/tomcat/webapps/ROOT -Rf
mkdir /usr/share/tomcat/webapps/ROOT
cp -R * /usr/share/tomcat/webapps/ROOT
cd ..
wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip
wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-dependencies-6.1.1-ce-ga2-20120731132656558.zip
wget http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.21.tar.gz/from/http://cdn.mysql.com/
wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip


yum install -y unzip

#unzip liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip
unzip liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip
unzip liferay-portal-dependencies-6.1.1-ce-ga2-20120731132656558.zip
tar -xf mysql-connector-java-5.1.21.tar.gz
unzip jta-1_1-classes.zip

mkdir /usr/share/tomcat/lib/ext
cp liferay-portal-dependencies-6.1.1-ce-ga2/* /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/activation.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/jms.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/jta.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/jutf7.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/mail.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/persistence.jar /usr/share/tomcat/lib/ext
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/portal/ccpp.jar /usr/share/tomcat/lib/ext
cp /root/mysql-connector-java-5.1.21/mysql-connector-java-5.1.21-bin.jar /usr/share/tomcat/lib/ext

vi /usr/share/tomcat/bin/setenv.sh

JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"

vi /usr/share/tomcat/conf/Catalina/localhost/ROOT.xml

<Context path="" crossContext="true">

<!-- JAAS -->

<!--<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
/>-->

<!--
Uncomment the following to disable persistent sessions across reboots.
-->

<!--<Manager pathname="" />-->

<!--
Uncomment the following to not use sessions. See the property
"session.disabled" in portal.properties.
-->

<!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->
</Context>

vi /usr/share/tomcat/conf/catalina.properties #replace the line:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

#with:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/*.jar

#This allows Catalina to access the dependency jars you extracted to $TOMCAT_HOME/lib/ext.

vi /usr/share/tomcat/conf/server.xml # add the attribute URIEncoding="UTF-8" to your connector on port 8080. Below is an example of specifying this encoding on the connector:

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


# on new server:
mkdir /usr/share/tomcat/temp/liferay/com/liferay/portal/deploy/dependencies
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/resin.jar /usr/share/tomcat/temp/liferay/com/liferay/portal/deploy/dependencies
cp /root/liferay-portal-src-6.1.1-ce-ga2/lib/development/script-10.jar /usr/share/tomcat/temp/liferay/com/liferay/portal/deploy/dependencies