In this blog we will talk about how to install liferay on existing Tomcat 7. For this section, we will refer to your Tomcat server’s installation location as $TOMCAT_HOME
. If you do not already have an existing Tomcat server, we recomend you download a Liferay/Tomcat bundle fromhttp://www.liferay.com/downloads/liferay-portal/available-releases. If you have an existing Tomcat server or would like to install Liferay on Tomcat manually, please follow the steps below.
There are 2 different ways to install Liferay on tomcat.
- Using Source Code
- Using war
First, I am describing here that how we can install liferay on existing tomcat using source code.
Install Liferay using Liferay source code
Before you begin, make sure you have downloaded the latest Liferay source code. If you haven’t downloaded then download from https://www.liferay.com/downloads/liferay-portal/additional-files
(Find “Files for Developers” section and select “Liferay Source for 6.x GA x…”).
After downloading, you will get a liferay-portal-src-6.x.x-ce-ga.x-<date>.zip. Unzip this file.
Now, Let’s start configuring Liferay for Tomcat. Follow these steps:
- Open liferay-portal-src-6.x.x-ce-ga.x-<date> folder.
- Find and Edit app.server.properties file in liferay-portal-src-6.x.x-ce-ga.x folder.
- Find “TOMCAT” section in this file.
## Tomcat
app.server.tomcat.version=7.0.27
app.server.tomcat.dir=${app.server.parent.dir}/tomcat-${app.server.tomcat.version}
app.server.tomcat.bin.dir=${app.server.tomcat.dir}/bin
app.server.tomcat.classes.global.dir=${app.server.tomcat.dir}/lib
app.server.tomcat.classes.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/classes
app.server.tomcat.deploy.dir=${app.server.tomcat.dir}/webapps
app.server.tomcat.lib.endorsed.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/lib
app.server.tomcat.lib.support.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.log.dir=${app.server.tomcat.dir}/logs
app.server.tomcat.portal.context=ROOT
app.server.tomcat.portal.dir=${app.server.tomcat.deploy.dir}/${app.server.tomcat.portal.context}
app.server.tomcat.temp.dir=${app.server.tomcat.dir}/temp
app.server.tomcat.work.dir=${app.server.tomcat.dir}/work
app.server.tomcat.zip.name=apache-tomcat-${app.server.tomcat.version}.zip
app.server.tomcat.zip.url=http://archive.apache.org/dist/tomcat/tomcat-7/v${app.server.tomcat.version}/bin/${app.server.tomcat.zip.name}
4. Now Change some parameters in this section.
e.g. I am installing liferay to tomcat7.0.42 and my $TOMCAT_HOME is “D:/Liferay-Tomcat7/apache-tomcat-7.0.42/apache-tomcat-7.0.42”. So, after editing app.server.properties file, tomcat section would be:
## Tomcat
app.server.tomcat.version=7.0.42
app.server.tomcat.dir= D:/Liferay-Tomcat7/apache-tomcat-7.0.42/apache-tomcat-7.0.42
app.server.tomcat.bin.dir=${app.server.tomcat.dir}/bin
app.server.tomcat.classes.global.dir=${app.server.tomcat.dir}/lib
app.server.tomcat.classes.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/classes
app.server.tomcat.deploy.dir=${app.server.tomcat.dir}/webapps
app.server.tomcat.lib.endorsed.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.portal.dir=${app.server.tomcat.portal.dir}/WEB-INF/lib
app.server.tomcat.lib.support.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.log.dir=${app.server.tomcat.dir}/logs
app.server.tomcat.portal.context=ROOT
app.server.tomcat.portal.dir=${app.server.tomcat.deploy.dir}/${app.server.tomcat.portal.context}
app.server.tomcat.temp.dir=${app.server.tomcat.dir}/temp
app.server.tomcat.work.dir=${app.server.tomcat.dir}/work
app.server.tomcat.zip.name=apache-tomcat-${app.server.tomcat.version}.zip
app.server.tomcat.zip.url=http://archive.apache.org/dist/tomcat/tomcat-7/v${app.server.tomcat.version}/bin/${app.server.tomcat.zip.name}
5. Make sure that your $TOMCAT_HOME path is correct. Using this Configuration, Liferay would be installed in ROOT folder of tomcat. Because value of app.server.tomcat.portal.context is ROOT.
6. Now Open command prompt with ADMINISTRATOR permission and go to your liferay-portal-src-6.x.x-ce-ga.x-<date>/ liferay-portal-src-6.x.x-ce-ga.x folder.Enter ant –f buildfile-dist.xml all
8. Now, Edit $TOMCAT_HOME/conf/catalina.properties file. Change this line
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
TO
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
9. It will take some time to build and deploy Liferay on tomcat. See command prompt, you will get BUILD SUCCESSFUL message in last
Congrats!!!! You have installed liferay on tomcat. Open Browser, and enter:
localhost:8080
You will see Liferay Home Page.
NOTE: To Build Liferay, You should have ANT environment in your machine. If you don’t have, download it from https://ant.apache.org/bindownload.cgi. If you download zip, unzip it in C:/Program Files/Ant/ folder. (You can unzip at your convenient location in C drive). Now, add “Environment Variables” in your computer. Add ANT_HOME in “System Variables” and paste your installed ANT folder path in ANT_HOME value.
Now, add one more environment variable, ANT_OPTS (to assign some memory for ANT).
Now, you have completed ANT configuration. But, to build Liferay, you need to copy one jar in $ANT_HOME/lib folder. Jar name is ecj.jar. You can find this jar in your liferay-portal-src-6.x.x-ce-ga.x-<date>/ liferay-portal-src-6.x.x-ce-ga.x/lib/development folder.
Deploy Liferay in another Context
- Follow above mentioned steps. Just change this line in app.server.properties file:app.server.tomcat.portal.context=liferay [I am installing liferay to LIFERAY context]
- After deploying liferay, go to $TOMCAT_HOME/webapps/liferay/WEB-INF/classes/ folder and create portal-ext.properties file and this in portal-ext.properties file. portal.ctx=/liferay
- Open Browser and enter: localhost:8080/liferay
- Next, We will discuss to deploy Liferay war on tomcat.
Sharad Sinha
Best Open Source Business Intelligence Software Helical Insight is Here