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:
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';
After entering portal database:
we can generate basic schema:
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/sevencogshook
- folder LIFERAY_ROOT/tomcat/webapps/sevencogstheme
- folder LIFERAY_ROOT/tomcat/webapps/wolportlet
- 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\portalext.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.
 – Liferay portal page