您的位置:首页 > Web前端

Install liferay framework and integrate with MySql or other database

2010-11-15 13:52 381 查看
I am asked to learn liferay,which is an open source portal framework, to
make a demo as soon as possible. Unluckily, I have never heard of it
before. have no choice, I have to google about it, go to the related
forms I can found,etc.

The first problem I need to resolve is to install liferay with mysql.

how to Install liferay:

* go to http://www.liferay.com/web/guest/downloads/portal , and select
one of the recommended bundle version 'liferay portal v5.2.3 Bundled
with Tomcat 5.5' to download.

* unzip the downloaded file to folder c:/liferay-portal-sql-5.2.3,

then you got LIFERAY_HOME=c:/liferay-portal-sql-5.2.3 ,

TOMCAT_HOME=c:/liferay-portal-sql-5.2.3/tomcat-5.5.27

* set your JAVA_HOME correctly in your system

* if you have never set your CATALINA_BASE or CATALINA_HOME in your system environment, you can ignore this step, otherwise,

you need to set CATALINA_BASE=C:/liferay-portal-5.2.3/tomcat-5.5.27 and
CATALINA_HOME=C:/liferay-portal-5.2.3/tomcat-5.5.27 in your system
environment,which location is Control Panel - System - Advanced System
Settings - Advanced tab - Environment Variables...

* run startup.bat in folder C:/liferay-portal-5.2.3/tomcat-5.5.27/bin
and welcome page will launch automatically. then you can login as admin
to use default admin account 'test@liferay.com' and password 'test' to
play it.

but this installation is to use default database HSQL, it is not good
for development and production environment. so how to integrate with
other database ? I take mysql as example to show you the steps.

how to integrate with MySql:

* download mysql database with the latest version ,such as v5.4 and
later, do not waste your time to try v5.1 or earlier versions.

* go to http://sourceforge.net/projects/lportal/ to dowload liferay-portal-sql-5.2.3.zip .

* open script file create/create-mysql.sql in zip file
liferay-portal-sql-5.2.3.zip and execute it in mysql , this script will
create liferay database and insert initial data.

* put the mysql jdbc driver file, such as
mysql-connector-java-5.1.7-bin.jar, to folder
C:/liferay-portal-5.2.3/tomcat-5.5.27/common/lib/ext.

* add a resource between and in the file
C:/liferay-portal-5.2.3/tomcat-5.5.27/conf/Catalina/localhost/ROOT.xml, I
paste the resource settings here.

<Resource name="jdbc/LiferayPool" auth="Container"
type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8"
username="root" password="" maxActive="20" maxIdle="30" maxWait="10000"
/>

take note I use default admin account root and empty password to login mysql.

* add a new config file portal-ext.properties in folder
C:/liferay-portal-5.2.3/tomcat-5.5.27/webapps/ROOT/WEB-INF/classes ,and
put a config item in this file.

jdbc.default.jndi.name=jdbc/LiferayPool

* run startup.bat in folder C:/liferay-portal-5.2.3/tomcat-5.5.27/bin ,
you will find liferay would access mysql database,rather than default
HSQL database.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: