Monday, December 30, 2013

Installing Liferay 6.1.30 on JBoss EAP 6.1 on Windows (Part 2)

In my previous post, I showed you how to get JBoss EAP 6.1 running on a standard Windows 8 setup. We walked through downloading the prerequisites, installing them, configuring the java environment, configuring JBoss EAP, then finally creating an admin user and signing in the first time. This time, we will be tailoring JBoss EAP for Liferay 6.1.30EE, deploying the Liferay packages, and starting up Liferay using the default settings.

Part 0 - Prerequisites

As before, there are several things we need to download.

Part 1 - Installing Liferay's Dependencies

Your previously installed JBoss EAP home folder should contain a "modules" subfolder. Beneath this folder, you need to create three nested directories as follows:
$jboss/modules/com/liferay/portal/main
Once this has been created, extract the contents of the Liferay dependency archive to this folder.

Also copy over the sqljdbc4.jar file from the SQL Server JDBC 4.0 driver. If you installed it instead of extracting the SQL Server driver's contents, it will have been put here: <install path><sqljdbc_<version>\<language>\sqljdbc4.jar.

Next, you need to create a module.xml file in the same folder as the extracted dependency jar files and paste the following content into the file:
<?xml version="1.0"?>

<module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">

    <resources>

       <resource-root path="sqljdbc4.jar" />
       <resource-root path="hsql.jar" />
       <resource-root path="portal-service.jar" />        <resource-root path="portlet.jar" />     </resources>     <dependencies>        <module name="javax.api" />        <module name="javax.mail.api" />        <module name="javax.servlet.api" />        <module name="javax.servlet.jsp.api" />        <module name="javax.transaction.api" />     </dependencies> </module>
Thats it. Your dependencies are now installed and referenced. Next up, we will need to make some changes to JBoss's configuration to work with Liferay.

Part 2 - Modifying JBoss

We will start off by modifying the JBoss standalone.xml configuration file. This file is in the $jboss\standalone\configuration\ folder.

Step 1 - Disable the default JBoss content & turn on JSP dev settings.

Find and disable the enable-welcome-root attribute in the virtual server section under the web subsystem, then add a configuration element to the section as indicated below:
        
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
    <virtual-server name="default-host" enable-welcome-root="false">
        <alias name="localhost"/>
        <alias name="atlas"/>
    </virtual-server>
    <configuration>
        <jsp-configuration development="true" />
    </configuration>
</subsystem>

Step 2- Configure the Security Domain

Find the JAAS security subsystem element, and just before the </security-domains> closing tag, add the following:
<security-domain name="PortalRealm">
    <authentication>
       <login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required"/>
    </authentication>
</security-domain>

Part 3 - Deploying the Liferay WAR

For JBoss to deploy Liferay, you must extract and place the Liferay WAR package into the ROOT.war folder under the $jboss\standalone\deployments folder. If a ROOT.war folder doesn't already exist, create one and extract the contents of the liferay WAR package there.

If you are running the EE version of Liferay, you will also need to place the XML license file into the $jboss\..\deploy folder. This is the deploy folder one level UP from the JBoss home folder. If you are running the CE version, no license is required.

Finally, you should create a file called ROOT.war.dodeploy to indicate to JBoss that you want the contents of the ROOT.war folder deployed at runtime.

Part 3.5 - Configure Java Options (Optional for test installs)

If you are simply testing our the Liferay installation procedure and don't plan to use Liferay to accomplish anything, you can skip this step. If you intent to import documents, content, users, and do some useful work within Liferay, you should tweak some basic Java runtime settings to give the portal enough RAM to run reliably.

In the $jboss\bin folder, find standalone.conf.bat file and open it. edit the Java options near the bottom as follows:
rem # JVM memory allocation pool parameters - modify as appropriate.
set "JAVA_OPTS=-Xms1303M -Xmx1303M -XX:MaxPermSize=256M"

rem # Prefer IPv4
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT"

Save your changes.

Part 4 - Starting Liferay for the first time

At this point, you've configured JBoss EAP 6.1, Installed the Liferay dependencies, extracted the Portal, indicated to JBoss you want it deployed, and possibly configured some JVM settings. At this time, you can start JBoss and let it deploy Liferay by running the standalone.bat file in the $jboss\bin\ folder.

After a few moments (it could take a couple minutes on an older machine), a browser window should open automatically to the address http://localhost:8080 and you will see the following screen.

You can leave the default settings alone to install Liferay using the Hypersonic (HSQL) database engine.

Congratulations, you've installed Liferay on JBoss EAP 6.1. In the next installment, we will create a Liferay portal database instance on SQL Server and configure Liferay to use it, then finalize our installation by cleaning up a few folders and performing some general housekeeping tasks.

No comments: