Sunday, November 20, 2011

Installing Liferay on MySQL

I'm installing a new web server for the astronomical association Turun Ursa. As we support Liferay at work, using it for this purpose may have some synergy so that I don't need to learn yet-another-portal. Well, not that Liferay is the easiest to learn. Anyhow, it also makes it possible to develop some portlets if I ever need one. I think I may need to redo my planetarium application again in Java - the old C++ version for Sparc stopped working some time ago after some upgrade at the university.

Anyhow, the instructions for doing the proper installation were rather unclear as they didn't really tell much details about creating the database. They referred to a "Chapter 6", which didn't exist at all. I guess they referred to these instructions, which were more helpful. Anyhow, below is a brief summary.

The setup is done here using the database root user. Some Liferay example used that though I don't really see why. Creating a separate Liferay user might be nicer. Well, I have Liferay running as a root anyhow to get it running in port 80, so the database user probably doesn't make it significantly safer.
  1. Shut down the server

    # ./tomcat-6.0.29/bin/shutdown.sh

    ...and wait for a bit.

  2. Move the 7Cogs demo data generator away

    # mv tomcat-6.0.29/webapps/sevencogs-hook/ .
  3. Create the database with a database command and not using the mysqladmin to be able to set the character set. It's probably important.

    # mysql -prootpassword
    mysql> create database lportal character set utf8;
    Query OK, 1 row affected (0.00 sec)

    The MySQL configuration stuff is explained in this wiki.

  4. Create a portal-ext.properties file in the Liferay installation directory with content:

    #
    # MySQL
    #
    jdbc.default.driverClassName=com.mysql.jdbc.Driver
    jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
    jdbc.default.username=root
    jdbc.default.password=rootpassword
  5. Start up the server

    # ./tomcat-6.0.29/bin/startup.sh
  6. Follow that it starts OK

    # tail -F tomcat-6.0.29/logs/catalina.out
Well, rather trivial but took me a bit time as the documentation was a bit...hazy.

Other notes:
  • When first logging in, create a new user account with your own name. Then log out and log in as user "test@liferay.com" with password "test" (this information was not really obvious in the instructions either). Go to Control Panel -> Users and give yourself the Administrator role. You need to remove or disable the "test" account at some point...

No comments: