Instant Liferay Portal 6 Starter [Instant] — Save 50%
Create your portal with Liferay and learn its concepts on the go! with this book and ebook
Liferay is an open source portal solution. In this article by Sandeep Nair, author of Instant Liferay Portal 6 Starter, we will understand a little about portals.
(For more resources related to this topic, see here.)
Overview about portals
Well, to understand more about what portals are, let me throw some familiar words at you. Have you used, heard, or seen iGoogle, the Yahoo! home page, or MSN? If the answer is yes, then you have been using portals already.
All these websites have two things in common.
A common dashboard
Information from various sources shown on a single page, giving a uniform experience
For example, on iGoogle, you can have a gadget showing the weather in Chicago, another gadget to play your favorite game of Sudoku, and a third one to read news from around the globe, everything on the same page without you knowing that all of these are served from different websites! That is what a portal is all about.
So, a portal (or web portal) can be thought of as a website that shows, presents, displays, or brings together information or data from various sources and gives the user a uniform browsing experience. The small chunks of information that form the web page are given different names such as gadgets or widgets, portlets or dashlets.
Introduction to Liferay
Now that you have some basic idea about what portals are, let us revisit the initial statement I made about Liferay.
Liferay is an open source portal solution.
If you want to create a portal, you can use Liferay to do this. It is written in Java. It is an open source solution, which means the source code is freely available to everyone and people can modify and distribute it.
With Liferay you can create basic intranet sites with minimal tweaking. You can also go for a full-fledged enterprise banking portal website with programming, and heavy customizations and integrations. Besides the powerful portal capabilities, Liferay also provides the following:
Awesome enterprise and web content management capabilities
Robust document management which supports protocols such as CMIS and WebDAV
Good social collaboration features
Liferay is backed up by a solid and active community, whose members are ever eager to help. Sounds good? So what are we waiting for? Let's take a look at Liferay and its features.
Installation and setup
In four easy steps, you can install Liferay and run it on your system.
Step 1 – Prerequisites
Before we go and start our Liferay download, we need to check if we have the requirements for the installation. They are as follows:
Memory: 2 GB (minimum), 4 GB (recommended).
Disk space: Around 5 GB of free space should be more than enough for the exercises mentioned in the book.
The exercises performed in this book are done on Windows XP. So you can use the same or any subsequent versions of Windows OS. Although Liferay can be run on Mac OSX and Linux, it is beyond the scope of this book how to set up Liferay on them.
The MySQL database should be installed. As with the OS, Liferay can be run on most of the major databases out there in the market. Liferay is shipped with the Hypersonic database by default for demo purpose, which should not be used for a production environment.
Unzip tools such as gzip or 7-Zip.
Step 2 – Downloading Liferay
You can download the latest stable version of Liferay from https://www.liferay.com/downloads/liferay-portal/available-releases.
Liferay comes in the following two versions:
Enterprise Edition: This version is not free and you would have to purchase it. This version has undergone rigorous testing cycles to make sure that all the features are bug free, providing the necessary support and patches.
Community Edition: This is a free downloadable version that has all the features but no enterprise support provided.
Liferay is supported by a lot of open source application servers and the folks at Liferay have made it easy for end users by packaging everything as a bundle. What this means is that if you are asked to have Liferay installed in a JBoss application server, you can just go to the URL previously mentioned and select the Liferay-JBoss bundle to download, which gives you the JBoss Application server installed with Liferay.
We will download the Community Edition of the Liferay-Tomcat bundle, which has Liferay preinstalled in the Tomcat server. The stable version at the time of writing this book was Liferay 6.1 GA2. As shown in the following screenshot, just click on Download after making sure that you have selected Liferay bundled with Tomcat and save the ZIP file at an appropriate location:
Step 3 – Starting the server
After you have downloaded the bundle, extract it to the location of your choice on your machine. You can see a folder named liferay-portal-6.1.1-ce-ga2. The latter part of the name can change based on the version that you download.
Let us take a moment to have a look at the folder structure as shown in the following screenshot:
The liferay-portal-6.1.1-ce-ga2 folder is what we will refer to as LIFERAY_HOME. This folder contains the server, which in our case is tomcat-7.0.27. Let's refer to this folder as SERVER_HOME.
Liferay is created using Java, so to run Liferay we need Java Runtime Environment (JRE). The Liferay bundle is shipped with a JRE by default (as you can see inside our SERVER_HOME). So if you are running a Windows OS, you can directly start and run Liferay. If you are using any other OS, you need to set the JAVA_HOME environment variable.
Navigate to SERVER_HOME/webapps. This is where all the web applications are deployed. Delete everything in this folder except marketplace-portlet and ROOT.
Now go to SERVER/bin and double-click on startup.bat, since we are using Windows OS. This will bring up a console showing the server startup. Wait till you see the Server Startup message in the console, after which you can access Liferay from the browser.
Step 4 – Doing necessary first-time configurations
Once the server is up, open your favorite browser and type in http://localhost:8080.
You will be shown a screen that performs basic configurations, such as changing the database and name of your portal, deciding what should be the admin name and e-mail address, or changing the default locale. This is a new feature introduced in Liferay 6.1 to ease the first-time setup, which on previous versions had to be done using the property file.
Go change the name of the portal, administrator username, and e-mail address. Keep the locale as it is.
As I stated earlier, Liferay is shipped with a default Hypersonic database which is normally used for demo purposes. You can change it to MySQL if you want, by selecting the database type from the drop-down list presented, and typing in the necessary JDBC details. I have created a database in MySQL by the name Portal Starter; hence my JDBC URL would contain that. You can create a blank database in MySQL and accordingly change the JDBC URL. Once you are done making your changes, click on the Finish Configuration button as shown in the following screenshot:
This will open up a screen, which will show the path where this configuration is saved. What Liferay does behind the scenes is creates a property file named portal-setup-wizard.properties and put all the configurations in that. This, as I said earlier, was created manually in the previous versions of Liferay.
A screen will be shown to change the password for your admin user that you earlier specified in the Basic Configuration screen.
After you change the password, you will be presented with a screen to select a password reminder question. Select a question or create your own question from the drop-down list, set the password reminder, and move on.
And that's it!!
Finally, you can see the home page of Liferay. That's it and you are done setting up your very first Liferay instance.
So, we just gained a quick understanding about portals and Liferay and its installation and setup that teaches you how to set up Liferay on your local machine.
Resources for Article :
- Vaadin Portlets in Liferay User Interface Development [Article]
- Setting up and Configuring a Liferay Portal [Article]
- User Interface in Production [Article]
About the Author :
Sandeep has been working in Liferay for more than 4 years and has overall more than 7 years’ experience in Java and Java EE technologies. He has executed projects using Liferay in various domains such as construction, financial, and medical fields, providing solutions like collaboration, enterprise content management, and Web content Management systems.
He has created a free and open source Google Chartlet plugin for Liferay which has been downloaded and used by people across 90 countries according to sourceforge statistics. Besides development, consulting, and implementing solutions he has also been involved in giving training on Liferay in other countries. Before he jumped into Liferay he had experience in Java and Java EE platforms and worked in EJB, Spring, Struts, Hibernate, and Servicemix.He also has experience in using JitterBit, which is an ETL tool.
He has also authored Liferay Beginner’s Guide with Packt Publishing.
When he is not coding, he loves to read books and write blogs.