Thursday, March 29, 2012

Updating Liferay Tomcat Bundle to use MySQL instead on HSQL

Though we are still on Glassfish because of Java development issues, here are a few notes made whilst mucking about with Tomcat. We created another site ( with Liferay on Tomcat using this approach 'cos we don't intend to do any development on that site
This is all very standard, there are additional security precautions that should be taken at the network, OS, Db, WAS and application layers.
FYI: I've used and as VPS providers. Rimu are little more expensive but better; Daily had some weird thing with their Virtualisation model which fouled up my Java memory somehow when they "patched" it (and incidentally, they rebooted my VPSs far too often for my liking...) - this issue broke two of my websites and I chose to move elsewhere. So, you get what you pay for and I'm with Rimu again - in fact, if you want a really shortcut just ask the guys there to install Liferay when you buy the server!

- On new server you will just have an IP address.
- you will have root access and have a password
- putty to that IP address port 22 and log in as root
1. mkdir /usr/local
2. mkdir /usr/local/downloads
3. mkdir /usr/local/downloads/liferay
4. From the new directory use wget to download the Liferay Tomcat bundle
5. (maybe) if the name of the file that is downloaded is not called '' then rename it using 'mv
6. mkdir /usr/local/downloads/mysql
8. if necessary rename the file correctly to
9. Unzip it.
10. You should have new directory called /usr/local/downloads/mysql/mysql-connector-java-5.1.18
11. there is a file called 'mysql-connector-java-5.1.18-bin.jar' This is important, you will need to copy it to a new location later.
INSTALLATION Step 1 - Default bundle
1. from within /usr/local/downloads/liferay 'cp /usr/local/
2. cd /usr/local
3. unzip
4. ls
- - should see a new directory 'liferay-portal-6.0.6' and the zip file.
5. Delete the zip file: 'rm'
6. cd /usr/local/liferay-portal-6.0.6/tomcat-6.0.29/bin
- - in here you should see a script called ''
7. bash
8. in a browser goto :8080
- - you should see Liferay with the 7 Cogs set up and default demo users.
- - if all is well shutdown 'bash'
The server should have MySQL installed already (that should happen on installation of Ubuntu). so check:
1. sudo netstat -tap | grep mysql
- - you should see something like this:
- - 'tcp 0 0 localhost.localdo:mysql *:* LISTEN 9276/mysqld'
2. reset the root password, you do this using the statement dpkg-reconfigure mysql-server-5.1'
- - the MySQL shuts down and a dos-like dialog box opens up and you can enter a new password (write it down, it's important!).
3. Create a new database called 'lportal'.
- log on to mysql using 'root' and your new password: 'mysql --user=root --password='
4. create the database: and the command prompt, mysql> create database lportal;
- - (NB you need the semi-colon in that statement.
5 confirm the database is created: 'show databases;'
mysql> show databases;
- you should see a list of databases including 'lportal'.
NOTE - this does not create all the tables for the portal, just the empty database. On start up, if Liferay doesn't find the tables it creates the whole database from scratch inside the empty lportal database - Or at least it SHOULD do. If it doesn't you will have to run the script held in the Liferay Dependencies files (see for that).
INSTALLATION Step 3 - Connect to MySQL Database
1. cd /usr/local/downloads/mysql/mysql-connector-java-5.1.18
2. cp mysql-connector-java-5.1.18-bin.jar /usr/local/liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
3. cd /usr/local/liferay-portal-6.0.6/tomcat-6.0.29/lib/ext/
4. ls
- - should see your filed copied there, amongst other stuff.
5. navigate to /usr/local/liferay-portal-6.0.6/tomcat-6.0.29/webapps/ROOT/WEB-INF/classes
6. In here you need to create, and update, the file (this is what tells Tomcat to use the MySQL database)
7. vi
8. paste in the following:
9. .. then :w and :q to save the information.
10. cd /usr/local/liferay-portal-6.0.6/tomcat-6.0.29/bin
11 bash
12 go to :8080 and wait for it to boot up into the default area again. This time, it should be using the MySQL database. You can check this by creating a new portal user and using the MySQL commands to list the users in the lportal database.
You have a production server ready to go.

Monday, January 09, 2012

Installing Liferay on Glassfish and MySQL and Ubuntu Server (again)

Starting Point
Ubuntu 10.04LTS

(Why we are) Installing Liferay on Glassfish and MySQL and Ubuntu Server (again)

Well, strangely enough we have to start again on a new server. A brief history of how we got there is as follows:

* All working fine on our own hosted servers in a garage
* Router issues
* Electricians in for unrelated maintenance so lots of annoying reboots and shutdowns
* VPS ordered with cheap provider
* Cheap provider upgraded virtualisation software and fouled up java memory allocation then asked for more money for more memory (Grrrr...).
* Lots of wailing and gnashing of teeth and swearing
* VPS ordered with Rimuhosting
* VPS with Cheap provider cancelled.

...which, to cut that long and tortuous story short is why i'm here again to explain how to install Liferay on Ubuntu/MySQL/Glassfish.

Please note: if you want Liferay on Tomcat and don't have anything other than vanilla Liferay in mind then ask the nice people at Rimuhosting to install it from the bundle when you commission the server - they have a script for that sort of thing and you will save yourself much grief (be sure to ask for the MySQL stuff though as the Derby/HSQL is not for productive systems, etc.)