Installing Liferay DXP on tc server requires these Additional Files for DXP or Portal CE::
- Liferay DXP WAR file
- Dependencies ZIP file
- OSGi Dependencies ZIP file
Liferay DXP requires a Java JDK 8 or 11.
Here are the basic steps for installing Liferay DXP on tc Server:
-
Installing Liferay DXP dependencies to your application server
-
Configuring your application server for Liferay DXP
-
Deploying the Liferay DXP WAR file to your application server
Creating a tc Server
-
Download and unzip a tc Server, available here. This is referred to as
[TCSERVER_INSTANCE_HOME]
. -
Create a folder called
servers
inside[TCSERVER_INSTANCE_HOME]
. (e.g./opt/pivotal-tc-server/servers
). This folder becomes Liferay Home (see note above), and you should not confuse the two. -
Next, create an instance called dxp-server to deploy Liferay DXP. Navigate to the
[TCSERVER_INSTANCE_HOME]/developer-4.0.0.RELEASE
folder and run this command:tcserver create -i ../servers dxp-server
By default, new instances are created in the
[TCSERVER_INSTANCE_HOME]/instances
folder. The-i
specifies where to create the folder. The instance location can also be changed via a properties file. See the tc Server documentation for more information.
Checkpoint:
-
A new folder called
servers
has been created. -
A new folder called
dxp-server
has been created inside theservers
folder. The following folders have been created inside thedxp-server
folder:bin
conf
lib
logs
temp
webapps
work
Next you can install the required dependencies.
Installing Liferay DXP Dependencies
Liferay DXP depends on 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.
-
Extract the JARs from the dependencies ZIP to the
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/lib
folder. -
Download the following JARs or copy them from a Liferay DXP bundle to the
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/lib
folder: -
Download a database driver
.jar
file and copy it to the[TCSERVER_INSTANCE_HOME]/servers/dxp-server/lib
folder. For a list of supported databases, see Liferay’s compatibility matrix -
Create an
osgi
folder in your Liferay Home. Extract the folders (i.e.,configs
,core
, and more) from OSGi ZIP file to theosgi
folder. Theosgi
folder provides the necessary modules for Liferay DXP’s OSGi runtime.
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.
-
Navigate to the
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/bin
folder. Insetenv.sh
replace this line:JVM_OPTS="-Xmx512M -Xss256K"
with this one
JVM_OPTS="-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx2048M -Xss512K -XX:MaxMetaspaceSize=512m"
In
setenv.bat
replaceset JVM_OPTS=-Xmx512M -Xss256K
with
set JVM_OPTS=-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx2048M -Xss512K -XX:MaxMetaspaceSize=512m
-
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 theConnector
tag includes setting theURIEncoding
toUTF-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" />
-
If you’re installing Liferay DXP and tc Server on Windows, open
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/wrapper.conf
and replacewrapper.java.additional.8=-Xss256K
with
wrapper.java.additional.8=-Xmx2048M
and add these properties:
wrapper.java.additional.9=-Xss512K wrapper.java.additional.10=-XX:MaxMetaspaceSize=256M wrapper.java.additional.11=-Dfile.encoding=UTF-8
-
Finally, open
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/web.xml
and add the following configuration 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, follow these steps:
-
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.
-
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). An example configuration is shown below:<Context crossContext="true" path=""> <Resources> <PreResources base="${catalina.base}/lib/ext/portal" className="com.liferay.support.tomcat.webresources.ExtResourceSet" webAppMount="/WEB-INF/lib" /> </Resources> <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="root" maxActive="100" maxIdle="30" maxWait="10000" /> </Context>
The resource definition above is for a MySQL database named
lportal
that has a user namedroot
whose password isroot
. Replace these values with your own. -
In a
portal-ext.properties
file in Liferay Home, specify your data source:jdbc.default.jndi.name=jdbc/LiferayPool
Your data source is now configured. Next set up the mail session.
Mail Configuration
As with database configuration, the easiest way to configure mail 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 configure the mail session in the Control Panel.
If you want to manage your mail session with tc Server, follow these steps:
-
Edit
[TCSERVER_INSTANCE_HOME]/servers/dxp-server/conf/Catalina/localhost/ROOT.xml
and add your mail session as aResource
in your web applicationContext
. Make sure to replace the example mail session values with your own.<Context crossContext="true" path=""> <Resources> <PreResources base="${catalina.base}/lib/ext/portal" className="com.liferay.support.tomcat.webresources.ExtResourceSet" webAppMount="/WEB-INF/lib" /> </Resources> ... <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" /> </Context>
-
In your
portal-ext.properties
file in Liferay Home, reference your mail session:mail.session.jndi.name=mail/MailSession
You created a mail session for tc Server to manage and configured Liferay DXP to use it.
Deploying Liferay DXP
Now you’re ready to deploy Liferay DXP using your Liferay DXP WAR file.
-
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 home page. -
Extract the Liferay DXP
.war
file to[TCSERVER_INSTANCE_HOME]/servers/dxp-server/webapps/ROOT
.Now it’s time to launch Liferay DXP!
-
Start tc Server by navigating to the runtime instance’s
[TCSERVER_INSTANCE_HOME]/developer-4.0.0.RELEASE
folder and run the following command:tcserver run -i ../servers dxp-server
Congratulations on successfully installing and deploying Liferay DXP on tc Server!