Liferay 7 Installation Is All You Need To Know Before You Start Working With It

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Liferay 7 installation is all you need to know before you start working with it.

Before start working with Liferay, you need to understand how to do Liferay 7 installation. Though starting from version 7,
Liferay introduced OSGI framework, the installation and setup are more or less similar to its earlier release. In this article, I
will explore all necessary and basic steps to perform Liferay 7 installation in your local environment.
At the time of writing this, Liferay 7 is the latest version released. It is full with new features. It is more powerful than ever
before. You can refer my blog on Liferay 7 (DXP) introduction. Just like all earlier release, Liferay 7 comes with two
flavours

 Community Edition (CE)


 Enterprise Edition (EE)

EE version is now called Digital Experience Portal or DXP in short. Needless to say that, CE version is still fully
opensource and available freely.
The beauty of Liferay 7 lies in the OSGI container which facilitate the modular development. The clear difference you will
experience is brand new and fresh look of Liferay 7 compare to all previous releases. Let us learn how to perform Liferay
7 installation.

Contents [hide]
 Install Java 8
 Liferay 7 Installation
o Download & Other setup.
 Settings for Performance improvement in Local
o Configuration
 First time activities
o Liferay 7.1 folder structure

Install Java 8
The first step in Liferay 7 installation is to install Java. Since, Liferay 7 is compatible with Java 8 (and higher version) only,
you need to install Java 8 first. Liferay took this decision to use all latest features of Java. Also Oracle has announced to
stop any further support for Java 7.
You can refer article on How to install Java on Widows machine and make Java 8 ready before any further action. In that
article, please choose Java 8 while downloading it from oracle site.
Liferay 7 Installation
After installing Java 8, you are ready for Liferay 7 installation. At the time of writing this, 7.1 is the latest version released
by Liferay. You can download Liferay 7.1 from below links.

 Liferay 7.1 CE (Community Edition)


 Liferay 7.1 DXP
Please note that CE version is completely free while DXP version has 30 days trial period. Once expired, you must have
to supply valid license file.

Liferay is a portal and comes as a bundle with Tomcat (since long) and Wildfly (recently introduced). Wildfly is community
project from RedHat company. It is another application server. At this moment, Liferay is recommending to use Tomcat
bundle in standalone environment. So in our case, we will use Liferay 7.1 with tomcat bundle.
Download & Other setup.
Let us first download Liferay 7.1. We will use CE version. Download it from this link. It is in form of ZIP file. Extract it on
some folder in your local. Liferay ships with default database called HSQLDB. It is embedded (in memory) database and
no setup is required. However Liferay does not recommend to use it in production environment.
It would be always great idea to start Liferay server with MySQL database. You need to instruct Liferay to use MySQL
instead of HSQLDB (default) database. For this, just create one file called portal-ext.properties just under the extracted
folder of Liferay server in previous step.
Add following content to portal-ext.properties file.
JavaScript
1 jdbc.default.driverClassName=com.mysql.jdbc.Driver
2 jdbc.default.url=jdbc:mysql://localhost:3306/liferay71ce?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
3 jdbc.default.username=root
4 jdbc.default.password=test

These are JDBC properties used by Liferay 7 to establish interaction with MySQL database. You also need to create a
schema – liferay71ce in MySQL, which I have mentioned in jdbc.default.url property above.
Note: For Liferay 7, you need to install MySQL 5.7 or above.
Settings for Performance improvement in Local
After this. open \tomcat-9.0.6\bin directory from the folder where you unzip the liferay 7.
Before starting Liferay we will do some settings to increase the performance of Liferay in local environment.
Open setenv.bat file in above folder – tomcat-9.0.6\bin. You will see its content as below.
JavaScript

if exist "%CATALINA_HOME%/jre1.6.0_20/win" (
1
    if not "%JAVA_HOME%" == "" (
2
        set JAVA_HOME=
3
    )
4
 
5
    set "JRE_HOME=%CATALINA_HOME%/jre1.6.0_20/win"
6
)
7
 
8
set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true
9
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxMetaspaceSize=512m"
We will update the value of CATALINA_OPTS variable as per be below snippet.

if exist "%CATALINA_HOME%/jre1.6.0_20/win" (
1     if not "%JAVA_HOME%" == "" (
2         set JAVA_HOME=
3     )
4  
5     set "JRE_HOME=%CATALINA_HOME%/jre1.6.0_20/win"
6 )
7  
8 set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true
9 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -XX:NewRatio=3 -Xms1560m -Xmx3072m -XX:
+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=6 -XX:MaxMetaspaceSize=512m"

I have added few JVM options to improve the performance along with Xms and XmX which represents initial and max
memory respectively. You can set the value of Xms and Xmx based on your system configuration and available memory.
You can refer below links to get more detailed information about performance in Liferay

 Liferay Performance Tuning


 Performance tuning
Configuration
You are now ready to start Liferay 7.1. Find startup.bat in same directory and double click on it to start Liferay 7. Since
this is first time, Liferay will create all database table along with sample data and hence it will take little longer time.
Second and subsequent times, Liferay server will take comparatively less time to start. You will see a tomcat console
showing all logs during the startup. Once server is up, you will see first screen on browser as below.
If you wish, you can update Portal Name, First Name. Last Name, Email and Default Language of the portal
from Basic Configuration section. The default details are suffice for local setup and hence I will keep it as it is. Just click
on Finish Configuration button, and Liferay will complete the last step of doing configuration. This is one time task.
Liferay will not ask to set these data next time onward.
Once you save the configuration, Liferay will ask to restart the server to make the above changes in effect. Just
press Ctrl+C from the tomcat (Liferay) console and allow some time to shut down it. The tomcat window will be
disappeared on successful shut down. This is the last step in Liferay 7 installation.
First time activities
Double click on startup.bat file again to start the server. Once server is up and running, you need to login with email
address and password. Give the email address test@liferay.com (in above case) and password as test.
The default password is test. On successful login, Liferay will ask Terms of Use and you have to accept it. In next
screen, Liferay will ask to update the password. After that the next screen will ask you to set security question.
Congratulations, you have successfully completed liferay 7 installation.
By default this user (test@liferay.com) is super admin of liferay portal. Hence it has full access of everything on Liferay 7.
Liferay 7.1 folder structure
Let us get some basic understanding of folder structure of Liferay server. You will see the project structure of Liferay as
per below screenshot.
 

 data: Lifeary 7 stores various data like document library files (in encrypted format), elastic search index files and
HSQLDB (in memory) database details in this folder.
 deploy: This is the folder where you can deploy OSGI modules (JARs) files and WARs files.
 license: This folder contains some copyrights information about the product.
 logs: There is where the logs are generated.
 osgi: This is the folder where all OSGI specific information are stored. For example, Liferay deploys all OSGI
modules in osgi/modules folder while the WARs in osgi/war folder. The folder osgi/marketplace stores lpkg files which
contains the executable out of the box liferay modules. In contrast, all previous releases of Liferay (till 6.2), the liferay
executable code was stored inside ROOT folder of tomcat.
 tomcat-9.0.6: This is tomcat folder. Since we are using tomcat bundle, all tomcat specific files are available inside
this folder.
 tools: This folder contains few of the tools which are used for various purpose like migration from previous
releases.
 work: it is temporary folder created by OSGI container.
 portal-ext.properties : Liferay reads this file on startup. You can override any specific properties in this file. You
can also define your own custom properties which is available across the portal.
 portal-setup-wizard.properties : This file stores the Basic Configuration information about Liferay.
Finally, you are now ready to use Liferay 7.1 portal. We have seen these steps for Windows. Similarly for other operating
systems, above steps are more or less like same. Obviously, it will differ in setting environment variable and choosing
specific file to start Liferay. For example in case of Linux, you need to use .sh files (i.e. startup.sh etc.)

You might also like