Documentation
Liferay provides a rich store of resources and knowledge to help our community better use and work with our technology.
Installing Liferay on an existing application server
When it comes time to install Liferay Portal on your server, you'll find it's easiest to do this by starting with a bundle. But many enterprises can't do that. There may be an existing infrastructure into which you're installing Liferay, or you may have standardized on a particular application server. You'll be happy to know that Liferay Portal has been designed to work well with all the leading application servers, and that it's easy and straightforward to install. But before we get started, we need to go over a few concepts; namely, the Liferay Home folder, databases, and Liferay's main configuration file. These were touched on in the section on bundles above, but we'll look at them in more detail now.
Liferay Home
Liferay Portal uses a special folder defined as Liferay Home. This folder is one folder higher than the location of the application server itself. This is why the bundles place the application server one folder in from the bundle's root folder.
If Liferay is unable to create the resources it needs in this folder, or if it finds itself running on certain application servers, it creates a folder called liferay in the home folder of the user ID that is running Liferay, and that becomes Liferay Home.
As described above in the Bundles section, the home folder is very important to the operation of Liferay. The aforementioned folders (data and deploy) are created there, and you can also put a special configuration file called portal-ext.properties there. This file is fully documented in Chapter 14: Configuring Liferay Properties.
Note
Note: To use database properties from aportal-ext.properties file you must disable the Setup Wizard by specifying setup.wizard.enabled=false in that portal-ext.properties. Also, note that property values in portal-setup-wizard.properties (the file created in Liferay Home by the Setup Wizard) override property values in portal-ext.properties. Let's move on to examining the database.
Liferay's database
As stated above, if you create your database and grant a user ID full access to it, Liferay can use that user ID to create its indexes and tables automatically. This is the recommended way to set up Liferay, as it allows you to take advantage of Liferay's ability to automatically maintain its database during upgrades or through various plugin installs which may create tables of their own. It is by far the best way to set up your Liferay installation.
If you'll be setting up Liferay's database with the recommended permissions, you can skip to the next section.
image
Note: This is not the recommended set up for Liferay installations, but is documented here so that enterprises with more restrictive standards can install Liferay with more strict-—but suboptimal—-database settings. If it's at all possible, Liferay recommends that you use the automatic method as documented above instead of the procedure outlined below.Even though Liferay can create its database automatically, some enterprises prefer not to allow the user ID configured in an application server to have the permissions over the database necessary for Liferay and its plugins to maintain their tables. For these organizations, Select, Insert, Update, and Delete are the only permissions allowed, so we will go over how to set up the database manually. If your organization is willing to grant the Liferay user ID permissions to create and drop tables in the database—-and this is the recommended configuration-—by all means, use the recommended configuration.
Creating the database is simple: grant the ID Liferay uses to access the database full rights to do anything to the database. Then install Liferay and have it create the database. Once the database is created, remove the permissions for creating tables and dropping tables the user ID.
There are some caveats to running Liferay like this. Many Liferay plugins create new tables when they're deployed. In addition to this, Liferay has an automatic database upgrade function which runs when the version of Liferay is upgraded to a new release. If the user ID that accesses the database doesn't have enough rights to create/modify/drop tables in the database, you must grant those rights to the ID before you deploy one of these plugins or start your upgraded Liferay for the first time. Once the tables are created or the upgrade is complete, you can remove those rights until the next deploy or upgrade. Additionally, your developers may create plugins that need to create their own tables. These are just like Liferay's plugins that do the same thing, and they cannot be installed if Liferay can't create these tables automatically. If you wish to install these plugins, you will need to grant rights to create tables in the database before you attempt to install them.
Once you have your database ready, you can install Liferay on your server.
Liferay installation overview
Before we begin, it's important to go over the various facets of the installation. They are:
Create your database (see above).
Determine whether you want to use the Liferay managed data source or a data source managed by your application server.
Gather credentials for sending email notifications to users. Liferay supports a JNDI mail session as well as its built in mail session.
Create a
portal-ext.propertiesfile in the Liferay Home folder. This is a simple text properties file that you'll use to override Liferay's default properties (see below).
Refer to the manual installation instructions below for further details on configuring the various application servers. There is no difference between the Liferay bundles and the regular distribution archives of the application servers as they are available from their own sites, with the exception that Liferay is pre-installed in them, and the JVM settings may have been optimized for use with Liferay.
The easiest way to install Liferay is to set up your database and then follow the instructions for your application server. This method uses the setup wizard to create a working configuration. If you're interested in the details of what the setup wizard does or if for some reason you need to set up Liferay manually, read on. Otherwise, feel free to skip ahead to the section on your particular application server.
Using data sources
Liferay comes bundled with its own built-in data source. It's configured by a number of properties which you set in a properties file. By default, the setup wizard asks you for the necessary values and creates a configuration file that uses the built-in data source to connect to the database.
Liferay always recommends that you use the built-in data source. Sometimes, however, organizations prefer to use the data source provided by their application server of choice. In this instance, a JNDI lookup provides a handle to the data source, and the application server manages the connection pools. Liferay supports using your application server's data source if you wish to do that.
To do this, you'll need to create your own configuration file and skip the setup wizard. Since you'd be creating this file after the wizard anyway, this isn't such a big deal.
Since mail sessions are configured in a similar way to data sources, we'll look at them next.
Using mail sessions
Liferay's default configuration looks for a mail server on the same machine on which Liferay's running, and it tries to send mail via SMTP to this server. If this is not your configuration, you'll need to modify Liferay's defaults. To do this, you'll use a portal-ext.properties file (see below).
In a similar fashion to databases, you have two ways to configure your mail server:
- Use your application server's mail session.
- Use the built-in mail session.
To use your application server's mail session, you must create it in your application server, and it should point to your mail server. Once you've done that, you're ready to point Liferay to it. You can do this through the configuration file or through Liferay's control panel after it's been installed.
Let's look next at this configuration file and, if you're choosing not to use the setup wizard, show you how to get Liferay connected to your database and your mail server.
The portal-ext.properties file
Liferay's properties files differ from the configuration files of most other products in that changing the default configuration file is discouraged. In fact, the file that contains all the defaults is stored inside of a .jar file, making it more difficult to customize. Why is it set up this way? Because Liferay uses the concept of overriding the defaults in a separate file, rather than going in and customizing the default configuration file. You put only the settings you want to customize in your own configuration file, and then you have a file that contains only the settings you need. This makes it far easier to determine whether a particular setting has been customized, and it makes the settings more portable across different installations of Liferay.
The default configuration file is called portal.properties, and it resides inside of the portal-impl.jar file. This .jar file is in Liferay Portal's WEB-INF/lib folder. The file that is used to override the configuration is portal-ext.properties. This file should be created in your Liferay Home folder (please see chapter 11 for the location of this folder for your application server). You'll use this file throughout this book to change many of Liferay's settings. An exhaustive list of these settings is covered in chapter 14.
For now, we're only concerned with your database and your mail server. Create a text file called portal-ext.properties in your Liferay Home folder. This file overrides default properties that come with Liferay. The first setting you'll override is the default configuration that points Liferay to the embedded HSQL database.
As stated above, there are two ways to set up the connection:
- Use the built-in connection pool.
- Use your application server's connection pool..
To use the built-in connection pool--based on C3P0--add the template which is provided in Chapter 6 for your particular database. The template for MySQL is provided as an example below.
#
# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=liferay
jdbc.default.password=liferay
If the database name and username/password combination above don't match your database, provide the ones that do.
If you want to use your application server's connection pool, you will have to create one in your application server that points to your database. It should be called jdbc/LiferayPool. To cause Liferay to use this connection pool, add the following directive to your portal-ext.properties file:
jdbc.default.jndi.name=jdbc/LiferayPool
For mail, you can use Liferay's control panel to create the configuration, and this is the recommended way. Go to Control Panel → Server Administration → Mail and enter your settings for your mail session settings. If, however, you're setting up a lot of Liferay machines and they're all going to have similar mail configurations, it's easier to do the configuration once and then copy the configuration file to multiple machines. In this case, you'll want to use the portal-ext.properties file. To use the built-in mail session, use the following properties and customize their values for your environment:
mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=localhost
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
To use your application server's mail session, create it first. Then specify it in the portal-ext.properties file:
mail.session.jndi.name=mail/MailSession
When you've finished, save the file. Next, follow the instructions for installing Liferay on your particular application server in the section below.
Installing Liferay on an existing application server
This section contains detailed instructions for installing Liferay Portal using its .war file distribution. This allows system administrators to deploy Liferay in existing application server installations. It is recommended that you have a good understanding of how to deploy Java EE applications in your application server of choice.
Installing Liferay in five easy steps
There are five generic steps to installing Liferay on an existing application server:
Obtain the Liferay
.warfile and the dependencies archive.Make sure you don't have an application listening at the root (
/) of your server. If you do, move it to a different context or undeploy it.Shut your application server down.
Extract the dependencies to a location on your server's global classpath. This allows both Liferay and plugins to access these dependencies.
Start your application server, deploy the Liferay
.warfile, and start it.
The instructions below are specific for each application server that Liferay supports. Liferay supports a wide combination of application servers and databases. Because of this, for brevity this section assumes MySQL as the database, that the database has already been created, and that you're using the setup wizard. If you're not using the setup wizard, see the sections above for information on how to set up Liferay manually.
We also assume your application server is already installed and running successfully. If you still need to install your application server, please follow your vendor's instructions first.
The following instructions assume an installation on a local machine. When installing to a remote server, substitute localhost with the host name or IP of the server.
image
Tip: Note that Liferay requires JDK 5 or greater. Do not attempt to install Liferay 6.x on an application server that runs under Java 1.4 or lower; it will not work. If you are running an application server that ships with a JDK and that JDK is 1.4 or lower, you'll need to upgrade your application server in order to run current versions of Liferay Portal.Without further ado, let's get to the application servers. The first one we'll cover is Mule Tcat. If you don't have an application server preference, and you want support all the way down to the application server from Liferay, then Mule Tcat is your solution. After we cover Mule Tcat, we'll look at all the supported application servers in alphabetical order.
Installing Liferay on Mule Tcat
Liferay Portal Tcat Edition is a combination of Liferay Portal, the leading open source portal, and Tcat Server, an enterprise grade administration console for the Apache Tomcat application server.
Tcat Server provides several tools to make Tomcat more administrator friendly, especially in organizations used to leveraging administration consoles like those found in other more complex JEE application servers. You may use the console to:
- Monitor and control all Tomcat instances on multiple servers and across multiple environments
- Deploy and view applications across instances
- Troubleshoot problems across all instances, including view JMX parameters, viewing remote logs, and more
- Provide granular entitlement controls for the above functions and more
This isn't a complete guide to Mule Tcat; it just covers Liferay installation. For full documentation, you'll find more detailed information here: http://www.mulesoft.org/documentation/display/TCAT/Home
To obtain Liferay Portal Tcat Edition, you need access to the Liferay Customer Portal and the Mulesoft Tcat Server web site. If you are not a current Liferay customer and would like to try the product, please contact Liferay via email at sales@liferay.com.
For this section, we'll limit ourselves to the Windows and Linux 64-bit installation wizards. For more detailed installation instructions, please consult the Mulesoft Tcat Server installation documents located at:
http://www.mulesoft.org/documentation/display/TCAT/Home
- Installing Tcat Server on Linux
- Installing Tcat Server on Windows
- Installing Tcat Server on Solaris
- Installing Tcat Server on Mac OS X
- Adding Tcat Server Capabilities to an Existing Apache Tomcat Install
First, download the Liferay Tcat bundle from the Liferay customer portal. You'll need two files:
- Liferay Portal 6.1 EE Tcat Admin: contains the Tcat administration console and Liferay Portal EE and all appropriate plugins.
- Liferay Portal 6.1 EE Tcat Agent: contains a vanilla Tomcat application server and the Tcat management agent.
Next, download the appropriate Tcat platform installation at: http://www.mulesoft.com/download-tcat. You may select installation wizards for Windows (32 and 64-bit), Mac, Unix, Solaris, and Linux (32 and 64-bit) as well as a manual installation zip.
After obtaining the software bundles, you can proceed with installation and configuration of the Administration Console.
Installing the Administration Console on Windows
For Windows, Tcat comes with an installer to assist with installation and configuration. After downloading, execute the installer, accepting the appropriate license agreement.
Upon accepting the license agreement, the system presents you with two installation choices, a "standard" or "custom" installation.
Figure 11.4: Installation selection
You should select the "Custom" installation option to provide better control of where Tcat Server is installed.
Figure 11.5: Installation component selection
After selecting the custom installation option, the Tcat installer prompts you to select the desired components.
- Tcat Server: a version of Apache Tomcat that includes the appropriate management agents used by Tcat.
- Administration Console: the administration console for monitoring and managing all available Tcat servers. This console contains tools used for application deployment, log access, server control, and other administration tools.
- Tomcat Documentation: the documentation that comes normally with an Apache Tomcat distribution. You do not need to select this option.
- Tomcat Examples: the examples that comes normally with an Apache Tomcat distribution. You do not need to select this option.
- Tomcat Manager Application: the manager application that comes normally with an Apache Tomcat distribution. You do not need to select this option.
For this step in the installation process, select the Administration Console in addition to Tcat Server.
Figure 11.6: Installation location
After selecting Tcat Server and the Administration Console for installation, the installation wizard prompts you for an installation directory. Please select the desired installation directory for the Tcat Server.
Figure 11.7: Port configurations
After selecting the appropriate installation location, the installation wizard prompts you to specify the appropriate port numbers. If this is the first time installing Tcat and no other Apache Tomcat installations are present, then you may retain the above ports. However, if there are other installations, you will need to select new ports. For the purpose of this installation, we will assume the above ports are correct.
Figure 11.8: Windows service installation
To ensure the operating system starts the Tcat Server and Administrator Console, you must configure the Tcat Server process as a Windows service. The next step in the installation wizard helps with this process.
In the Windows service installation screen, please select "Install Tcat Server as a Windows service." You may choose an appropriate service name other than TcatServer.
Figure 11.9: Start menu shortcuts
The final step in the installation wizard is to configure Start Menu shortcuts. You may choose to customize the shortcut location or accept the default.
After configuring the shortcuts, the Tcat Server Windows installer performs the installation as previously configured.
Installing the Administraton Console on Linux (Ubuntu)
For Linux, Tcat comes with an installer to assist with installation and configuration. After downloading, execute the installer, accepting the appropriate license agreement. To execute the installer, make sure:
- you have added execution permissions to the installer file (
chmod a+x [file name]) - you execute it with root privileges (don't worry: the installed service is executed by a pre-defined system user with no root privileges)
Upon accepting the license agreement, the system presents you with two installation choices: a "standard" or "custom" installation.
Figure 11.10: Installation type
You should select the "Custom" installation option to provide better control of where Tcat Server is installed.
Figure 11.11: Installation component selections
After selecting the custom installation option, the Tcat installer prompts you to select the desired components.
Tcat Server: a version of Apache Tomcat that includes the appropriate management agents used by Tcat.
Administration Console: the administration console for monitoring and managing all available Tcat servers. This console contains tools used for application deployment, log access, server control, and other administration tools.
Tomcat Documentation: the documentation that comes normally with an Apache Tomcat distribution. You do not need to select this option.
Tomcat Examples: the examples that comes normally with an Apache Tomcat distribution. You do not need to select this option.
Tomcat Manager Application: the manager application that comes normally with an Apache Tomcat distribution. You do not need to select this option.
For this step in the installation process, select the Administration Console in addition to Tcat Server, which is the default setting.
After selecting Tcat Server and the Administration Console for installation, the installation wizard prompts you for an installation directory.
Figure 11.12: Installation location
Please select the desired installation directory for the Tcat Server. The offered default directory is different if the installation process has been started as root.
Figure 11.13: Port configuration
After selecting the appropriate installation location, the installation wizard prompts you to specify the appropriate port numbers. If this is the first time installing Tcat and no other Apache Tomcat installations are present, then you may retain the above ports. However, if there are other installations, you will need to select new ports. For the purpose of this installation, we will assume the above ports are correct.
Figure 11.14: Configure Tcat system user
For security considerations, Tcat runs as a non-root system user. If the username specified at this step does not exist, it's created as a system daemon user.
Figure 11.15: Install service
To ensure the operating system starts the Tcat Server and Administrator Console, you must create a service startup script in /etc/init.d. The next step in the installation wizard helps with this process.
In the service installation screen, you may enter an appropriate service name or use the default. If you have multiple installations of Tcat, you should select a more appropriate than what is supplied by default.
Figure 11.16: Symbolic link creation
The final configuration step before installation is the creation of a symbolic link so the Tcat executable can be accessed more easily. This step is optional and you may choose to not create the symbolic link.
Figure 11.17:
Now that Tcat is installed, you can add Liferay to it.
Adding Liferay Portal packages
After completing the TcatServer Administration Console installation, you can configure the Liferay Portal packages for Tcat.
First, extract the previously downloaded Liferay Portal 6.1 EE Tcat Admin into a temporary directory. Once extracted, locate the file tcat-init.groovy and the directory tcat\_init.
Figure 11.18: Liferay Portal Tcat packages
The tcat-init.groovy file contains instructions for the TcatServer administration console to:
- Pre-load the Liferay Portal and Plugins WAR files into the application repository
- Load the appropriate Liferay application profile that should be applied to all other Tcat managed servers
- Load the Liferay specific deployment manager
The tcat\_init folder contains the managed server profiles, Liferay WAR files, and administration scripts.
Copy the tcat-init.groovy file and tcat\_init folder to the previously configured installation location.
Figure 11.19: The installation directory after copying the tcat\_init folder and tcat-init.groovy into the TcatServer installation directory.
After successfully completing the installation on Windows, you should see a TcatServer entry in the Services console, similar to the screen shot below.
Figure 11.20: Windows services console
By default, the TcatServer service is inactive but is set to start automatically upon boot. Go ahead and choose to start the service.
If you're using Linux, you should see an entry for the Tcat service initialization script in /etc/init.d. The script name is the name you choose during the installation process.
Figure 11.21: Tcat service startup on Linux
To start the Tcat Server Administration Console, execute the service script in /etc/init.d.
Tcat Server Managed Server Installation
The steps to install the Tcat Server managed server are quite similar to those for installing the Tcat Server Administration Console.
First, launch the wizard. During the installation component configuration step, unselect "Administration Console" from the list of components.
Figure 11.22: Installation location
The next step is to specify an installation location. If you have other installations of Tcat on this machine, you should another destination. For example, if you have already installed the Tcat Server Administration Console to C:\\TcatServer6, you should perhaps install the managed server to C:\\TcatServer6Managed.
Figure 11.23: Managed server port configurations
During the managed server installation, as with the administration console installation, you will be prompted to configure the appropriate port numbers. If you do not have another Tcat Server instance (e.g. administration console or another managed server), you may choose the default ports. Otherwise, you should select non-conflicting ports. For instance:
- HTTP port: 8180
- HTTPS redirect port: 81443
- Tcat Server shutdown port: 8105
- AJP connector port: 8109
- Secure Agent Port: 52443
To ensure the operating system starts the Tcat Server and Administrator Console, you must configure the Tcat process as a Windows service or Linux daemon. The next step in the installation wizard helps with this process.
The final step in the installation wizard is to configure Start Menu shortcuts. You may choose to customize the shortcut location or simply accept the default. Since this is for a managed server, you may wish to name it similar to the service name.
After configuring the shortcuts, the Tcat Server installer performs the installation as previously configured.
Once you have installed the managed server, there is one more step to perform on the managed server. You must modify the catalina.properties file located in the conf directory of your Tcat Server installation.
You will need to change the text:
common.loader=${catalina.base}/lib,${catalina.base}/lib/\*.jar,${catalina.home}/lib,${catalina.home}/lib/\*.jar
To:
common.loader=${catalina.base}/lib,${catalina.base}/lib/\*.jar,${catalina.home}/lib,${catalina.home}/lib/\*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/\*.jar
By modifying the common.loader property, you instruct Tcat Server to load everything in the lib/ext folder as part of the classpath.
Registering the managed server
After completing the installation process and starting the appropriate TcatServer processes, open a browser to [SERVER NAME]:[PORT]/console. Using previous installation example, you should point your browser to http://localhost:8080/console. The browser should render the TcatServer Administration Console shown below.
Figure 11.24: Tcat Admin Console log in
The default login is: admin/admin.
Once you have logged into the administration console, you will be presented with a global dashboard that you may customize once you have dismissed the "Tcat Server - Quick Start" panel.
Figure 11.25: Customizable Tcat Admin Console
First make sure that you have started the previously installed managed server. server. Clicking on the Servers tab in the console, you will see a server listed as Unregistered.
Unregistered servers are servers that have the Tcat management agent installed but are not added to the administration console. You may add the unregistered server by selecting either Register or Register & Add To Group.
If you choose to use Register & Add To Group, the server is added to the desired server group (e.g. Development). For the purpose of this guide, we'll register the server to the Development group.
Figure 11.26: Monitoring a registered server
After registering the server, you will have access to view its health status, log files, and more. Feel free to walk through the console to examine its capabilities, like reviewing log files, current thread status, and deployed web applications.
More information is available at http://www.mulesoft.org/documentation/display/TCAT/Home.
Managing and Monitoring Servers
Managing Tcat Web Applications
Deploying Liferay Portal
As part of the installation process, the current version of Liferay Portal and a number of Liferay Plugins have been provisioned into the Tcat repository. You can view them by clicking on the "Repository" tab.
Figure 11.27: Tcat Repository profiles
There are two components in the Tcat Repository:
- Profiles: application profiles to be applied to the Tcat managed servers. Contains configuration, shared libraries, and more.
- Applications: deployable WAR files for web applications and Liferay Plugins.
Figure 11.28: Tcat Repository: Applications
To being Liferay deployment, we must first create a Liferay license profile to be deployed to the managed server:
Figure 11.29: Creating a new workspace for Liferay license profile
First create a new workspace under Profiles. Select Profiles in the left navigation and then click the New Workspace button.
Within the new workspace Liferay Portal Trial License, create another folder called
deploy.In the
deployfolder, select New Artifact and upload a new license file.
After completing the above, you have successfully uploaded your Liferay Portal license file into the Tcat repository. The final step is to create a server profile from the Administration tab.
Server Profiles shows the list of available Server Profiles and the option to create a new profile.
Figure 11.30: Viewing server profiles
When creating a server profile for the Liferay Portal Trial License, you will need to select the workspace folder created in the previous step. This ensures that when you apply the profile, Tcat uses the latest version of the license file.
Once you've created the server profile for your Liferay Portal EE license, you may begin deploying Liferay to the managed server.
Figure 11.31: Apply Liferay Portal trial license
The first step is to apply two server profiles, one for the license and the other for Liferay Portal. Applying the license profile does not require a restart of the server.
Figure 11.32: Apply Liferay profile
The second profile that must be applied is the Liferay server profile. In the example shown we applied the profile for Liferay Portal EE 6.1.
The Liferay Portal server profile requires a server restart. If you have the managed server configured as a Windows or Linux service, you may restart the server directly from the console by selecting the server and clicking "Restart".
With both profiles applied, we can now deploy the Liferay Portal WAR to the appropriate server.
The Deployments tab contains tools that assist in creating a deployment and targeting it to specific servers. Once you create a deployment, you may target it to any number of servers or deployment groups.
Figure 11.33: Choosing a web application for deployment
When creating a deployment, you may choose a WAR file already uploaded into the repository or you may choose to upload a new WAR file. We recommend using a WAR file from the repository for non-development deployments. This ensures you consistently deploy the correct version to your environments.
Since we are deploying Liferay Portal for the first time, we choose the ROOT.war file.
After selecting the appropriate web application, you may choose which Servers to deploy to. In the example above, we deploy to the Tomcat instance labeled Liferay Portal Instance 1.
Figure 11.35: Completing Liferay Portal deployment
After choosing to deploy the application, the Tcat console informs you of the current deployment status (e.g. "Successful"). Assuming you followed the previous steps and the deployment successfully completes, you will be able to access Liferay Portal on the target Tomcat instance.
Figure 11.36: Accessing Liferay Portal on Liferay Portal Instance 1
Deploying Liferay plugins on Mule Tcat
Liferay Portal Tcat Edition works with all the appropriate Liferay EE Plugins, including:
- Kaleo workflow engine
- Knowledge base
- Chat
- Private messaging
You may choose to deploy these plugins to the appropriate servers by following the same steps as for deploying Liferay Portal, specifying the appropriate plugin WAR file instead of the ROOT.war.
Other plugins that may be downloaded and added to this repository include:
- Audit
- Report engine and console
- Drools integration.
You may download these plugins from the Liferay Customer Portal and manually add them to the Tcat repository.
Figure 11.37: Uploading new plugins into Tcat
Mule Tcat provides an enterprise grade solution to managing Tomcat servers. If you need a complete stack, combining Liferay Portal with Mule Tcat provides you with everything you need to run a fully supported and robust portal environment for your enterprise.
Installing Liferay on GlassFish 3
Liferay Home is three folders above your GlassFish domain folder.
For example, if your domain location is /glassfish-3.1-web/glassfish3/glassfish/domains/domain1, Liferay Home is /glassfish-3.1-web/glassfish3/.
If you don't already have an existing GlassFish server, we recommend that you download a Liferay/GlassFish bundle from http://www.liferay.com/downloads/liferay-portal/available-releases. If you have an existing GlassFish server or would like to install Liferay on GlassFish manually, please follow the steps below.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
These instructions assume that you have already configured a domain and server, and that you have access to the GlassFish administrative console.
Let's start out by installing the JAR files you will need.
Dependency Jars
Liferay depends on jar files found in the Liferay Dependencies Archive. You should also have installed your database driver.
- Navigate to the folder that corresponds to the domain in which you'll be installing Liferay. Inside this folder is a sub-folder named
lib(e.g./glassfish-3.1-web/glassfish3/glassfish/domains/domain1/lib).
Unzip the Liferay dependencies archive so that its .jar files are extracted into this lib folder.
Note, on GlassFish 3.0.1, you will need to extract commons-codec.jar from the Liferay Portal WAR file, rename it to commons-codec-repackaged.jar, and copy it into [Liferay Home]/glassfish/modules/, overwriting GlassFish's version of the file.
Make sure the JDBC driver for your database is accessible to GlassFish as well. Obtain the JDBC driver for your version of the database server. In the case of MySQL, use
mysql-connector-java-{$version}-bin.jar. You can download the latest MySQL JDBC driver from http://www.mysql.com/products/connector/. Extract the JAR file and copy it tolib.Next, you will need apply several patches to Glassfish
.jarfiles due to the following known issues. The best way to get the appropriate versions of these files is to download the Liferay source code and get them from there. Once you have downloaded the Liferay source, unzip the source into a temporary folder. We'll refer to the location of the Liferay source as$LIFERAY_SOURCE.
- For issue [GLASSFISH-17242](http://java.net/jira/browse/GLASSFISH-17242) / [LPS-22813](http://issues.liferay.com/browse/LPS-22813)
- Copy
$LIFERAY_SOURCE/tools/servers/glassfish/patches/GLASSFISH-17242/classes/org/glassfish/deployment/admin/InstanceDeployCommand.class
into
org/glassfish/deployment/admin/
of
$GLASSFISH_HOME/modules/deployment-admin.jar
- Copy
$LIFERAY_SOURCE/tools/servers/glassfish/patches/GLASSFISH-17242/classes/com/sun/enterprise/deployment/deploy/shared/Util.class
into
com/sun/enterprise/deployment/deploy/shared/
of
$GLASSFISH_HOME/modules/deployment-common.jar
- Copy
$LIFERAY_SOURCE/tools/servers/glassfish/patches/GLASSFISH-17242/classes/com/sun/enterprise/v3/server/SnifferManagerImpl$1.class
*and*
$LIFERAY_SOURCE/tools/servers/glassfish/patches/GLASSFISH-17242/classes/com/sun/enterprise/v3/server/SnifferManagerImpl.class
into
`com/sun/enterprise/v3/server/`
of
`$GLASSFISH_HOME/modules/kernel.jar`
- For issue [GRIZZLY-1060](http://java.net/jira/browse/GRIZZLY-1060):
- Copy
$LIFERAY_SOURCE/tools/servers/glassfish/patches/GRIZZLY-1060/classes/com/sun/grizzly/util/OutputWriter.class
into
com/sun/grizzly/util/
of
$GLASSFISH_HOME/modules/grizzly-utils.jar
Terrific, you have your JAR files just where you'll need them. Next we'll configure your domain.
Domain Configuration
There are a couple of modifications you need to make in your domain in order to use Liferay Portal.
Before starting GlassFish, modify your domain's configuration to do the following:
- Set the file encoding
- Set the user time-zone
- Set the preferred protocol stack
- Prevent the application server from setting static fields (final or non-final) to
null - Increase the default amount of memory available.
Modify
/glassfish-3.1-web/glassfish3/glassfish/domains/domain1/config/domain.xmlmerging in the following JVM options into the current list of JVM options within your<java-config>element:<jvm-options>-Dfile.encoding=UTF8</jvm-options> <jvm-options>-Djava.net.preferIPv4Stack=true</jvm-options> <jvm-options>-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false</jvm-options> <jvm-options>-Duser.timezone=GMT</jvm-options> <jvm-options>-Xmx1024m</jvm-options> <jvm-options>-XX:MaxPermSize=512m</jvm-options>Be sure that any existing options with values such as
-Dfile.encoding,-Djava.net.preferIPv4Stack,-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES,-Duser.timezone, or-XX:MaxPermSizeare replaced with the new values listed above.For example, replace:
<jvm-options>-Xmx256m</jvm-options>with this:
<jvm-options>-Xmx1024m</jvm-options>Delete, rename, or move the
domain1/docroot/index.htmlfile to another location to allow your Liferay Portal default page to be displayed.
Next, let's get your database configured.
Database Configuration
If you want to use GlassFish to manage your domain's data source, follow the instructions found in this section. If you want to use Liferay Portal to manage your data source, you can skip this section.
Startup your domain's application server, if it is not already running.
Go to the GlassFish console URL: http://localhost:4848.
Under Common Tasks, navigate to Resources → JDBC → JDBC Connection Pools
Figure 11.38: Navigate to JDBC Connection Pools
Click New....
In the first screen (Step 1 of 2), give your connection pool the name
LiferayPool, the resource type ofjavax.sql.ConnectionPoolDataSource, and select your database driver vendor (e.g.MySQL) as follows:
Figure 11.39: Glassfish JDBC Connection Pool
Click Next to advance to the next step in creating your JDBC connection pool.
On the this screen (Step 2 of 2), scroll down to the Additional Properties section.
Figure 11.40: Glassfish JDBC Connection Pool Properties
Replace or add the following properties ...
URL: the URL of your connection pool.
For example,
jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&emulateLocators=trueNote, if you are using the above example, you should specify the name of your database in place of
lportal. Likewise, if your database is not on the same host as GlassFish, specify your the database server's host name in place oflocalhost. Lastly, specify your database type in place ofjdbc:mysql.user: the name of your database user.
password: your database user's password.
Click Finish.
You should now see your
LiferayPoolconnection pool listed under Resources → JDBC → JDBC Connection PoolsTest your connection by selecting your
LiferayPoolconnection pool and clicking Ping.If you get a message stating Ping Succeeded, you've succeeded in setting up a connection pool of your data source!
Now, you'll setup a JDBC resource to refer to the
LiferayPoolconnection pool you just created.Navigate to Resources → JDBC → JDBC Resources to show the current JDBC resources listed by their JNDI names.
Click New....
Set the JNDI name to
jdbc/LiferayPooland selectLiferayPoolas the pool name.Click OK.
Congratulations! You've now configured your domain's data source on GlassFish!
Mail Configuration
If you want to use GlassFish to manage your mail session, follow GlassFish's documentation on configuring a JavaMail session with a JNDI name of mail/MailSession. If you want to use Liferay Portal to manage your mail session, you can skip this step.
Domain Configuration - Continued
Let's tie up some loose ends with regards to Liferay being able to access your database and mail session.
Shutdown your domain's application server if it is currently running.
Create a
portal-ext.propertiesfile in the Liferay Home folder mentioned at the beginning of this GlassFish installation section.If you are using Glassfish to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolOtherwise, if you are using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, you can configure the mail session within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
If you are using GlassFish to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSession
Liferay can now communicate with your database and mail session. So let's go ahead and deploy Liferay.
Deploy Liferay
Here are the steps you'll need to follow to deploy Liferay Portal to your domain's server. Before you deploy Liferay Portal, let's consider whether you want to also start the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is automatically invoked. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is then invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To startup the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseOnce you run the setup wizard, the
portal-setup-wizard.propertiesfile that it creates already hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.properties override property values in portal-ext.properties. Start your domain's application server.
Go to the GlassFish console URL: http://localhost:4848
Click Applications in the tree on the left.
Click Deploy.
Under Packaged File to Be Uploaded to the Server, click Choose File and browse to the location of the Liferay Portal
.warfile. Enter Context Root:/Enter Application Name:
liferay-portalClick OK.
If you disabled the setup wizard, your site's home page opens in your browser at http://localhost:8080.
Otherwise, the setup wizard opens in your browser.
See the section on the setup wizard above for how to use the setup wizard.
Your installation of Liferay Portal on GlassFish is complete!
Installing Liferay on Jetty 7
Liferay Home is one folder above Jetty's install location.
For this section, we'll refer to Jetty server's installation location as $JETTY_HOME. If you do not already have an existing Jetty server, we recommend that you download a Liferay/Jetty bundle from http://www.liferay.com/downloads/liferay-portal/available-releases. If you have an existing Jetty server or would like to install Liferay on Jetty manually, please follow the steps below.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
Now that you have all of your installation files, you're ready to start installing and configuring Liferay on Jetty.
Dependency Jars
Let's work with the Liferay depenency jar files first.
Create folder
$JETTY_HOME/lib/ext/liferay.Unzip the jar files found in the Liferay Portal Dependencies zip file to your
$JETTY_HOME/lib/ext/liferayfolder. Take care to extract the zip file's.jarfiles directly into this folder.Next, you need several
.jarfiles which are included as part of the Liferay source distribution. Many application servers ship with these already on the class path, but Jetty does not. The best way to get the appropriate versions of these files is to download the Liferay source code and get them from there. Once you have downloaded the Liferay source, unzip the source into a temporary folder. We'll refer to the location of the Liferay source as$LIFERAY_SOURCE.Copy the following jars from
$LIFERAY_SOURCE/lib/developmentto your$JETTY_HOME/lib/ext/liferayfolder:activation.jarjta.jarmail.jarpersistence.jar
Make sure the JDBC driver for your database is accessible to Jetty. Obtain the JDBC driver for your version of the database server. In the case of MySQL, use
mysql-connector-java-{$version}-bin.jar. You can download the latest MySQL JDBC driver from http://www.mysql.com/products/connector/. Extract the JAR file and copy it to$JETTY_HOME/lib/ext/liferay.
Now that your .jar files are in place, let's configure your domain.
Jetty Configuration
In order to get Jetty ready for running Liferay Portal, you must make a number of modifications that involve configuration files, initialization files, and run scripts.
Create a
start.configfile to modify the behavior of Jetty'sstart.jar. It's best to base yourstart.configfile on the default one found instart.jar.Extract the default start config file
org/eclipse/jetty/start/start.configfrom thestart.jarinto$JETTY_HOME/etcso that you have file$JETTY_HOME/etc/start.config.Add the following property assignment to
$JETTY_HOME/etc/start.configto specify where Jetty should write its logs:jetty.logs=$(jetty.home)/logsAdd the following directive to
$JETTY_HOME/etc/start.configto load all of the.jarand.zipfiles found in your$JETTY_HOME/lib/liferayfolder into your class path:$(jetty.home)/lib/liferay/*
Now that your class loading is specified, let's create initialization files and run scripts that invoke these configuration directives during startup of Jetty
Create initialization file:
$JETTY_HOME/bin/start.iniSTART=../etc/start.config OPTIONS=Server,jsp,resources ../etc/jetty.xml ../etc/jetty-deploy.xml ../etc/jetty-webapps.xml ../etc/jetty-contexts.xml ../etc/jetty-testrealm.xmlThis initialization file does the following:
- Sets
$JETTY_HOME/etc/start.configas your starting configuration file. - Sets your server options.
- Specifies a sequence of deployment descriptor files to be processed.
- Sets
Create a run script appropriate to your operating system:
On Windows, create:
$JETTY_HOME/bin/run.bat@echo off if "" == "%JAVA_HOME%" goto errorJavaHome set "JAVA_OPTS=-Djetty.version=7.5.4 -Djetty.version.date=20111024 -Dfile.encoding=UTF8 -Djava.io.tmpdir=../temp -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m" "%JAVA_HOME%/bin/java" %JAVA_OPTS% -jar ../start.jar goto end :errorJavaHome echo JAVA_HOME not defined. goto end :endOn Unix/Linux, create:
$JETTY_HOME/bin/run.sh#!/bin/sh if [ ! $JAVA_HOME ] then echo JAVA_HOME not defined. exit fi export JAVA_OPTS="-Djetty.version=7.5.4 -Djetty.version.date=20111024 -Dfile.encoding=UTF8 -Djava.io.tmpdir=../temp -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m" $JAVA_HOME/bin/java $JAVA_OPTS -jar ../start.jar
Create a context file
$JETTY_HOME/contexts/root.xmlto specify the context, classpath, and resource base of your web application:<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/</Set> <Set name="extraClasspath"><SystemProperty name="jetty.home" />/lib/jetty-server-<SystemProperty name="jetty.version" />.v<SystemProperty name="jetty.version.date" />.jar,<SystemProperty name="jetty.home" />/lib/jetty-util-<SystemProperty name="jetty.version" />.v<SystemProperty name="jetty.version.date" />.jar,<SystemProperty name="jetty.home" />/lib/jetty-webapp-<SystemProperty name="jetty.version" />.v<SystemProperty name="jetty.version.date" />.jar</Set> <Set name="resourceBase"><SystemProperty name="jetty.home" />/webapps/root</Set> </Configure>Lastly, create the following folders:
$JETTY_HOME/logs- for log files$JETTY_HOME/temp- for temporary files. Note, this folder is specified to our JVM as a temporary folder in the run script you created previously.
Now that your general Jetty startup files are set in place, let's consider how you will manage your data source.
Database Configuration
If you want to manage your data source within Jetty, continue following the instructions in this section. If you want to use the built-in Liferay data source, you can skip this section.
Management of databases in Jetty is done via the file
$JETTY_HOME/etc/jetty.xml. Editjetty.xmland insert the following text within the root element<Configure>to specify the data pool for your data source. Be sure to pass in valuejdbc/LiferayPoolas the second argument.<New id="LiferayPool" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg></Arg> <Arg>jdbc/LiferayPool</Arg> <Arg> <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> <Set name="Url">jdbc:mysql://localhost/lportal? useUnicode=true&characterEncoding=UTF-8</Set> <Set name="User">root</Set> <Set name="Password">root</Set> </New> </Arg> </New>Be sure to replace the URL database value (i.e.
lportal), user value, and password value with values specific to your database.Your data pool needs Jetty's JNDI and Jetty Plus libraries loaded in order to access those classes at runtime. Your
$JETTY_HOME/etc/start.configfile should have sections that load these libraries as long asjndiandplusoptions are specified at startup.To set these options, edit your
$JETTY_HOME/bin/start.inifile and addjndiandplusas values for theOPTIONSvariable:OPTIONS=Server,jsp,resources,jndi,plus
Super! Now you have your database specified and ready for use with Liferay on Jetty. Let's consider your mail session next.
Mail Configuration
If you want to manage your mail session within Jetty, use the following instructions. If you want to use the built-in Liferay mail session, you can skip this section.
Management of mail sessions in Jetty is done via the configuration file $JETTY_HOME/etc/jetty.xml. Edit jetty.xml and insert the following text within the root element <Configure> to specify your mail session. Be sure to pass in value mail/MailSession as the first argument and to replace the mail session values with your own.
<New id="MailSession" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>mail/MailSession</Arg>
<Arg>
<New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
<Set name="user"></Set>
<Set name="password"></Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.pop3.host">pop.gmail.com</Put>
<Put name="mail.pop3.port">110</Put>
<Put name="mail.smtp.host">smtp.gmail.com</Put>
<Put name="mail.smtp.password">password</Put>
<Put name="mail.smtp.user">user</Put>
<Put name="mail.smtp.port">465</Put>
<Put name="mail.transport.protocol">smtp</Put>
<Put name="mail.smtp.auth">true</Put>
<Put name="mail.smtp.starttls.enable">true</Put>
<Put name="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</Put>
<Put name="mail.imap.host">imap.gmail.com</Put>
<Put name="mail.imap.port">993</Put>
<Put name="mail.store.protocol">imap</Put>
</New>
</Set>
</New>
</Arg>
</New>
Great! Now you'll be able to use this mail session with Liferay.
Configuring data sources and mail sessions
Let's revisit your configuration to make sure that we'll be able to access your data source and mail session from Liferay Portal.
First, navigate to the Liferay Home folder, which is one folder above Jetty's install location. Create a file named
portal-ext.properties.If you are using Jetty to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolOtherwise, if you are using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, you can configure the mail session within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
Otherwise, if you are using Jetty to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSession
Let's start your server and deploy Liferay Portal!
Deploy Liferay
Liferay can be deployed as an exploded web archive within $JETTY_HOME/webapps.
If you already have an application folder
$JETTY_HOME/webapps/root, delete it or move it to a location outside of$JETTY_HOME/webapps.Then extract the contents of the Liferay portal
.warfile into$JETTY_HOME/webapps/root.Before you start Liferay Portal, let's consider whether you want to also start the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, setup your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server startup. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.propertiesoverride property values inportal-ext.properties.
Now its time to launch Liferay Portal!
Start Liferay Portal by executing
run.bat(Windows) orrun.sh(Unix/Linux) script from$JETTY_HOME/bin.If the setup wizard was disabled, your site's home page opens in your browser at http://localhost:8080.
Otherwise, the setup wizard opens in your browser.
See the section on the setup wizard above for more information about the setup wizard.
You've just installed and deployed Liferay Portal on Jetty - way to go!
Installing Liferay on JBoss 7
Liferay Home is one folder above JBoss's install location.
Download and install JBoss AS 7.0.x into your preferred directory. This directory is referred to as
$JBOSS_HOMEthroughout this section.Download the latest version of the Liferay Portal
.warfile.Download Liferay's Portal Dependencies.
Now that you have all of your installation files, you are ready to start installing and configuring Liferay on JBoss.
Dependency Jars
Let's work with the dependency jar files first.
Create folder
$JBOSS_HOME/modules/com/liferay/portal/mainand unzip the jar files found in the Liferay Portal Dependencies zip file to this folder. Take care that the zip file's jar files are extracted into the$JBOSS_HOME/modules/com/liferay/portal/mainfolder.Download your database driver
.jarfile and put it into the$JBOSS_HOME/modules/com/liferay/portal/mainfolder as well. For demonstration purposes, we'll download the MySQL Connector/J driver from http://dev.mysql.com/downloads/connector/j/ and put its.jarfile into the$JBOSS_HOME/modules/com/liferay/portal/mainfolder.Create the file
modules.xmlin the$JBOSS_HOME/modules/com/liferay/portal/mainfolder and insert the following contents.<?xml version="1.0"?> <module xmlns="urn:jboss:module:1.0" name="com.liferay.portal"> <resources> <resource-root path="mysql-connector-java-5.1.18-bin.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>If you're using a different database driver, replace the path of the MySQL resource root entry with that of your database driver.
Great! You have your Jar files ready for your domain.
Configuring JBoss
Let's make some adjustments in your configuration to support using Liferay.
You can specify the JBoss server instance's configuration in the XML file $JBOSS_HOME/standalone/configuration/standalone.xml. We'll refer to this file simply as standalone.xml. You must also make some modifications to your configuration and startup scripts found in the $JBOSS_HOME/bin/ folder. But let's start with the changes to standalone.xml.
Make the following modifications to
standalone.xml.Disable the welcome root of the web subsystem's virtual server default host by specifying
enable-welcome-root="false".<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host"> <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="false"> <alias name="localhost" /> <alias name="example.com" /> </virtual-server> </subsystem>Insert the following
<configuration>element within the web subsystem element<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">.<configuration> <jsp-configuration development="true" /> </configuration>Add a timeout for the deployment scanner by setting
deployment-timeout="120"as seen in the excerpt below.<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0"> <deployment-scanner name="default" path="deployments" scan-enabled="true" scan-interval="5000" relative-to="jboss.server.base.dir" deployment-timeout="120"/> </subsystem>Add the following JAAS security domain to the security subsystem
<security-domains>defined in element<subsystem xmlns="urn:jboss:domain:security:1.0">.<security-domain name="PortalRealm"> <authentication> <login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required"/> </authentication> </security-domain>
Now it's time for some changes to your configuration and startup scripts.
Make the following modifications to your standalone domain's configuration script file
standalone.conf(standalone.conf.baton Windows) found in your$JBOSS_HOME/bin/folder.The purpose of these modifications is to do the following:
- Set the file encoding
- Set the user time-zone
- Set the preferred protocol stack
- Increase the default amount of memory available.
Make the following edits as applicable to your operating system:
On Windows, comment out the initial
JAVA_OPTSassignment as demonstrated in the following line:rem set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256MThen add the following
JAVA_OPTSassignment one line above the:JAVA_OPTS_SETline found at end of the file:set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"On Unix, merge the following values into your settings for
JAVA_OPTSreplacing any matching attributes with the ones found in the assignment below:JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m
The prescribed script modifications are now complete for your Liferay installation on JBoss. Next we'll consider the database and mail configuration.
Database Configuration
If you want JBoss to manage your data source, follow the instructions in this section. If you want to use the built-in Liferay data source, you can skip this section.
Modify standalone.xml adding your data source and driver within the <datasources> element of your data sources subsystem.
First, add your data source within the
<datasources>element.<datasource jndi-name="java:/jdbc/LiferayPool" pool-name="LiferayPool" enabled="true" jta="true" use-java-context="true" use-ccm="true"> <connection-url> jdbc:mysql://localhost/lportal </connection-url> <driver> mysql </driver> <security> <user-name> root </user-name> <password> root </password> </security> </datasource>Be sure to replace the URL database value (i.e.
lportal), user value, and password value with values specific to your database.Then add your driver to the
<drivers>element also found within the<datasources>element.<drivers> <driver name="mysql" module="com.liferay.portal"/> </drivers>Your final data sources subsystem should look something like this:
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> <datasources> <datasource jndi-name="java:/jdbc/LiferayPool" pool-name="LiferayPool" enabled="true" jta="true" use-java-context="true" use-ccm="true"> <connection-url> jdbc:mysql://localhost/lportal </connection-url> <driver> mysql </driver> <security> <user-name> root </user-name> <password> root </password> </security> </datasource> <drivers> <driver name="mysql" module="com.liferay.portal"/> </drivers> </datasources> </subsystem>
Now that you've configured your data source, let's go over how to configure your mail session within JBoss.
Mail Configuration
At the time this document was written, JavaMail was not yet supported in JBoss AS 7.0.1 - however, it was implemented in the JBoss AS 7.1 alpha (see https://issues.jboss.org/browse/AS7-1177. If you want JBoss to manage your mail session, use the following instructions which are based on the implementation found in JBoss AS 7.1 alpha. If you want to use the built-in Liferay mail session, you can skip this section.
Specify your mail subsystem in standalone.xml as in the following example:
<subsystem xmlns="urn:jboss:domain:mail:1.0">
<mail-session jndi-name="java:/mail/MailSession" >
<smtp-server address="smtp.gmail.com" port="465">
<login name="username" password="password"/>
</smtp-server>
<pop3-server address="pop.gmail.com" port="110"/>
<imap-server address="imap.gmail.com" port="993">
<login name="username" password="password"/>
</imap-server>
</mail-session>
</subsystem>
You've got mail! Next, we'll make sure Liferay is configured to properly connect with your new mail session and database.
Configuring data sources and mail sessions
Now that your data source and mail session are set up, you need to make is so that Liferay Portal can access them.
First, navigate to the Liferay Home folder, which is one folder above JBoss's install location (i.e.
$JBOSS/..).If you're using JBoss to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=java:jdbc/LiferayPoolIf you're using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If you're using Liferay Portal to manage your mail session, this configuration is done within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
If you're using JBoss to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=java:mail/MailSession
You've completed the steps necessary for your deployment of Liferay so that Liferay Portal can now communicate with your data source and mail session--way to go! Now you're ready to deploy Liferay Portal.
Deploy Liferay
If the folder
$JBOSS_HOME/standalone/deployments/ROOT.waralready exists in your JBoss installation, delete all of its subfolders and files. Otherwise, create a new folder$JBOSS_HOME/standalone/deployments/ROOT.war.Unzip the Liferay
.warfile into theROOT.warfolder.To trigger deployment of
ROOT.war, create an empty file namedROOT.war.dodeployin your$JBOSS_HOME/standalone/deployments/folder. On startup, JBoss detects the presence of this file and deploys it as a web application.Remove
eclipselink.jarfrom$JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/libto assure that the Hibernate persistence provider is used instead of the one provided in theeclipselink.jar. Note, JBoss 7.0.2 has a known issue http://community.jboss.org/thread/169944 in determining which persistence provider to use.Before you start Liferay Portal, let's consider whether you want to also start the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server startup. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.propertiesoverride property values inportal-ext.properties.
Now it's time to start Liferay Portal on JBoss!
Start the JBoss application server.
If the setup wizard was disabled, your site's home page opens automatically in your browser at http://localhost:8080.
Otherwise, the setup wizard opens in your browser.
See the section on the setup wizard above for how to use Liferay's setup wizard.
Now you are truly the boss when it comes to deploying Liferay Portal on JBoss!
Installing Liferay on Resin 4
Liferay Home is one folder above Resin's install location.
For this section, we will refer to your Resin server's installation location as $RESIN_HOME. If you do not already have an existing Resin server, we recommend that you download a Liferay/Resin bundle from http://www.liferay.com/downloads/liferay-portal/available-releases. If you have an existing Resin server or would like to install Liferay on Resin manually, please follow the steps below.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
Now that you have all of your installation files, you are ready to start installing and configuring Liferay on Resin.
Dependency Jars
Let's work with the depenency jar files first.
Unzip the jar files found in the Liferay Portal Dependencies zip file to your
$RESIN_HOME/ext-libfolder. Take care to extract the zip file's.jarfiles directly into this folder.Next, you need several
.jarfiles which are included as part of the Liferay source distribution. Many application servers ship with these already on the class path, but Resin does not. The best way to get the appropriate versions of these files is to download the Liferay source code and get them from there. Once you have downloaded the Liferay source, unzip the source into a temporary folder. We'll refer to the location of the Liferay source as$LIFERAY_SOURCE.Go to
$LIFERAY_SOURCE/lib/developmentand copysaxpath.jarinto$RESIN_HOME/lib.Go to
$LIFERAY_SOURCE/lib/portaland copylog4j.jar,slf4j-api.jar, andslf4j-log4j12.jarinto$RESIN_HOME/lib.If folder
$RESIN_HOME/extlibdoesn't exist, create it.
Make sure the JDBC driver for your database is accessible by Resin. Obtain the JDBC driver for the database you want to use. In the case of MySQL, use
mysql-connector-java-{$version}-bin.jar. You can download the latest MySQL JDBC driver from http://www.mysql.com/products/connector/. Extract the JAR file and copy it to$RESIN_HOME/extlib.
Great! now you have your .jar files in place. Next, let's configure Resin for Liferay.
Configuring Resin
The primary file used in configuring your domain is $RESIN_HOME/conf/resin.xml. You need to make common modifications necessary to support Liferay Portal. You'll also create a run script and add a folder to hold Resin's logs. But let's start with the changes to resin.xml.
Make the following modifications to your
resin.xml. These modifications to your application cluster do the following:Set the file encoding.
Set the preferred protocol stack.
Set the user time-zone.
Increase the default amount of memory available.
To accomplish this, insert the following
<jvm-arg>elements as server defaults for your main application cluster. Please see the following example:<cluster id="app-tier"> ... <server-default> ... <jvm-arg>-Dfile.encoding=UTF-8</jvm-arg> <jvm-arg>-Djava.net.preferIPv4Stack=true</jvm-arg> <jvm-arg>-Duser.timezone=GMT</jvm-arg> <jvm-arg>-Xmx1024m</jvm-arg> <jvm-arg>-XX:MaxPermSize=256m</jvm-arg> ... </server-default> </cluster>Create an appropriate script in
$RESIN_HOME/binto help you start Resin.If you're on Windows, create a batch script
$RESIN_HOME/bin/run.batand insert the following text in the script:..\resin.exe consoleIf you're on Unix/Linux, create shell script
$RESIN_HOME/bin/run.shand insert the following text in the script:#!/bin/sh ./resin.sh $
Create the folder
$RESIN_HOME/logif it doesn't already exist. As you run Resin, the server generates log filesaccess,jvm-default, andwatchdog-managerin this folder.
Now that you've completed some important common configuration tasks to support Liferay, let's consider database configuration.
Database Configuration
If you want to manage your data source within Resin, continue following the instructions in this section. If you want to use the built-in Liferay data source, you can skip this section.
Management of databases in Resin is done via the configuration file $RESIN_HOME/conf/resin.xml. Edit resin.xml and insert a <database> element for your database. Be sure to give it the JNDI name jdbc/LiferayPool and add it within the application tier cluster element as in the example below:
<cluster id="app-tier">
...
<database>
<jndi-name>jdbc/LiferayPool</jndi-name>
<driver type="com.mysql.jdbc.Driver">
<url>jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8</url>
<user>root</user>
<password>root</password>
</driver>
<prepared-statement-cache-size>8</prepared-statement-cache-size>
<max-connections>20</max-connections>
<max-idle-time>30s</max-idle-time>
</database>
...
</cluster>
Be sure to replace the URL database value (i.e. lportal), user value, and password value with values specific to your database.
Resin is now managing your database connection. Let's consider next how to configure mail.
Mail Configuration
If you want to manage your mail session within Resin, use the following instructions. If you want to use the built-in Liferay mail session, you can skip this section.
Management of mail sessions in Resin is done via the configuration file $RESIN_HOME/conf/resin.xml. Edit resin.xml and insert a <mail> element that specifies your mail session. Be sure to give it the JNDI name mail/MailSession. Add your mail element within the application tier cluster element. Use the example below, replacing its values with the values of your mail session.
<cluster id="app-tier">
...
<mail jndi-name="mail/MailSession">
<properties>
mail.pop3.host=pop.gmail.com
mail.pop3.port=110
mail.pop3.user=
mail.pop3.password=
mail.smtp.host=smtp.gmail.com
mail.smtp.password=password
mail.smtp.user=user
mail.smtp.port=465
mail.transport.protocol=smtp
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.store.protocol=imap
</properties>
</mail>
...
</cluster>
You can specify additional properties for your mail session as needed.
Now that your mail session is squared away, we'll make sure that Liferay can access it.
Configuring data source and mail session
Let's make sure Liferay's connected to your data source and mail session.
First, navigate to the Liferay Home folder, which is one folder above Resin's install location (i.e.
$RESIN_HOME/..).If you're using Resin to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolIf you're using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, configure the mail session within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
If you're using Resin to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSession
Great! Now Liferay can access your database and your mail session. Now, let's deploy Liferay.
Deploy Liferay
Liferay can be deployed as an exploded web archive within $RESIN_HOME/webapps.
If you already have an application folder
$RESIN_HOME/webapps/ROOT, delete it or move it to a location outside of$RESIN_HOME/webapps.Extract the contents of the Liferay portal
.warfile intoRESIN_HOME/webapps/ROOT. The following files should now exist in yourRESIN_HOME/webapps/ROOTfolder:- dtd (folder)
- errors (folder)
- html (folder)
- layouttpl (folder)
- META-INF (folder)
- wap (folder)
- WEB-INF (folder)
- index.jsp
Before you start Liferay Portal, consider whether you want to also start the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server start up. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.propertiesoverride property values inportal-ext.properties.
Start Liferay Portal by executing your
run.bat(Windows) orrun.sh(Unix/Linux) script from$RESIN_HOME/bin.If the setup wizard was disabled, your site's home page opens in your browser at http://localhost:8080.
Otherwise, the setup wizard opens in your browser.
Please see the section above describing how to use the setup wizard.
Congratulations! You've installed Liferay Portal on Resin and have it up and running.
Installing Liferay on Tomcat 7
Liferay Home is one folder above Tomcat's install location.
For this section, we will refer to your Tomcat server's installation location as $TOMCAT_HOME. If you do not already have an existing Tomcat server, we recommend that you download a Liferay/Tomcat bundle from http://www.liferay.com/downloads/liferay-portal/available-releases. If you have an existing Tomcat server or would like to install Liferay on Tomcat manually, please follow the steps below.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
Next, let's get started by addressing Liferay's library dependencies.
Dependency Jars
Liferay Portal needs to have the Liferay Portal Dependency JARs, an appropriate JDBC driver, and a few other JARs installed.
Create folder
$TOMCAT_HOME/lib/ext.Extract the Liferay dependencies file to
$TOMCAT_HOME/lib/ext. If the files do not extract to this directory, you can copy the dependencies archive to this directory, extract them, and then delete the archive.Next, you need several
.jarfiles which are included as part of the Liferay source distribution. Many application servers ship with these already on the class path, but Tomcat does not. The best way to get the appropriate versions of these files is to download the Liferay source code and get them from there. Once you have downloaded the Liferay source, unzip the source into a temporary folder. We'll refer to the location of the Liferay source as$LIFERAY_SOURCE.Copy the following jars from
$LIFERAY_SOURCE/lib/developmentto your$TOMCAT_HOME/lib/extfolder:activation.jarjms.jarjta.jarjutf7.jarmail.jarpersistence.jar
Copy the following jar from
$LIFERAY_SOURCE/lib/portalto your$TOMCAT_HOME/lib/extfolder:ccpp.jar
Note: Tomcat 6 users should not copy the
ccpp.jarfile into their$TOMCAT_HOME/lib/extfolder and should delete it from this folder if it already exists.Copy the following jars from
$LIFERAY_SOURCE/lib/developmentto your$TOMCAT_HOME/temp/liferay/com/liferay/portal/deploy/dependenciesfolder:resin.jarscript-10.jar
Make sure the JDBC driver for your database is accessible by Tomcat. Obtain the JDBC driver for your version of the database server. In the case of MySQL, use
mysql-connector-java-{$version}-bin.jar. You can download the latest MySQL JDBC driver from http://www.mysql.com/products/connector/. Extract the JAR file and copy it to$TOMCAT_HOME/lib/ext.
Now that you have the necessary libraries in place, we'll move on to configuring your domain.
Domain Configuration
The steps in this section focus on:
- Setting environment variables
- Creating a context for your web application
- Modifying the list of classes/JARs to be loaded
- Specifying URI encoding
Let's get started with our configuration tasks.
Create a
setenv.bat(Windows) orsetenv.shfile (Unix, Linux, Mac OS) in the$TOMCAT_HOME/bindirectory. When you start Tomcat, Catalina callssetenv.batorsetenv.sh. Edit the file and populate it with following contents:setenv.bat:
if exist "%CATALINA_HOME%/jre@java.version@/win" ( if not "%JAVA_HOME%" == "" ( set JAVA_HOME= ) set "JRE_HOME=%CATALINA_HOME%/jre@java.version@/win" ) set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"setenv.sh:
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"This sets the character encoding to UTF-8, sets the time zone to Greenwich Mean Time, and allocates memory to the Java virtual machine.
Create the directory
$TOMCAT_HOME/conf/Catalina/localhostand create aROOT.xmlfile in it. Edit this file and populate it with the following contents to set up a portal web application:<Context path="" crossContext="true"> <!-- JAAS --> <!--<Realm className="org.apache.catalina.realm.JAASRealm" appName="PortalRealm" userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal" roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole" />--> <!-- Uncomment the following to disable persistent sessions across reboots. --> <!--<Manager pathname="" />--> <!-- Uncomment the following to not use sessions. See the property "session.disabled" in portal.properties. --> <!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />--> </Context>Setting
crossContext="true"allows multiple web apps to use the same class loader. In the content above you will also find commented instructions and tags for configuring a JAAS realm, disabling persistent sessions, and disabling sessions in general.Open
$TOMCAT_HOME/conf/catalina.propertiesand replace the line:common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jarwith:
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/*.jarThis allows Catalina to access the dependency jars that you extracted to
$TOMCAT_HOME/lib/ext.To ensure consistent use of UTF-8 URI Encoding, edit
$TOMCAT_HOME/conf/server.xmland add the attributeURIEncoding="UTF-8"to your connector that is on port 8080. Below is an example of specifying this encoding on the connector:<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />Make sure that there is no
support-catalina.jarfile in your$TOMCAT_HOME/webappsdirectory. If you find one, remove it.
Excellent work! Now let's consider configuration of your database.
Database Configuration
If you want Tomcat to manage your data source, use the following procedure. If you want to use Liferay's built-in data source, you can skip this section.
Make sure that your database server is installed and working. If it's installed on a different machine, make sure that it's accessible from your Liferay machine.
Add your data source as a resource in the context of your web application specified in
$TOMCAT_HOME/conf/Catalina/localhost/ROOT.xml.<Context...> <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>Note that the above resource definition assumes that your database name is lportal and your MySQL username and password are both root. You'll have to update these values with your own database name and credentials.
Your Tomcat managed data source is now configured. Let's move on to your mail session.
Mail Configuration
If you want to manage your mail session within Tomcat, use the following instructions. If you want to use the built-in Liferay mail session, you can skip this section.
Create a mail session bound to mail/MailSession. Edit $TOMCAT_ HOME/conf/Catalina/localhost/ROOT.xml and configure a mail session. Be sure to replace the mail session values with your own.
<Context...>
<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>
Super! Your mail session is configured. Next, we'll make sure Liferay will be able to access your mail session and database.
Configuring your database and mail session
In this section we'll specify appropriate properties for Liferay to use in connecting to your database and mail session.
If you are using Tomcat to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolOtherwise, if you are using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, you can configure the mail session within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
Otherwise, if you are using Tomcat to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSession
It's just that easy! Now it's time to deploy Liferay Portal on your Tomcat server.
Deploy Liferay
We'll deploy Liferay as an exploded web archive within your $TOMCAT_HOME/webapps folder.
If you are manually installing Liferay on a clean Tomcat server, delete the contents of the
$TOMCAT_HOME/webapps/ROOTdirectory. This undeploys the default Tomcat home page. Then extract the Liferay.warfile to$TOMCAT_HOME/webapps/ROOT.Before you start Liferay Portal, consider whether you want to use the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server startup. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if you want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates should havesetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.propertiesoverride property values inportal-ext.properties.
I bet you can't wait to start Liferay Portal - let's do it!
Start Tomcat by executing
$TOMCAT_HOME/bin/startup.bator$TOMCAT_HOME/bin/startup.sh.If the setup wizard was disabled, your site's home page opens in your browser at http://localhost:8080.
Otherwise, the setup wizard opens in your browser.
To use the setup wizard, please see the section above.
Congratulations on successfully installing and deploying Liferay on Tomcat!
Installing Liferay on WebLogic 10
Liferay Home is one folder above the domain to which you will be installing Liferay. For example, if your domain location is /Oracle/Middleware/user_projects/domains/base_domain, then your Liferay Home is /Oracle/Middleware/user_projects/domains.
For this section, we will refer to your WebLogic server's installation location as $WEBLOGIC_HOME.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
These instructions assume that you have already configured a domain and server, and that you have access to the WebLogic console.
Note
WebLogic 10.0 supports JDK 1.5, but does not support JDK 1.6.Now that you have all of your installation files, you are ready to start installing and configuring Liferay on WebLogic.
Dependency Jars
Liferay requires several .jar files including the Liferay Dependency JARs and a JAR file for your database driver. The following steps describe how to install these .jar files properly.
Navigate to the folder which corresponds to the domain to which you will be installing Liferay. Inside this folder is a
libfolder. Unzip the Liferay dependencies archive to this folder so that the dependency.jarfiles are extracted into thelibfolder.If WebLogic does not already have access to the JDBC driver for your database, copy the driver to your domain's
libfolder as well.You will also need the
xercesImpl.jarcopied to your domain'slibfolder or you will get SAX parsing errors after you deploy Liferay. You may download this from http://xerces.apache.org.Create a folder
$WEBLOGIC-HOME/jrockit_150_15/jre/lib/endorsed. Then copycommons-lang.jar, liferay-rhino.jar,serializer.jar, andxalan.jarto the endorsed folder you just created.
Now that you have your WebLogic installation is loaded up with JAR files for Liferay to use, let's consider how to configure your database.
Database Configuration
If you want WebLogic to manage your data source, use the following procedure. If you want to use Liferay's built-in data source, you can skip this section.
Figure 11.51: WebLogic Data Sources
Browse to your WebLogic Console. Click the Lock & Edit button above the Domain Structure tree on the left side of the page.
From the Domain Structure tree on the left, select Data Sources. Then click the New button on the right side of the screen.
Give the Data Source a name, such as
LiferayDataSource.Define the JNDI name as
jdbc/LiferayPool.Select your Database Type and the Driver class, and then click the Next button.
Accept the defaults on the next screen by clicking Next.
On the next screen, put in your Database Name, Host Name, Database User Name, and Password. If you have been following the defaults we have been using so far, you would use lportal, localhost, root, and no password as the values. Click Next.
The next screen allows you to test your database configuration. Click the Test Configuration button. If the test succeeds, you have configured your database correctly. Select the check box of the server to which you want to deploy this Data Source (
AdminServeris the default). Click Finish.Click the Activate Changes button on the left, above the Domain Structure tree.
Great work! Your data source can now be managed from within WebLogic. Next, let's consider the mail session for your domain.
Mail Configuration
If you want WebLogic to manage your mail sessions, use the following procedure. If you want to use Liferay's built-in mail sessions, you can skip this section.
Figure 11.52: WebLogic: Mail Sessions
In the Domain Structure tree, select Mail Sessions. Then click the Lock & Edit button again to enable modifying these settings.
Click the New button which is now enabled on the right side of the screen.
Give the Mail Session a name, such as
LiferayMail.Select your new LiferayMail session from the list by clicking on it.
On the screen that appears, define the JNDI name as
mail/MailSessionand set your JavaMail properties. Click the Save button.Click the Targets tab. Select the check box of the server to which you want deploy this Data Source to (AdminServer is the default).
Click the Activate Changes button on the left side of the screen, above the Domain Structure tree.
Now you have your mail session specified and ready for Liferay to use.
Domain Configuration - Continued
Let's revisit domain configuration to make sure that we'll be able to access your data source and mail session from Liferay Portal.
First, navigate to the Liferay Home folder.
Then, if you are using WebLogic to manage your data source, add the following to your
portal-ext.propertiesfile in your Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolOtherwise, if you are using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, you can configure the mail session within Liferay Portal. That is, after starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
Otherwise, if you are using WebLogic to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSession
Liferay can now communicate with your data source and mail session. It's now time to deploy Liferay!
Deploy Liferay
Follow the instructions in this section to deploy Liferay Portal to your domain.
Before you deploy Liferay Portal, consider whether you want to use the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server startup. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.properties override property values in portal-ext.properties. Now that you have enabled or disabled the setup wizard, let's move on to deployment of Liferay Portal.
In the Domain Structure tree, select Deployments. Then click the Lock & Edit button above the Domain Structure tree.
Click the Install button on the right side of the screen.
Click the Upload your file(s) link.
Browse to where you have stored the Liferay
.warfile, select it, and then click Next.Select the Liferay
.warfile from the list and click Next.Leave Install this deployment as an application selected and click Next.
Give the application a name (the default name is fine). Leave the other defaults selected and then click Finish.
WebLogic deploys Liferay. When it finishes, a summary screen is displayed. Click the Activate Changes link on the left above the Domain Structure tree.
In the Deployments screen, select the Liferay application and click the Start button. Select Servicing All Requests in the pop up.
Click Yes to continue on the next screen to launch Liferay Portal.
If the setup wizard was disabled, your site's home page opens in your browser at http://localhost:7001.
Otherwise, the setup wizard opens in your browser.
For more information on how to use the setup wizard, please see the section above.
Congratulations on your deployment of Liferay Portal on WebLogic 10!
Installing Liferay on Oracle WebLogic 10.3
Liferay Home is one folder above the domain to which you will be installing Liferay.
For example, if your domain location is /Oracle/Middleware/user_projects/domains/base_domain, then your Liferay Home is /Oracle/Middleware/user_projects/domains.
For this section, we will use $WEBLOGIC_HOME to refer to your WebLogic server's installation /Oracle/Middleware.
Before you begin, make sure you have downloaded the latest Liferay .war file and Liferay Portal dependencies from http://www.liferay.com/downloads/liferay-portal/additional-files. The Liferay .war file should be called liferay-portal-6.1.x-<date>.war and the dependencies file should be called liferay-portal-dependencies-6.1.x-<date>.zip.
These instructions assume that you have already configured a domain and server, and that you have access to the WebLogic console.
If you still have the mainWebApp module installed, remove it first.
Note
There is a known issue with the Sun and JRockit JVMs bundled with WebLogic 10.3.2 (see http://bugs.sun.com/viewbug.do?bugid=6795561). To resolve, use Sun JVM 1.6.0u24 or JRockit JVM 1.6.024.Let's get started by installing the JAR files that Liferay needs.
Dependency Jars
Liferay needs the JAR files contained in the Liferay Dependencies Archive and the driver JAR file applicable for your database.
Navigate to the folder that corresponds to the domain to which you will be installing Liferay. Inside this folder is a
libfolder. Unzip the Liferay Dependencies Archive to this folder so that the dependency.jarfiles reside in thelibfolder.If WebLogic does not already have access to the JDBC driver for your database, copy the driver to your domain's
libfolder as well.
So far so good. Your JAR files are in place and ready for Liferay.
Start Oracle WebLogic if you want to configure your database and/or mail session within Oracle WebLogic.
Database Configuration
If you want WebLogic to manage your data source, use the following procedure. If you want to use Liferay's built-in data source, you can skip this section.
Select Services → Data Sources. Click New → Generic Data Source.
Give your data source a name, such as Liferay Data Source. The JNDI name should be
jdbc/LiferayPool.Choose the type of database and click Next. From the screenshot, you can see that we have chosen MySQL. The database driver class is selected automatically.
Figure 11.57: Creating a data source in WebLogic 10.3
Click Next three times. You should be on the Connection Properties screen. Enter the database name, the host name, the port, the database user name, and the password. WebLogic uses this information to construct the appropriate JDBC URL to connect to your database. Click Next.
WebLogic next confirms the information you provided. For MySQL, some additional parameters must be added to the URL. Modify the JDBC URL so that it has the proper parameters. Provide your database name, host name, user name, and password as the values. Click Next.
Click Test Configuration to make sure WebLogic can connect to your database successfully. When it does, click Finish.
You will be back to the list of data sources. Notice that your new data source has no value in the Target column. Click on your data source to edit it.
Click the Targets tab and check off the server instance(s) to which you wish to deploy your data source. Then click Save.
Next, let's configure a mail session in WebLogic.
Mail Configuration
If you want WebLogic to manage your mail sessions, use the following procedure. If you want to use Liferay's built-in mail sessions, you can skip this section.
Select Mail Sessions and create a new mail session which points to your mail server.
Give it the name Liferay Mail and give it the JNDI name of
mail/MailSessionand click Next.Choose your server and then click Finish.
Now let's make sure Liferay can access this mail session.
Domain Configuration - Continued
Let's revisit domain configuration to make sure that we'll be able to access your data source and mail session from Liferay Portal.
Create a
portal-ext.propertiesfile in the Liferay Home folder, which is one folder up from your domain's home folder.If you are using WebLogic to manage your data source, add the following to your
portal-ext.propertiesfile in Liferay Home to refer to your data source:jdbc.default.jndi.name=jdbc/LiferayPoolIf you are using Liferay Portal to manage your data source, follow the instructions in the Deploy Liferay section for using the setup wizard.
If want to use Liferay Portal to manage your mail session, you can configure the mail session in the Control Panel. After starting your portal as described in the Deploy Liferay section, go to Control Panel → Server Administration → Mail and enter the settings for your mail session.
If you are using WebLogic to manage your mail session, add the following to your
portal-ext.propertiesfile to reference that mail session:mail.session.jndi.name=mail/MailSessionLastly, you must provide WebLogic a reference to Java Server Faces (JSF) in order to use that library. Insert the following deployment descriptor within the
<weblogic-web-app>element ofWEB-INF/weblogic.xmlfound in your Liferay Portal.war:<library-ref> <library-name>jsf</library-name> <specification-version>1.2</specification-version> <implementation-version>1.2</implementation-version> <exact-match>false</exact-match> </library-ref>
Now its the moment you've been waiting for: Liferay deployment!
Deploy Liferay
This section provides instructions for deploying Liferay to your application server domain.
Before you deploy Liferay Portal, consider whether you want to use the setup wizard.
Start the setup wizard along with Liferay Portal - Do this if you want to configure your portal, set up your site's administrative account, and/or manage your database within Liferay.
If this is your first time starting Liferay Portal 6.1, the setup wizard is invoked on server startup. If you want to re-run the wizard, specify
setup.wizard.enabled=truein your properties file (e.g.portal-setup-wizard.properties).setup.wizard.enabled=trueThe setup wizard is invoked during server startup.
Start Liferay Portal without invoking the setup wizard - Do this if want to preserve your current portal settings.
To start the server without triggering the setup wizard, specify
setup.wizard.enabled=falsein your properties (e.g.portal-setup-wizard.propertiesorportal-ext.propertiesfile).setup.wizard.enabled=falseThe
portal-setup-wizard.propertiesfile the setup wizard creates hassetup.wizard.enabled=falseconveniently specified for you.
Note
Property values inportal-setup-wizard.properties override property values in portal-ext.properties. Now, let's deploy Liferay Portal.
Start WebLogic.
Select Deployments and click the Install button. Upload
jsf-1.2.warfrom WebLogic's common files directory, and select Install this deployment as a library.
After installing the JSF libraries, go back to deployments and select the Liferay
.warfile from the file system or click the Upload Your File(s) link to upload it, and then click Next.Select Install this deployment as an application and click Next.
If the default name is appropriate for your installation, keep it. Otherwise, give it a name of your choosing and click Next.
Click Finish. After the deployment finishes, click Save.
Liferay launches in one of the following manners:
If the setup wizard was disabled, your site's home page opens in your browser at http://localhost:7001.
Otherwise, the setup wizard opens in your browser.
Please see the section above for how to use the setup wizard.
Note
Note: After Liferay is installed, you may see an error initializing the Web Proxy portlet. Because the XSL parser configured by default within WebLogic cannot compile a style sheet in this portlet, Liferay disables it by default. To re-enable this portlet, extractxalan.jar and serializer.jar from the Liferay .war archive and copy them to your JDK's endorsed folder for libraries. If you are using JRockit, this folder may be [$WEBLOGIC_HOME]/jrockit_160_05/jre/lib/ext; if your are using Sun JDK, this folder may be [$WEBLOGIC_HOME]/jdk160_24/jre/lib/ext. Congratulations! You are now running Liferay on Oracle WebLogic.
Installing Liferay on WebSphere 8.0
image
Tip: Throughout this installation and configuration process, WebSphere prompts you to Click Save to apply changes to Master Configuration. Do so intermittently to save your changes.Liferay Home is in a folder called liferay in the home folder of the user ID that is running WebSphere.
Preparing WebSphere for Liferay
When the application server binaries have been installed, start the Profile Management Tool to create a profile appropriate for Liferay.
Click on Create…. Choose Application Server. Click Next.
Click the Advanced profile creation option, and then click Next. Why Advanced? You can specify your own values for settings such as the location of the profile and names of the profile, node and host. You can assign your own ports. You can optionally choose whether to deploy the administrative console and sample application and also add web-server definitions if you wish. Web server definitions are used with IBM HTTP Server. For more information about these options, please see the WebSphere documentation.
Figure 11.x: Choose the Advanced profile option to specify your own settings.
Check the box Deploy administrative console. This gives you a web-based UI for working with your application server. Skip the default applications. You'd only install these on a development machine. Click Next.
Set profile name and location. Ensure that you specify a performance tuning setting other than Development, since you're installing a server for production use. Click Next.
Figure 11.x: Use a performance tuning setting other than Development. We've selected Standard here. Please see the WebSphere documentation for further information about performance tuning settings.
- Choose node and host names for your server. These will be specific to your environment. Click Next.
Figure 11.x: Choose node and host names that are appropriate to your environment.
- Administrative security in WebSphere is a way to restrict who has access to the administrative tools. For simplicity, we've disabled it, but you may want to have it enabled in your environment. Please see WebSphere's documentation for further information. Click Next.
Figure 11.x: We've disabled administrative security, but you may want to enable it.
Each profile needs a security certificate, which comes next in the wizard. If you don't have certificates already, choose the option to generate a personal certificate and a signing certficate, and click Next.
Once the certificates are generated, set a password for your keystore. Click Next.
Figure 11.x: Set a password for your keystore.
- Next, you can customize the ports that this server profile uses. Be sure to choose ports that are open on your machine. When choosing ports, installation detects existing WebSphere installations and if it finds activity, it increments ports by one.
Figure 11.x: WebSphere gives you a nice user interface for customizing the ports your server uses.
If you want WebSphere to start automatically when the machine is booted, you configure it next. This differs by operating system. When you're finished configuring this the way you want, click Next.
WebSphere ships with IBM HTTP Server, which is a rebranded version of Apache. If you want to front your WebSphere server with IBM HTTP Server, you'd configure this next. Please see WebSphere's documentation for details on this. When finished, click Next.
WebSphere then creates your profile and finishes with a message telling you the profile was created successfully. You're now ready to install Liferay!
Copying portal dependencies
Liferay ships with dependency .jars that it needs to have on the global classpath. These should be copied to WebSphere's global folder provided for this purpose:
[Install Location]/WebSphere/AppServer/lib/ext
Once you've copied the .jars here, start the server profile you're planning to use for Liferay. Once it starts, you're ready to configure your database.
Database Configuration
If you want WebSphere to manage the database connections, follow the instructions below. Note that this is not necessary if you're planning on using Liferay's standard database configuration; in that case, skip this section. You'll set your database information in Liferay's setup wizard after the install.
Figure 11.x: WebSphere JDBC providers
Start WebSphere.
Open the Administrative Console and log in.
Click Resources → JDBC Providers.
Click New.
For name, enter the name of JDBC provider (e.g. MySQL JDBC Provider).
For Implementation class name, enter:
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Click Next.
Clear any text in classpath. You already copied the necessary
.jars to a location on the server's class path.Click Next.
Click Finish.
Click Data Sources under Additional Properties.
Click New.
Enter a name: liferaydatabasesource.
Enter JNDI:
jdbc/LiferayPool.Everything else should stay at the default values. Save the data source.
When finished, go back into the data source and click Custom Properties, and then click the Show Filter Function button. This is the second from last of the small icons under the New and Delete buttons.
Type user into the search terms and click Go.
Figure 11.x: Modifying data source properties in WebSphere
Select the user property and give it the value of the user name to your database. Click OK and save to master configuration.
Do another filter search for the url property. Give it a value that points to your database. For example, the MySQL URL would be:
jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false. Click OK and save to master configuration.Do another filter search for the password property. Enter the password for the user ID you added earlier as the value for this property. Click OK and save to master configuration.
Go back to the data source page by clicking it in the breadcrumb trail. Click the Test Connection button. It should connect successfully.
Once you've set up your database, you can set up your mail session.
Mail Configuration
If you want WebSphere to manage your mail sessions, use the following procedure. If you want to use Liferay's built-in mail sessions, you can skip this section.
Click Resources → Mail → Mail Providers.
Click the Built-In Mail Provider for your node and server.
Click Mail Sessions, and then click the New button.
Give it a name of liferaymail and a JNDI name of
mail/MailSession. Click OK and save to master configuration.Click Security → Global Security and deselect Use Java 2 security to restrict application access to local resources if it is selected. Click Apply.
Great! Now you're ready to deploy Liferay.
Deploy Liferay
Click Applications → New Application → New Enterprise Application.
Browse to the Liferay
.warfile and click Next.Leave Fast Path selected and click Next, and then click Next again.
Make sure your server is selected and click Next.
Keep the context root set to / and click Next.
Click Finish. When Liferay has installed, click Save to Master Configuration.
Start Liferay
If you plan to use Liferay's setup wizard, skip to the next step. If you wish to use WebSphere's data source and mail session, create a file called
portal-ext.propertiesin your Liferay Home folder. Place the following text in the file:jdbc.default.jndi.name=jdbc/LiferayPool mail.session.jndi.name=mail/MailSession setup.wizard.enabled=false
Select the Liferay application and click Start.
Figure 11.x: Starting Liferay on WebSphere.
- In the setup wizard, select and configure your database type. Click Finish when you're done.
Liferay then creates the tables it needs in the database.
Congratulations! You've installed Liferay on WebSphere!
Making Liferay Coexist with Other Java EE Applications
Liferay Portal by default is configured to sit at the root (i.e., /) of your application server. Dedicating your application server to running only Liferay Portal is a good practice, allowing for separation between your portal environment and your web application environment. This is generally a best practice for portals, which by definition are application development platforms in and of themselves. For that reason, your instance of Liferay is likely to be hosting many applications, and even integrating several of them together on a single page. For this reason, you should design your system so that your portal environment has all the resources it needs to do this. Configuring it so that it is the sole consumer of any other .war files that get deployed to the application server helps to make sure that your system performs optimally.
If, however, you want Liferay to share space on an application server with other applications, you can. In this instance, you may not want to make Liferay the default application in the root context of the server.
There are two steps to modifying this behavior:
Deploy Liferay in a context other than root (for example
/portal).Modify the
portal-ext.propertiesfile to tell Liferay the context to which it has been deployed.
To change the file, open it in a text editor. Place the portal.ctx property at the top of the file:
portal.ctx=/
This default setting defines Liferay Portal as the application that sits at the root context. If you change it to something else, say /portal, for example, you can then deploy Liferay in that context and it will live there instead of at the root context.
A full discussion of the portal-ext.properties file appears in Chapter 14.
Note for WebLogic Users: WebLogic also requires that you modify the weblogic.xml file which is included with Liferay. In this file are tags for the context root:
<context-root>/</context-root>
Change this so that it matches the path you set in your portal-ext.properties file. You will have to modify the weblogic.xml file inside the Liferay .war before you deploy it. Extract the file from the .war file, modify it, and then put it back in the .war file. Then deploy the modified Liferay .war file to the server in the proper context.