In my previous post I discussed the reasons that Liferay Portal is interesting from an enterprise solutions perspective, followed by an initial perspective on the out of the box demo. Basically I was able to get the canned demo working, but then attempting to change from the embedded hsql database to mysql was not initially successful. After initially attempting it on Windows, I switched to Linux because MySQL was already installed on that server.
In searching for a solution, I ran across the following the post
Windows Quick Installation Guide For Liferay 5.2.1 With Tomcat 6.0 Bundle and MySQL Database which described the procedure for running against MySQL in a Windows environment. The following procedure is an adaptation of that which worked for me in Linux (Ubuntu). Note: I am assuming that the downloads are installed in my home directory. You can install them anywhere, but need to adjust the instructions accordingly.
1. Download JavaWhile this is not necessary, I decided to bypass the normal Java installation using Ubuntu packages, and instead downloaded and installed the Java SE bundle from SUN. From the menu bar at the top of the page, click Download >> Java SE. While a Java runtime should be sufficient, I downloaded the Java SE Development Kit (JDK) part way down the page.
2. Install Java SDKOnce downloaded, it is necessary to make the downloaded file executable and then execute it to unpack the files. Note: The following assumes you downloaded the JDK into your home directory. From the command prompt:
chmod +x ~/jdk-6u13-linux-i586.bin~/jdk-6u13-linux-i586.bin3. Download the Liferay Portal bundle.Go to the Liferay Portal site
http://www.liferay.com/. Part way down the page, under the heading Liferay Portal Standard Edition click the download link. Note: There are a lot of other bundles to choose from further down on the page, but this will suffice for now. Unzip the downloaded bundle in a directory of your choice. You need to make the scripts in the bundle executable as follows:
chmod +x ~/liferay-portal-5.2.2/tomcat-5.5.27/bin/*.sh
Note: Your versions may be different, so substitute the version numbers in the bundle that you actually downloaded.
4. Monitor Tomcat serverYou can optionally open a new window to monitor the Tomcat server:
tail -f ~/liferay-portal-5.2.2/tomcat-5.5.27/catalina.out5. Run the Basic DemoAt this point you should be able to run the demo bundle using the default HSQL database and demo configuration as follows. Open a command prompt, and change to the root directory of the liferay bundle. Then set the JAVA_HOME environment variable, and run the system. Note: substitute the actual path of your installation. After the system starts up in approximately 1-2 minutes, it should automatically open a window in your browser and display the demo site.
cd ~/liferay-portal-5.2.2JAVA_HOME=~/jdk1.6.0_13export JAVA_HOMEtomcat-5.5.27/bin/startup.sh6. Stop the Basic DemoWhen you are done, shutdown Liferay:
tomcat-5.5.27/bin/shutdown.shThe following steps move to the basic test system, running under mysql. It assumes that mysql is already installed on your system.
7 Remove the Basic App from the BundleI am not sure this is actually required for this step, but it worked when I did it, so why not.
rm -r ~/liferay-portal-5.2.2/tomcat-5.5.27/webapps/sevencogs-themerm -r ~/liferay-portal-5.2.2/tomcat-5.5.27/webapps/sevencogs-hook8. Create MySQL databaseFrom your mysql command prompt:
create database lportal character set utf8;9. Create Configuration Extension FileIn order to tell Liferay to use a MySQL database instead of the preconfigured HSQL database, it is necessary to create the an extension file with the MySQL properties. Note: substitute your own MySQL userid/password in the following
Open the following file using your favorite editor (create if necessary):
~/liferay-portal-5.2.2/tomcat-5.5.27/webapps/ROOT/WEB-INF/classes/portal-ext.propertiesEnter the following lines:
jdbc.default.driverClassName=com.mysql.jdbc.Driverjdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=falsejdbc.default.username=YOURUSERNAMEjdbc.default.password=YOURPASSWORD10. Run the MySQL Test SiteAt this point you should be able to run the test site using the MySQL database. Using the same procedure as step #5, open a command prompt, and change to the root directory of the liferay bundle. Then set the JAVA_HOME environment variable, and run the system.
cd ~/liferay-portal-5.2.2
JAVA_HOME=~/jdk1.6.0_13
export JAVA_HOME
tomcat-5.5.27/bin/startup.sh
You should be able to see a line in the output window where the portal-ext.properties file is loaded, as well as where the MySQL database tables are initially loaded.
Now that I got to this point, it isn't so bad. And in all fairness, it wasn't the XML configuration swamp that kept me from success in the previous post. :-)