Home > Support > HOWTO List > Liferay Install

Installing a Standalone Liferay

This script will stop Tomcat (if it is running) and install Liferay into /usr/local/liferay. It will start it up using /etc/init.d/liferay.

It will also setup the MySQL database and user, and configure Liferay (if it doesn't already exists).


wget "http://proj.ri.mu/installliferay.sh"
bash installliferay.sh

The default Liferay login at the "http://yourip:8080" url is username test@liferay.com password test.  We recommend you change that password asap and delete un-used users from the default setup.

Multiple Site Setup

Liferay reportedly (http://wiki.liferay.com/index.php/Virtual_hosting) supports virtual hosting.

When we tried that setup we got some odd errors.  e.g.:


java.lang.NullPointerException
     com.liferay.portal.struts.StrutsUtil.forward(StrutsUtil.java:72)
     com.liferay.portal.servlet.MainServlet.service(MainServlet.java:865)

07:56:27,202 ERROR [IndexConsumer:66] javax.jms.JMSException: Could not
create Transport. Reason:
javax.management.InstanceAlreadyExistsException:
org.apache.activemq:BrokerName=localhost,Type=Broker

Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'com.liferay.portal.service.LayoutLocalServiceFactory' defined in class
path resource [META-INF/portal-spring-professional.xml]: Cannot resolve
reference to bean
'com.liferay.portal.service.LayoutLocalService.transaction' while
setting bean property 'service'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'com.liferay.portal.service.LayoutLocalService.transaction' defined in
class path resource [META-INF/portal-spring-professional.xml]:
Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: interface
org.springframework.aop.SpringProxy is not visible from class loader

The workaround is to run separate Liferay instances. The procedure to do this is (in shorthand) for a new domain (e.g. example.com):

Liferay Problems

Getting a blank / white page when going to http://yourip:8080?  Close your browser and try it again.

If Liferay is working, you'll end up at http://yourip:8080/web/guest/home

Getting an error like:


Caused by: java.sql.SQLException: Table not found in statement 
[select releasehbm0_.releaseId as releaseId32_0_, releasehbm0_.createDate 
as createDate32_0_, releasehbm0_.modifiedDate as modified3_32_0_, releasehbm0_.buildNumber as buildNum4_32_0_, releasehbm0_.buildDate 
as buildDate32_0_ from Release_ releasehbm0_ where 
releasehbm0_.releaseId=?]

Or getting an error like:


java.lang.NullPointerException
	com.liferay.portal.struts.StrutsUtil.forward(StrutsUtil.java:71)
	com.liferay.portal.servlet.MainServlet.service(MainServlet.java:800)

Then try starting Liferay from the Liferay bin directory.  It seems like there is a database/file path setup issue if you run it from other directories.

Liferay Not Sending Mail

If you find Liferay isn't able to send mail out, make sure you have mail.jar and activation.jar in /usr/local/liferay/common/lib and not in /usr/local/liferay/webapps/ROOT/WEB-INF/lib.

The Liferay War Install

Want to skip the standalone Liferay install?  Want to just have Liferay running as a regular Tomcat war file.  Read on...  (Note this howto has not been run for a while so there may be bugs.  Check each step as you go?  The standalone install, by comparison, works well as at 2006-07-19)

This tomcat setup follows the expert section at See also: http://www.liferay.com/web/guest/documentation/installation/tomcat.

Start with this:


mkdir -p /usr/local/tomcat/webapps/liferay
cd /usr/local/tomcat/webapps/liferay
wget -O liferay.war 'http://prdownloads.sourceforge.net/lportal/liferay-4.2.1.war'
jar xf liferay.war
rm -f liferay.war
# not sure what liferay does with these, but it complains if they are not there
mkdir -p /home/liferay/lucene/liferay.com
chown -R tomcat:tomcat /home/liferay/lucene/liferay.com
echo "PortalRealm { com.liferay.portal.jaas.PortalLoginModule required;};" > /usr/local/tomcat/conf/jaas.config

Modify /usr/local/tomcat/bin/setenv.sh to add "-Djava.security.auth.login.config=/usr/local/tomcat/conf/jaas.config" to the JAVA_OPTS variable.

You will also need to set -Xmx to -Xmx255m as liferay requires a good chunk of memory to run.  If you are running on a http://rimuhosting.com VPS then please contact us and we will upgrade your VPS (you'll need about 320MB overall).

Add this database user:


create database lportal;
GRANT ALL ON lportal.* TO 'lportal'@'localhost' identified by 'somepasswordxx';

Do the MySQL database setup per http://www.liferay.com/web/guest/documentation/development/databases#mysql

Add this Context (e.g. put it in the server.xml inside the default Host):


<!-- liferay settings -->
<Context
    path=""
    docBase="liferay"
    debug="0"
    reloadable="true"
    crossContext="true">
<Resource name="mail/DefaultMail" auth="Container" type="javax.mail.Session"/>
  <ResourceParams name="mail/MailSession">
    <parameter>
      <name>mail.smtp.host</name>
      <value>localhost</value>
    </parameter>
  </ResourceParams>
</Resource>
  <Resource name="jdbc/LiferayPool" auth="Container" type="javax.sql.DataSource"
               maxActive="10" maxIdle="1" maxWait="10000"
              username="lportal" password="somepasswordxx" driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://127.0.0.1:3306/lportal?autoReconnect=true"/>

 <Realm
        className="org.apache.catalina.realm.JAASRealm"
        appName="PortalRealm"
        userClassNames="com.liferay.portal.jaas.PortalPrincipal"
        roleClassNames="com.liferay.portal.jaas.PortalRole"
        debug="99"
        useContextClassLoader="false"
    />

</Context>

Restart tomcat with /etc/init.d/tomcat restart.

Now you should be able to go to http yourip:8080 and log in as test@liferay.com/test

Note:
* Liferay seems to insist on being the root context (i.e. path="").  If you put it in a sub context (e.g. /liferay) then the application does a redirect to /c breaking out of that context.  I'm not sure why that is, the code should use request.getContextPath() as the base for any redirects.
* The error log will be filled with various errors.  e.g. jdbc urls of 'null' (but no indication of which data source it is)

Integrate Alfresco to Liferay

Reference:
http://content.liferay.com/4.2/doc/installation/liferay_4_installation_guide/multipage/ch05s06.html

The steps are:

Edit /usr/local/liferay/bin/catalina.sh and changed JAVA_OPTS to:


JAVA_OPTS="-Xms16m -Xmx200m -XX:MaxPermSize=128m -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config"

- Restart liferay:

# /etc/init.d/liferay restart

- Log in as admin at http://yourip:8080 and make sure the Alfresco Content portlet was active.

Now you should just go ahead and add your own Alfresco contents using the Admin interface at http://yourip:8080/alfresco

Important: don't forget to change the admin passwords for both liferay and alfresco.