Tuesday, January 11, 2011

Liferay Installation

Liferay delivers open source enterprise solutions for portals, publishing, content and collaboration.
Prerequisites:
• Hardware - 1GB RAM
• Java 6 or later for Linux or Mac. Windows users don't need to install Java, as JRE is bundled.
Installation :
1) Download the desired bundle from http://www.liferay.com/downloads/liferay-portal. Tomcat bundle is recommended, and it is what this guide uses.
2) Unzip the package into a directory.
3) Open the command line and run:
Windows:
C:/{directory}/liferay-{version}/tomcat-{version}/bin
catalina.bat run
Windows users can also go to the directory and double-click "startup.bat" to run.
4) Liferay will startup in 30-60 seconds on modern computers.
5) Look at the server console until you see something like the following:
INFO: Server startup in 42950 ms
5) Open a browser and go to http://localhost:8080

Database configuration :
Liferay comes with a default database called HSQL or "hypersonic." This is not meant for production use however! You need to switch to a real database to use Liferay.

Liferay 6.0
Database configuration in 6.0 is the same as 5.2. Find your corresponding JDBC settings for your database, and put them into portal-ext.properties file, which can be found at
{liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes
If it doesn't exist, you need to create it. For a full list of database-related portal-properties that you can paste in to make your database work, see Database Portal Properties. For more information, please read the Liferay 5.2 section which contains more details in case you need advanced configuration.
Liferay 5.2
In versions 5.2 and after, the configuration of the database is set in a single file, portal-ext.properties, for all application servers. Add the example below to set up MySQL.
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=
As of 5.2.2 you can use the connection pools provided by the application server by specifying the JNDI name to be used in portal-ext.properties using the following property:
jdbc.default.jndi.name=jdbc/LiferayPool
This re-establishes the way connections are handled to the behaviour of version 5.1.x
If you do not have an existing portal-ext.properties file, you can create one and save it to:
{liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes
for Tomcat.
Instead, you can find a copy of portal.properties here for reference:
http://svn.liferay.com/repos/public/portal/branches/5.2.x/portal-impl/src/portal.properties.
once you've referenced portal.properties to understand what settings are available, make the appropriate additions to your portal-ext.properties file. In particular add this to the ext-spring.xml file:









This file can be found in your extension environment. If you are not using this environment just create an Spring configuration file with that name and add it to the META-INF dir of your installation.
For GlassFish Application server:
Set other properties e.g. using application server web admin interface. Idle Timeout = ?? seconds (less than timeout of your database server configuration)
Connection Validation (Validate connections, allow server to reconnect in case of failure)
Required=True
Validation Method=Table
Table Name=User_
For MySql, make sure you create the database first;
create database lportal character set utf8;
Liferay 5.1 and prior
In Liferay v5.1 and before, the configuration was specific for each application server. This section explains how to configure tomcat by modifying the ROOT.xml file. For other application servers please check their documentation.
ROOT.xml can be found in tomcat\conf\Catalina\localhost\ROOT.xml. for reference, at the end of this article I have included an excerpt of ROOT.xml from Liferay 4.3.x
Notice there are sample entries in this file for many different databases. By default, Liferay uses Hypersonic (lightweight db used for development purposes). Notice that all entries are commented out except for the Hypersonic entry. Since we want to change Liferay to point to MySQL, we will simply
1) Comment out the Hypersonic entry,



2) and uncomment the MySQL entry (or which ever entry you need for your database).



make sure that you change the value for url to point to your MySQL database url, and also fill in a username and password.
Including the JDBC driver
The next step is to make sure that tomcat has the appropriate JDBC driver so that it can 'talk' to this database. You can find these drivers online, however, for your convenience, we have included the MySQL driver (along with many others) in the portal code at the following path:
portal\lib\development\mysql.jar
For Liferay 5.1.1, if you are using Oracle 9i, then there are some issues with ojdbc14.jar. Instead of that use other jars like ojdbc14_g.jar for connecting to database.
If we are..
• developing in the EXT environment, we need to copy the JDBC driver to this path:
o ext\ext-lib\global\mysql.jar
• developing directly from Portal Core (not recommended), copy the driver here:
o portal\lib\global\mysql.jar
• only using the Tomcat bundle, copy the driver here:
o tomcat\common\lib\ext\mysql.jar
Creating the database and tables
You will first need to create the database, make sure that this matches the value in the url of your ROOT.xml.
For most versions of Liferay, you will have 2 sets of sql scripts, one which will create the Liferay tables with sample data (the Liferay public website) or with just the bare minimal data. You can find both sets of scripts in the portal code:
portal\sql\portal\portal-mysql.sql and
portal\sql\portal-minimal\portal-minimal-mysql.sql
If you..
• dont have the portal source code,
o you can download all the scripts online here: http://www.liferay.com/web/guest/downloads/additional or http://sourceforge.net/projects/lportal and download the portal SQL scripts.
• dont see the scripts in source,
o you will have to run "ant start" from your portal source folder which will generate the appropriate files.
Manually creating the table
Run the appropriate script against your database.
Automatically creating the tables
Starting in 4.3, you only need to create the database and Liferay will automatically run the appropriate script to create all the necessary tables for you.
in portal.properties, there is a property that you can set which will determine if the portal will create a minimal version of Liferay or a version which is pre-populated with sample data.
##
## Schema
##

#
# Set this to true to automatically create tables and populate with default
# data if the database is empty.
#
schema.run.enabled=true

#
# Set this to to true to populate with the minimal amount of data. Set this
# to false to populate with a larger amount of sample data.
#
schema.run.minimal=false
If you wanted Liferay to automatically create only the necessary Liferay tables for you, then add the following values in your portal-ext.properties (tomcat\webapps\ROOT\WEB-INF\classes\portal-ext.properties)
schema.run.enabled=true
schema.run.minimal=true

Then Configure Email Notifications
And Remove 7Cogs sample data(see below)

Default Usernames and Passwords
From Liferay 5.2.x+, you will find some sample data in the portal. The user with administration privileges has the following credentials:
* Email address: //bruno@7cogs.com//
* Password: //bruno//

If you remove [[7Cogs sample data]], then the user with administration privileges will be:
* Email address: //test@liferay.com//
* Password: //test//

From Liferay 5.1.x and lower, then the user with administration privileges will be:
* Email address: //test@liferay.com//
* Password: //test//

Troubleshooting
If your Liferay won't start after clicking startup.bat maybe it can't find Java. Open in notepad file {tomcat-home}/bin/setenv.bat and point JRE_HOME to folder where you installed Java. You setenv.bat should look like this:
set "JRE_HOME=C:\Program Files\Java\jre6"
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8 -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
If it works you should check again your Java installation.

No comments:

Post a Comment