Installing Liferay DXP on tc Server

Liferay DXP is supported on tc Server. Please see the Compatibility Matrix for the supported version. Before proceeding, you must download these Additional Files:

  • Liferay DXP WAR file
  • Dependencies ZIP file
  • OSGi Dependencies ZIP file

Once you have those pieces of the puzzle, you just need to assemble them.

Installing Liferay DXP manually requires these basic steps:

  • Installing Liferay DXP dependencies to your application server
  • Configuring your application server for Liferay DXP
  • Installing Liferay DXP by providing the WAR file to your application server and the OSGi folder for Liferay DXP

Installing Liferay DXP Dependencies

Liferay DXP depends on some additional JARs that aren’t included with tc Server by default. There are even more JARs that you’d find in a Liferay DXP bundle that are not required but can be useful. If you don’t have a Liferay DXP bundle, you can download the required JARs from third parties, as described below.

Here are the JARs included in the dependencies zip file:

  • com.liferay.registry.api-1.0.4.jar

  • hsql.jar

  • portal-kernel.jar

  • portlet.jar

One JAR you definitely need that is not included in the dependencies zip is your database driver. Database drivers for MySQL and PostgreSQL can be found in a Liferay DXP bundle or in the Liferay DXP source code.

There are several other dependency JARs that aren’t included in the dependencies zip. If you don’t have them already on hand or have access to a Liferay DXP bundle, you’ll have to download them yourself.

Place these JARs in Liferay Home’s lib folder (not tc Server’s) (see more steps below).

Liferay DXP includes an OSGi runtime. Extract the OSGi ZIP file that you downloaded and copy the osgi folder to your Liferay Home folder. The osgi folder contains many required JAR files and a few configuration files.

Configuring tc Server

There are a few configuration edits to make so Liferay DXP runs well on tc Server. All of these configuration changes should be made in your tc Server runtime instance.

  1. Download and unzip tc Server available here. This will be referred to as [TCSERVER_INSTANCE_HOME].

  2. Create a folder called servers inside [TCSERVER_INSTANCE_HOME]. (e.g. /opt/pivotal-tc-server-standard-3.1.8.release/servers). This folder becomes Liferay Home (see note above) and you should not confuse the two.

  3. Next, create an instance called dxp-server where Liferay DXP will be deployed. Run the command:

     tcruntime-instance.bat|sh create -i servers dxp-server
    
  4. Copy the dependencies jars inside the lib folder inside [TCSERVER_INSTANCE_HOME]/servers/dxp-server.

Checkpoint:

  1. A new folder called servers has been created.

  2. A new folder called dxp-server has been created inside the servers folder. The following folders have been created inside the dxp-server folder:

  • bin
  • conf
  • lib
  • logs
  • temp
  • webapps
  • work

Liferay DXP dependencies have been placed inside the [TCSERVER_INSTANCE_HOME]/servers/dxp-server/lib folder:

  • com.liferay.registry.api-1.0.4.jar
  • hsql.jar
  • portal-kernel.jar
  • portlet.jar
  • jta.jar
  • junit.jar
  • jutf7.jar
  • jms.jar
  • mail.jar
  • persistence.jar
  • activation.jar
  • ccp.jar
  • a database jar for other than HSQL (e.g. mariadb, mysql, db2)

There are a few more configuration changes for Liferay DXP to run well on tc Server 3. All of these configuration changes should be made in the tc Server runtime instance.

  1. Navigate to the [TCSERVER_INSTANCE_HOME]/servers/dxp-server/bin folder. In setenv.sh replace this line

     JVM_OPTS="-Xmx512M -Xss256K"
    

    with this one

     JVM_OPTS="-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx1024M -Xss512K -XX:MaxMetaspaceSize=512m"
    

    In setenv.bat replace

     set JVM_OPTS=-Xmx512M -Xss256K
    

    with

     set JVM_OPTS=-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx1024M -Xss512K -XX:MaxMetaspaceSize=512m
    
  2. Next, you should make sure that UTF-8 URI encoding is used consistently. Open [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/server.xml and make sure the Connector tag includes setting the URIEncoding to UTF-8.

     <Connector acceptCount="100"
                connectionTimeout="20000"
                executor="tomcatThreadPool"
                maxKeepAliveRequests="15"
                port="${bio.http.port}"
                protocol="org.apache.coyote.http11.Http11Protocol"
                redirectPort="${bio.https.port}"
                URIEncoding="UTF-8" />
    
  3. If you’re installing Liferay DXP and tc Server on Windows, open [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/wrapper.conf and replace

     wrapper.java.additional.8=-Xmx512M
    

    with

     wrapper.java.additional.8="-Xmx1024M"
    

    and

     wrapper.java.additional.9=-Xss256K
    

    with

     wrapper.java.additional.9="-Xss512K"
     wrapper.java.additional.10="-XX:MaxMetaspaceSize=256M"
     wrapper.java.additional.11="-Dfile.encoding=UTF-8"
    
  4. Last, open [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/web.xml and add the following after <load-on-startup>3</load-on-startup>

     <init-param>
         <param-name>compilerSourceVM</param-name>
         <param-value>1.8</param-value>
     </init-param>
     <init-param>
         <param-name>compilerTargetVM</param-name>
         <param-value>1.8</param-value>
     </init-param> 
    

Database Configuration

The easiest way to handle your database configuration is to let Liferay DXP manage your data source. If you want to use Liferay DXP’s built-in data source, you can skip this section.

If you want tc Server to manage your data source, use this procedure:

  1. Make sure your database server is installed and working. If it’s installed on a different machine, make sure it’s accessible from your Liferay DXP machine.

  2. Add your data source as a resource in the context of your web application specified in [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/Catalina/localhost/ROOT.xml (create this file if you don’t have it already):

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

Note that the above resource definition assumes your database name is lportal, that you’re using MySQL, and that your MySQL username and password are both root. You’ll have to update these values with your own database name and credentials.

Your data source is now configured. Next set up the mail session.

Mail Configuration

As with database configuration, the easiest way to handle mail configuration is to let Liferay DXP handle your mail session. If you want to use Liferay DXP’s built-in mail session, skip this section and use Liferay DXP’s Control Panel to configure a mail server after Liferay DXP has been installed and started.

To create a mail session bound to mail/MailSession, edit [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/Catalina/localhost/ROOT.xml and configure your mail session in a Resource tag. Make sure to replace the example mail session values with your own.

<Resource
    name="mail/MailSession"
    auth="Container"
    type="javax.mail.Session"
    mail.pop3.host="pop.gmail.com"
    mail.pop3.port="110"
    mail.smtp.host="smtp.gmail.com"
    mail.smtp.port="465"
    mail.smtp.user="user"
    mail.smtp.password="password"
    mail.smtp.auth="true"
    mail.smtp.starttls.enable="true"
    mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
    mail.imap.host="imap.gmail.com"
    mail.imap.port="993"
    mail.transport.protocol="smtp"
    mail.store.protocol="imap"
/>

Your mail session is configured. Next, you’ll make sure Liferay DXP can access your mail session and database.

Configuring a Database and Mail Session

In this section you’ll specify appropriate properties for Liferay DXP to use in connecting to your database and mail session.

  1. If you are using tc Server to manage your data source, add the following line to the portal-ext.properties file in your Liferay Home.

     jdbc.default.jndi.name=jdbc/LiferayPool
    
  2. If you are using tc Server to manage your mail session, add the following to portal-ext.properties:

     mail.session.jndi.name=mail/MailSession
    

Before you deploy Liferay DXP, you should configure a Portal Access Control List (PACL).

Enabling PACL

To enable PACL, you need to enable Tomcat’s security manager. Make sure [TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/catalina.policy specifies the permissions

grant {
    permission java.security.AllPermission;
};

Open [TCSERVER_INSTANCE_HOME]/servers/dxp-server/bin/setenv.sh if on Linux, Unix, or Mac OS, or setenv.bat if on Windows. Enable the security manager by inserting the following code into the CATALINA_OPTS variable (inside quotation marks):

-Djava.security.manager -Djava.security.policy==$CATALINA_BASE/conf/catalina.policy

Now you have PACL enabled and configured for your portal.

Deploying Liferay DXP

Now you’re ready to deploy Liferay DXP using your Liferay DXP WAR file.

  1. If you are manually installing Liferay DXP on a clean tc Server instance, delete the contents of the [TCSERVER_INSTANCE_HOME]/servers/dxp-server/webapps/ROOT directory. This removes the default Tomcat home page.

  2. Extract the Liferay DXP .war file to [TCSERVER_INSTANCE_HOME]/servers/dxp-server/webapps/ROOT.

    Now it’s time to launch Liferay DXP!

  3. Start tc Server by navigating to the runtime instance’s bin folder and executing ./tcruntime-ctl.sh run or /tcruntime-ctl.sh start. If you’re on Windows you can use the .bat version of the startup script only if you installed the tc Server instance as a Windows service. Alternatively, you can use ./catalina.sh run or catalina.bat run.

After you set up your account you can start using Liferay DXP.

« Installing Liferay DXP on JBoss EAP 6.4Installing Liferay DXP on WebLogic 12c R2 »
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助