Tuesday, December 29, 2009

Liferay Installation

What is Liferay? This question is in my head when first time my employer ask me. I never really know about liferay, even i just hear it?
After few days browse and search for information on the net then i recognize liferay. Again, this is my first time in enterprise development and web development?

This is my summary about liferay.
Liferay is an open source portal base on java. Liferay has great CMS, Social Networking Feature. Etc.,

This not all about liferay, but since i read and knowing liferay i have a lot of time working on it and still no good progress. For more documentation visit www.liferay.com or you can download from link at the end this article.


Liferay installation.


Before running liferay in our PC or Laptop, we need to customize our PC or Laptop. There is required tools for running liferay. Ant, Jikes, JDK. When we finish install this tools on our PC then we need to set Environment Variable on Windows.
Just point to My Computer on windows Explorer then Right Click> Properties.
On advance tab, click on Environment Variabel
Create new Variabel Name it JAVA_HOME and value is your JDK Installation Path. Do this for Ant and Jikes.
Download liferay-tomcat-bundled 5.2.3 from liferay site and extract it to some directory. I prefer my self to /bundled/liferay. (For Bundled Version, because on development we will use external tomcat)
Create CATALINA_HOME on Environment variabel and value is your /project/liferay/tomcat
After all installation finish, now run startup.bat on your tomcat/bin folder it’s should automatically run liferay on your browser. Use test@liferay.com as username and test as password then you can explore liferay.
For development, liferay suggested to develop under plugin SDK or under Ext Environment and do not develop directly on portal source code directly.
Building Extension Environment on external tomcat.
After try to build ext environment on external tomcat and always failed. Finally i solved my problem and succed to build ext environment on external tomcat.
Why use external tomcat? I want to learn how to configure and want to know more and more about liferay even until i write this arcticle my knowledge not improve much. But i’m sure i’m getting closer to Liferay development.  ok, let’s get started :
First we need to download liferay 5.2.3 src and extract to /project/liferay/portal.
Apache tomcat-6.0.18, extract and put into /project/liferay/apache-tomcat
Delete ROOT directory on /project/liferay/apache-tomcat/webapps so liferay can deploy to this directory. If we not delete this directory then liferay would not deploy.
We need to create properties file. Again, liferay not allowed to edit directly to properties file. So we need create new properties file that will override original file on build process.
Create app.server.{username}.properties and add this line :
app.server.type=tomcat
app.server.tomcat.dir=${Liferay_Home}/apache-tomcat-6.0.18

create release.{username}.properties, this will override release.properties
add this line : lp.ext.dir:${Liferay_Home}/ext
this mean that liferay will create new folder named as ext into liferay home and create all resources needed for development.
Build ext environment using ant, here is the command : Ant Start Build-ext.
Wait for building process, after finished you can see ext folder on your explorer.
To run Liferay from our ext environment we need to deploy into tomcat server.
Setup database (MySQL database).
Download MySQL and JDBC Connector for MySQL. I use MySQL 5.1.41 because older version not running on my windows 7 Ultimate RC.
Create app.server.{username}.properties or we can copy from portal directory.
First we create database new database in MySQL e.g OurDatabase
In portal-ext.properties, add this :

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/”ourdatabase”?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=”ourusername”
jdbc.default.password=”ourpassword”


you can find this files in ext-impl/src directory if not, you can create this file by your self.
Open command prompt and change directory to our ext. Type ant clean deploy.

Wait until finish and on tomcat/bin directory run startup.bat or from command prompt point to our tomcat directory and type startup



On your browser at http://localhost:8080/ we will see liferay homepage just login with test@liferay and test as username and password.