Setting up and Configuring a Liferay Portal

Exclusive offer: get 50% off this eBook here
Liferay Portal Enterprise Intranets

Liferay Portal Enterprise Intranets — Save 50%

A practical guide to building a complete corporate intranet with Liferay

$35.99    $18.00
by Jonas X. Yuan | July 2008 | Content Management Java Open Source

Liferay Portal is one of the most mature portal frameworks in the market and offers many benefits. Liferay is backed by a comprehensive professional services network and it offers custom development, training, and support across the world.

As the world's leading open source portal platform, Liferay provides a unified web interface to data and tools scattered across many sources. Within Liferay portal, a portal interface is composed of a number of portlets—self contained interactive elements that are written to a particular standard. Since portlets are developed independently of the portal itself, and loosely coupled with the portal, they are apparently SOA (Service-Oriented Architecture).

Jonas X. Yuan will show how to set up a Liferay portal and then how to configure it.

Setting up Liferay Portal

As an administrator at the enterprise, you need to undertake a lot of administration tasks, such as installing Liferay portal, installing and setting up databases, and so on.

You can install Liferay Portal through different ways, based on your specific needs. Normally, there are three main installation options:

  • Using an open source bundle—It is the easiest and fastest installation method to install Liferay portal as a bundle. By using a Java SE runtime environment with an embedded database, you simply unzip and run the bundle.
  • Detailed installation procedure—You can install the portal in an existing application server. This option is available for all the supported application servers.
  • Using the extension environment—You can use a full development environment to extend the functionality.

We will take up the third installation option "Using the extension environment" in the coming section.

Using Liferay Portal Bundled with Tomcat 5.5 in Windows

First let's consider one scenario when you, as an administrator, need to install Liferay portal in Windows with MySQL database, and your local Java version is JavaSE 5.0. Let's install Liferay portal bundled with Tomcat 5.5 in Windows as follows:

  1. Download Liferay Portal bundled with Tomcat for JDK 5.0 from Liferay official web site.
    • Unzip the bundled file.
    • Set up MySQL database as follows:
      create database liferay;
      grant all on liferay.* to 'liferay'@'localhost' identified by
      'liferay' with grant option;
      grant all on liferay.* to 'liferay'@'localhost.localdomain'
      identified by 'liferay' with grant option;
  2. Create a database and account in MySQL:
  3. Copy the MySQL JDBC driver mysql.jar to $TOMCAT_DIR/lib/ext;
  4. Comment the Hypersonic data source (HSQL) configuration and uncomment MySQL configuration ($TOMCAT_DIR/conf/Catalina/localhost/ROOT.xml):
    <!-- Hypersonic -->
    <!--<Resource name="jdbc/LiferayPool" auth="Container"
    type="javax.sql.DataSource" driverClassName="org.hsqldb.
    jdbcDriver"
    url="jdbc:hsqldb:lportal"
    username="sa"
    password=""
    maxActive="20" /> -->
    <!-- MySQL -->
    <Resource name="jdbc/LiferayPool" auth="Container"
    type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.
    Driver"
    url="jdbc:mysql://localhost/liferay?useUnicode=true&amp;characterE
    ncoding=UTF-8"
    username="liferay"
    password="liferay"
    maxActive="20" />
  5. Run $TOMCAT_DIR /bin/startup.bat.
  6. Open your browser and go to http://localhost:8080 (here we assume that it is a local installation, otherwise use the real host name or IP).
  7. Login as an administrator—User: test@liferay.com and Password: test.

Note that the bundle comes with an embedded HSQL database loaded with sample data from the public website of Liferay. Do not use the Hypersonic in production.

Using Liferay Portal Bundled with Tomcat 6.x in Linux

Let's consider another scenario when you, as an administrator, need to install Liferay portal in Linux with MySQL database, and your local Java version is Java 6.0. Let's install Liferay portal bundled with Tomcat 6.0 in Linux as follows:

  1. Download Liferay Portal bundled with Tomcat 6.0 from Liferay official web site.
  2. Unzip the bundled file.
  3. Create a database and account in MySQL (as stated before).
  4. Run $TOMCAT_DIR/bin/startup.sh.
  5. Open your browser and go to http://localhost:8080 (assuming local installation; otherwise use the real host name or IP).
  6. Log in as an administrator—User: test@liferay.com and Password: test.

Note that, Liferay Portal creates the tables it needs along with example data, the first time it starts. Furthermore, it is necessary to make the script executable by running chmod +x filename.sh. It is often necessary to run the executable from the directory where it resides.

Using More Options for Liferay Portal Installation

You can use one of the following options for Servlet containers and full Java EE application servers to install Liferay Portal:

  • Geronimo + Tomcat
  • Glassfish for AIX
  • Glassfish for Linux
  • Glassfish for OSX
  • Glassfish for Solaris
  • Glassfish for Solaris (x86)
  • Glassfish for Windows JBoss + Jetty 4.0
  • JBoss + Tomcat 4.0
  • JBoss + Tomcat 4.2
  • Jetty JOnAS + Jetty
  • JOnAS + Tomcat
  • Pramati
  • Resin
  • Tomcat 5.5 for JDK 1.4
  • Tomcat 5.5 for JDK 5.0
  • Tomcat 6.0

You can choose a preferred bundle according to your requirements and download it from the official download page directly. Simply go to the website http://www.liferay.com and click on Downloads page.

Flexible Deployment Matrix

As an administrator, you can install Liferay Portals on all major application servers, databases, and operating systems. There are over 700 ways to deploy Liferay Portal. Thus, you can reuse your existing resources, stick to your budget and get an immediate return on you investment that everyone can be happy with.

In general, you can install Liferay portal in Linux, UNIX and Windows with any one of the following application servers (or Servlet containers) and by selecting any one of the following database systems.

The applications servers (or Servlet containers) that Liferay Portal can run on, include:

  • Borland ES 6.5
  • Apache Geronimo 2.x
  • Sun GlassFish 2 UR1
  • JBoss 4.0.x, 4.2.x
  • JOnAS 4.8.x
  • JRun 4 Updater 3
  • OracleAS 10.1.3.x
  • Orion 2.0.7
  • Pramati 5.0
  • RexIP 2.5
  • SUN JSAS 9.1
  • WebLogic 8.1 SP4, 9.2, 10
  • WebSphere 5.1, 6.0.x, 6.1.x
  • Jetty 5.1.10
  • Resin 3.0.19
  • Tomcat 5.0.x/5.5.x/6.0.x

Databases that Liferay portal can run on include:

  • Apache Derby
  • IBM DB2
  • Firebird
  • Hypersonic
  • Informix
  • InterBase
  • JDataStore
  • MySQL
  • Oracle
  • PostgresSQL
  • SAP
  • SQL Server
  • Sybase

Operating systems that Liferay portal can run on include:

  • LINUX (Debian, RedHat, SUSE, Ubuntu, and so on.)
  • UNIX (AIX, FreeBSD, HP-UX, OS X, Solaris, and so on.)
  • WINDOWS
  • MAC OS X
Liferay Portal Enterprise Intranets A practical guide to building a complete corporate intranet with Liferay
Published: April 2008
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

How to Configure Liferay Portal?

As an administrator, you may need to customize the Liferay portal through configuration files in order to satisfy your own requirements.

Let's see an example of how to customize Liferay Portal's configuration. In this example, Liferay Portal has been installed using the Tomcat bundle and then a custom theme called "Sesame Street" has been deployed as a WAR. As an administrator, you want this theme to be used by default in any newly created desktop or Community. To achieve that, you look in portal.properties and find that the property default.regular.theme.id can be used to set the default theme, so that you can create the file portal-ext.properties in $TOMCAT_DIR/webapps/ROOT/WEB-INFO/classes with the following values:

default.regular.theme.id=street1.0

After a server reboot, these properties are applied to the portal automatically. When your pages (with names HOME, GAMES, VIDEOS, SESAME PLAYLISTS, MUPPETS, and MY STREET) use the theme, "Sesame Street" as Look and Feel, you will get the following figure:

Setting up and Configuring a Liferay Portal

Liferay provides high customizability through the web, and through configuration files. Let's see how to customize mail servers and other configurations.

Customizing Mail Servers

Suppose that the Enterprise has a mail server with the "exg3.exghost.com" domain. As an administrator, you need to integrate this mail server with Liferay portal by default. Let's do it as follows:

  1. Find the file ROOT.xml in $TOMCAT_DIR/conf/Catalina/localhost.
  2. Find the mail configuration.
  3. And then configure it as follows:
<!-- Mail -->
<Resource name="mail/MailSession" auth="Container"
type="javax.mail.Session"
mail.imap.host="exg3.exghost.com"
mail.pop3.host="exg3.exghost.com"
mail.smtp.host="exg3.exghost.com"
mail.store.protocol="imap"
mail.transport.protocol="smtp"/>

Of course, you can integrate with Washington IMAP+Sendmail, Cyrus IMAP+Postfix, and Dovecot+Postfix, Microsoft Exchange, as well as other IMAP servers.

Configuring Portal Paths

There are two files which are used to configure portal paths: portal.properties and system.properties. You should not modify portal.properties and system.properties directly. You should just create two files named portal-ext.properties and system-ext.properties, and write in only the properties whose values you want to override. These two files can be placed with the original one, or in the global classpath of the application server. These two extended files are located at $TOMCAT_DIR/webapps/ROOT/WEB-INFO/classes.

Before customizing the configuration, it is better to review and update the values of the following properties;

  • auto.deploy.deploy.dir=${user.home}/liferay/deploy: enable auto-deploy.
  • lucene.dir=${user.home}/liferay/lucene/: for search to work.
  • jcr.jackrabbit.repository.root=${user.home}/liferay/jackrabbit: for the document library.

Customizing Configuration

We can override the properties of configuration files. Let's configure the portal through the portal-ext.properties and system-ext.properties files that can be created and stored in any place in the class-path. When the extension development environment is used, you will find that these files are already present in the directory ext/ext-impl/WEB-INF/classes. Otherwise, they are stored in the global class-path of the application server. For example:

  • Tomcat: Place them in $TOMCAT_DIR/webapps/ROOT/WEB-INFO/classes.
  • JBoss: Place them in $JBOSS_DIR/server/default/conf.
  • Other application servers: Read the documentation provided with them.

Liferay uses EasyConf to read portal.properties, so that all functionalities provided by this library are also available.

The main configuration file is portal.properties, which contains a detailed explanation of the properties that it defines. To change the value of any of its properties, do it through a file called portal-ext.properties.

The system.properties file is provided as a convenient way to set all properties for the JVM machine and related system settings. Start your application server with the system property system.properties.load set to true to load it. When the server starts, the portal will load the system.properties file and then the system-ext.properties file.

What's EasyConf? EasyConf is a library to access the configuration of software components and applications. It defines simple conventions to make it easier to use.

Setting up Extension Environment

As an administrator or a developer from engineering department at the enterprise, you may want to develop an engineering project (for example, collaborating on alfresco contents by Web services) on top of the Liferay portal, like a platform, without having to worry about upgrading in future. You can follow these instructions to set it up:

  • Requirements: Java 1.4 or Java 5.0 or Java 6.0 or a later version; Ant 1.7 or a later version; Liferay Portal source code; Web Server (Tomcat, Resin, and so on).
  • Set JAVA_HOME to your Java directory. Set ANT_HOME to your Ant directory. Add JAVA_HOME/bin and ANT_HOME/bin to System Path.
  • Configuring your compiler (build.${user.name}.properties):
## javac.compiler
## classic (the standard compiler of JDK 1.1/1.2).
## modern (the standard compiler of JDK 1.3/1.4/1.5/1.6).
## jikes (the Jikes compiler).
## jvc (Microsoft's SDK for Java/Visual J++ ).
## kjc (the kopi compiler).
## gcj (the gcj compiler from gcc).
## sj (Symantec java compiler).
## extJavac (run either modern or classic in a JVM of its own).
javac.compiler=mordern
javac.debug=on
javac.deprecation=off
javac.fork=true
javac.memoryMaximumSize=256m
javac.nowarn=on
jsp.precompile=off
  • Configuring your release properties.
  • Ant clean start build-ext.
  • Configuring your application server properties.
  • Ant build.
  • Developing your new portlets.

You now can develop and deploy your own custom portlets, themes, and applications.

Furthermore let's consider another scenario. Suppose that you, as an administrator or a developer from an engineering group, want to base your extensions on top of the latest sources of Liferay Portal, instead of using the stable release, you can follow these instructions to set it up:

  1. Download and install Subversion and/or a subversion client such as SmartSVN, TortoiseSVN or those provided by IDE environments.
  2. Configure the client to use the https protocol to connect to lportal.svn.sourceforge.net.
  3. Check out the portal.

The extension environment is a complete development environment that eases customizing Liferay Portal to suit your own needs. It combines many Liferay tools that can probably be used to build your portlets and portals, such as Struts-Portlet, Spring MVC Portlet and Service Builder.

Setting up and Configuring a Liferay Portal

Note that for some projects in which there isn't a need to customize the portal extensively and there is only a need to develop new portlets and themes, you can use the Plugins SDK instead of the extension environment. It is also possible to use both environments at the same time for different needs.

Summary

This article discussed how to set up the portal, including installation options and deployment matrix. Then it provided guidance to configure the portal based on the system-ext.properties and portal-ext.properties files, and set up extension environment in order to extend functionality briefly.

Liferay Portal Enterprise Intranets A practical guide to building a complete corporate intranet with Liferay
Published: April 2008
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

About the Author :


Jonas X. Yuan

Jonas X. Yuan is a Chief Architect of ForgeLife LLC and an expert on Liferay Portal, e-commerce, and Content Management Systems (CMS). As an open source community contributor, he has published five Liferay books from 2008 to 2012. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise content including videos, audio, images, documents, and web contents, and other technologies, such as BPM Intalio and Business Intelligence Pentaho, LDAP, and SSO. He holds a Ph.D. in Computer Science from the University of Zurich, where he focused on Integrity Control in federated database systems.

He earned his M.S. and B.S. degrees from China, where he conducted research on expert systems for predicting landslides. Previously, he worked as a Project Manager and a Technical Architect in Web GIS (Geographic Information System).
He is experienced in Systems Development Lifecycle (SDLC) and has deep, hands-on skills in J2EE technologies. He developed a BPEL (Business Process Execution Language) engine called BPELPower from scratch at the NASA data center. As the chief architect, Dr. Yuan successfully led and launched several large-scale Liferay/Alfresco e-commerce projects for millions of users each month.

He has worked on the following books: Liferay Portal Enterprise Intranets, 2008; Liferay Portal 5.2 Systems Development, 2009; Liferay Portal 6 Enterprise Intranets, 2010; Liferay User Interface Development, 2010; Liferay Portal Systems Development, 2012.

Books From Packt

Building Websites with Joomla! 1.5
Building Websites with Joomla! 1.5

Learning jQuery
Learning jQuery : Better Interaction Design and Web Development with Simple JavaScript Techniques

Building Websites with Joomla! 1.5
Google Web Toolkit GWT Java AJAX Programming

Building Powerful and Robust Websites with Drupal 6
Building Powerful and Robust Websites with Drupal 6

Professional Plone Development
Professional Plone Development

OpenCms 7 Development
OpenCms 7 Development

WordPress Theme Design
WordPress Theme Design

Drupal 5 Themes
Drupal 5 Themes

 


 

 

Your rating: None Average: 1 (1 vote)

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
g
6
u
5
W
m
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software