Open Source Software Technical Articles

Want the Best of the Wazi Blogs Delivered Directly to your Inbox?

Subscribe to Wazi by Email

Your email:

Connect with Us!

Current Articles | RSS Feed RSS Feed

Installing and Running Liferay


Liferay is one of the best enterprise portal options available. The Java-based open source intranet application offers an organization's users the ability to publish and collaborate on documents and web content, and offers social networking features. Administrators can enhance their organizations' content management functionality and customize it to handle different content requirements.

Before you get started with Liferay, you must have a database and Java installed. We chose to use MySQL. If you don't know whether MySQL is installed, you can check by running rpm -qa | grep mysql as root. If necessary, you can install MySQL on any Red Hat-based system, such as CentOS, using the command yum install mysql mysql-server mysql-devel. Download Java and install it with the command rpm -Uvh /path/to/binary/jdk-version.rpm.

In MySQL, create a database for Liferay with the following commands, supplying your own database name and password:

mysql -u root -p
create database YourDatabaseName character set utf8;
create user 'lportal'@'localhost' identified by 'YourDatabasePassword';
grant all privileges on YourDatabaseName.* to 'YourDatabasePassword';
flush privileges;

Now you can install Liferay itself to a directory on your server. The project offers two versions: a Community Edition and an Enterprise Edition, which have some significant differences. You can get the Community Edition bundled with Tomcat, Geronimo, Glassfish, JBoss, Jetty, or other applications, while the Enterprise Edition includes bundled training and support. I downloaded Liferay Community Edition bundled with Tomcat. You can also download and install a Liferay BitNami installer, which can simplify deployment.

Unzip the package into a new working directory with a command like unzip This will by default, create a directory tree that includes subdirectories for Liferay and Tomcat. Browse to the directory /liferay-version/tomcat-version/bin and run Liferay's startup script ./ When the process completes, you should see a message in your terminal window that looks something like INFO: Server startup in 54973 ms. You can then test the server by opening http://localhost:8080 in a locally installed browser. If everything is running correctly, you should see the Liferay portal page. If you don't want to run Liferay with Tomcat using 8080 as your default port, you edit /usr/local/tomcat/conf/server.xml, find Connector name="connector" address="" port="8080", and change the port. Reboot the server to put your change into effect.

When you've restarted the server and used your web browser to visit http://localhost:8080, you'll see a screen populated with Liferay sample data. You need to create an administrator account so you can log in later on. Replace the fictitious portal name, first and last name, and email address with your own. Next, choose a database for Liferay to use to store user accounts and pages created. Still on the main portal page, look under the database area and select Change link, then select MySQL from the pull-down menu. The next two boxes, JDBC URL and JDBC Driver Class Name, should be filled in automatically for you. Enter the MySQL username and password you created earlier into the appropriate boxes, then click on Finish Configuration. From this point on, you can log in to your administrator account by visiting the main portal welcome page.

The Dockbar

After logging into your administrator account, one of the first things you're going to want to check out is the Liferay dockbar, conveniently located at the top of every Liferay page in the portal. It helps to anchor navigation for both users and administrators while providing the administrator easy access to key functions offered by Liferay. Think of it as a control center for your new Liferay portal installation.

[caption id="attachment_187076" align="alignnone" width="372" caption="Liferay's dockbar (close-up)"][/caption]

From the dockbar, you'll find immediate access to three menus and a checkbox.

    • The Add menu lets you add a page at the navigation level you're currently looking at. Below this option are four application types that you can add, including a Web Content Display page, which adds pages to Liferay's Web Content Management system; Asset Publisher, which provides the ability to show bookmarks, blog posts, and other static web content; and Navigation, which provides you with the tools to configure sidebar menu options for internal page linking.

    • The Manage menu lets you maintain existing assets; you can manage a Page, Page Layout, Page Customizations, Site Settings, Site Pages, Site Memberships, and Site Content. Page and a Site Page both bring up a dialog box for page administration, but while the Page dialog box lets you control the current page, Site Pages offers a dialog box for the entire site.

    • The Edit Controls checkbox allows you to toggle user controls on or off from the end user perspective; that is, it toggles the administrator editing features to an invisible mode, so you can see what the site looks like to a regular user.

  • The Go to menu provides access to the Control Panel, where you can find all Liferay portal administration tools. It also provides you with access to My Public Pages and My Private Pages. Public Pages are community pages to be shared between users, while Private Pages are for use by their creators only.

With the dockbar menu on the Liferay welcome page, you can verify that your screen name, email address and other related settings are up-to-date. From the user account section, you even have the option of uploading an image of yourself.


Managing Liferay

Many of the tasks related to managing your Liferay portal are controlled by the control panel, which you can get to from the dockbar's Go to menu, as described above. We'll zero in on the Portal section, and within it the Portal Settings options. Here you can check your portal settings, learn about portal page types, and customize your Liferay installation.

Look at the Portal Settings page on the Control Panel to verify everything listed looks correct. Here you can modify General, Identification, and Miscellaneous settings, with several choices under each category. Under General you'll find Authentication settings; the project provides guidance in selecting the best authentication scheme for your users. The Users area provides multiple tabs with various fields that can be turned on or off, depending on what level of functionality you're looking to offer. In Mail Host Names you can enter listserver settings. Under Email Notifications you can set the administrative user name and email address and tell Liferay to alert you about events such as new user registrations and password changes and resets.

[caption id="attachment_187078" align="alignnone" width="300" caption="Liferay's control panel"][/caption]

The Identification settings let you put in contact information for your organization, while under Miscellaneous you can change the site's language, time zone, logo, and display theme.

When you're happy with the Portal settings, you're ready to get started working with Liferay pages. If you want to manage a number of pages, perhaps to get the site set up to meet your content criteria, select Site Pages from the Control Panel; Site Pages controls pages for the entire site, while Pages controls only the page you happen to be on at that moment.

Liferay offers six Page Type choices. When you set or change a page type for individual pages, the templates selected for those pages will change to reflect the type:

    • A portlet page might be a blog, content display (static written content), or wiki, as controlled by the Manage Site Pages dialog box, which you can invoke from the dockbar on any page.

    • A panel page has multiple portlets available on the page. On a panel page you can move portlets about by using your mouse.

    • An embedded page is designed to display content from a remote website inside of your Liferay portal.

  • You can also show content created by a tool called Liferay Web Content Management, or add links to other site to your Liferay menu.

You can easily customize the look and feel of your Liferay installation by browsing to the Sites page under the Portal section of the control panel. On the customization page you can select a color scheme or upload your company's logo. Just be sure you keep readability the key focus, and bear in mind how the site will look not only for regular browsers but on mobile devices as well.

Once you've set up the structure of your Liferay portal you can start adding users. Earlier I provided a link to a page that talks about user authentication and selecting the best scheme for your needs. If you chose to allow user registration in the Authentication settings area, then the option to Create an Account will appear on the left side of the Liferay welcome page. Additional mechanisms, such as OpenID, may also appear next to the account creation link if you opted to enable the features.

Liferay users are assigned certain roles, which control what they can do on the site. By default, Liferay users may be assigned any of three roles:

    • The community owner has total control over the community, configuration, and content.

    • A community administrator can create content and modify it, but cannot modify content created by others, or add or edit users.

  • A community member is the typical user role.

If you need to add a user manually or promote someone to administrator, go to the dockbar and select Go to, then Control Panel. From the Control Panel, under Portal, select Users and Organizations. Click the Add button, choose User, and fill in the user's details about that person. When you click Save, Liferay will send the new user his password via email, as long as you set up the mail server under Mail Host Names on the Control Panel. By default, all users will be assigned the role of community member, which basically means regular Liferay user. They're capable of reading public pages, creating pages of their own, and editing their own content.

Final Thoughts

A Liferay installation lets non-tech-savvy users easily navigate through the portal, and create and edit its content as allowed by the administrator. Using a Liferay portal for your business saves users time because it provides users a single portal location to manage all of a company's content. The software is simple to install and easy to manage, and the project provides great documentation. With it's wiki-styled pages and Web Content Management tool, Liferay provides a strong collaboration tool from businesses.

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.


grant all privileges on YourDatabaseName.* to 'YourDatabasePassword'; 
Shouldn't that be 
grant all privileges on YourDatabaseName.* to 'lportal'; 
Posted @ Wednesday, October 10, 2012 2:57 AM by Caveman
yes, it should be
Posted @ Wednesday, March 12, 2014 9:01 AM by alex
Post Comment
Website (optional)

Allowed tags: <a> link, <b> bold, <i> italics