Home > Articles, How-to tutorials > Installing Liferay with MySQL, CAS and openLDAP on Ubuntu (part 2)

Installing Liferay with MySQL, CAS and openLDAP on Ubuntu (part 2)

This is second part of of article “Installing Liferay with MySQL, CAS and openLDAP on Ubuntu”.

2. Installing and configuring MySQL

To install MySQL you simply run command:

sudo apt­ get install mysql­-server

Now that we have MySQL installed we can download sql script (that generates schema) and unzip it:

wget http://downloads.sourceforge.net/lportal/liferay-portal-sql-5.2.3.zip

unzip ./liferay-portal-sql-5.2.3.zip

Next you need to enter MySQL shell

mysql -u root -p

and create new database for Liferay

create database lportal character set utf8;
create user ‘lportal’@’localhost’ identified by ‘lportal123’;
grant all privileges on lportal.* to ‘lportal’@’localhost’;
flush privileges;

After entering portal database:

use lportal;

we can generate basic schema:

source liferay-portal-sql-5.2.3/portal-minimal/portal-minimal-mysql.sql

Now we have MySQL installed with database configured for Liferay portal.

3. Installing Liferay portal

Before we move on you need to first download Liferay 5.2.3 zip archive and unpack it somewhere in your file system (for example /home/user/liferay/). We will refer to this folder (or to the path of this folder) as LIFERAY_ROOT further in this tutorial.

Add rights to make tomcat runable:

chmod ­R +x LIFERAY_ROOT/tomcat/bin

Then you need to delete sample data. Liferay (since version 5.2) comes with so-called “sample data”, which must be removed before we move on. Delete :

  • folder LIFERAY_ROOT/tomcat/webapps/sevencogs­hook
  • folder LIFERAY_ROOT/tomcat/webapps/sevencogs­theme
  • folder LIFERAY_ROOT/tomcat/webapps/wol­portlet
  • file LIFERAY_ROOT/data/hsql/lportal.properties
  • file LIFERAY_ROOT/data/hsql/lportal.script

Now you need to only bind your Liferay portal with MySQL database your created earlier. To do that open file LIFERAY_ROOT\tomcat\webapps\ROOT\WEB­-INF\classes\portal­ext.properties for edition and enter lines below:


Now you have properly installed and configured Liferay portal.

4. Configuring SSL

Authentication to your portal should be done using secure connection. That’s why you need to enable SSL in your tomcat. First you need to generate certificate for your server. To do that run JDK tool called keytool:

keytool -­genkey ­-alias tomcat -­keypass asdfgh ­-keyalg RSA

notice that for this tutorial keypass (in other words password) will be ‘asdfgh’. Keytool will ask you few questions, but only one is really important. When asked “What is your first and last name?” you must answer with the DNS name of your server. If you are following this tutorial on your private computer (that do not have DNS name) then provide ‘localhost’ answer. Other questions are irrelevant and you can answer with default values (just keep pressing ENTER).

Now that you have your certificate generated, you can export it to .cert file. Run keytool again:

keytool ­-export ­-alias tomcat ­-keypass asdfgh ­-file server.cert

At the end you need to add your certificate to JDK’s keystore:

keytool ­-import ­-alias tomcat ­-file server.cert ­-keypass asdfgh ­-keystore $JAVA_HOME/jre/lib/security/cacerts

You will be asked for JDK’s keystore pass. By default this password is ‘changeit’.

Now all you need to do is simply enable SSL in your tomcat. In LIFERAY_ROOT/tomcat/conf/sertver.xml add new connector:

<Connector port=”8443″ protocol=”HTTP/1.1″ SSLEnabled=”true”
maxThreads=”150″ scheme=”https” secure=”true”
clientAuth=”false” sslProtocol=”TLS” keystorePass=”asdfgh”/>

Congratulations. You have now enabled SSL in your tomcat.

Go to Part 3 of this tutorial


[1] – Liferay portal page

[2] – Tomcat SSL configuration How-to

  1. tadesse
    March 29, 2010 at 9:05 pm

    It is nice article!
    It really helps to build liferay portal if you would you please post part 3 and part 4

    • paulszulc
      March 29, 2010 at 9:17 pm

      I’ve been busy with work lately. I will publish missing parts of the article in a matter of days

  2. EdH
    July 6, 2010 at 5:26 pm

    Thanks for the information. I have seen a few articles on integrating these products on a fresh install, but none on converting an existing Liferay user base to an LDAP user directory. Are there any utilities that can be used to perform a bulk migration to the LDAP from the internal Liferay db? I’m not even sure how this would work with password migration as migrating Liferay-encrypted passwords to the LDAP and trying to use them with CAS would be impossible.

  1. January 23, 2010 at 11:51 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: