Friday 2 October 2009

Install WebSphere MQ on Ubuntu

Strictly speaking, WMQ v7 is only supported on RedHat and SUSE linux, but it runs nicely on Ubuntu once you've got it installed.

WMQ packages are formatted as rpm packages, instead of the more common .deb package format on Debian based releases, and this causes some problems with MQ's installation scripts. It is possible to convert .rpm packages to .deb packages using the 'alien' tool, but it's actually quicker and easier to just install rpm package utility on Ubuntu with the command: sudo apt-get install rpm

If you've already got rpm installed then you can check which packages you've installed with the command
rpm -qa and delete unwanted packages with rpm -e (for instance this is necessary if you've been running a beta version of MQ)

Download the electronic WMQ image (for WMQ v7.0.1 this is CZ4VRML.tar.gz) then follow the instructions in the Linux Quick Beginnings, starting with setting up the user Id and kernel parameters, then accepting the license with
sudo ./mqlicense.sh -text_only

The first problem we hit in using rpm, is that MQ's install scripts have a dependency on the /bin/sh rpm package which is not installed on Ubuntu, so we need to use the rpm --nodeps to disable dependency checking. The commands to install the product are:

Core system
$ sudo rpm --nodeps -ivh MQSeriesClient-7.0.1-0.i386.rpm MQSeriesRuntime-7.0.1-0.i386.rpm MQSeriesSamples-7.0.1-0.i386.rpm MQSeriesSDK-7.0.1-0.i386.rpm MQSeriesServer-7.0.1-0.i386.rpm

SSL, Java, and Eclipse
$ sudo rpm --nodeps -ivh MQSeriesJava-7.0.1-0.i386.rpm MQSeriesConfig-7.0.1-0.i386.rpm MQSeriesEclipseSDK33-7.0.1-0.i386.rpm MQSeriesKeyMan-7.0.1-0.i386.rpm MQSeriesMan-7.0.1-0.i386.rpm MQSeriesJRE-7.0.1-0.i386.rpm

So far so good, it should be possible to create queue managers and run MQ Explorer, but you may see weird error messages when using MQ admin commands, for instance:
$ dspmq
AMQ7047: WebSphere MQ was unable to open a message catalog to display an error
message for message id hexadecimal 20007047, with inserts 0, 0, , , and .
The following command, issued on a system that does not have message catalog
difficulties, may provide more information about that message: mqrc AMQ7047
AMQ7047

This is because the MQ Message catalogue (
amq.cat) has not installed properly. On my machine I have 3 links to amq.cat in
$ locate amq.cat
/usr/share/locale/en/LC_MESSAGES/amq.cat
/usr/share/locale/en_GB/LC_MESSAGES/amq.cat
/usr/share/locale/en_US/LC_MESSAGES/amq.cat

...but
the ultimate target of these links: /usr/share/locale/C/LC_MESSAGES/amq.cat is missing. A quick poke around the MQ runtime package (with sudo rpm -ql -p MQSeriesRuntime-7.0.1-0.i386.rpm |grep amq) shows that the catalogue is there and should have been installed in /usr/share/locale/C/LC_MESSAGES/amq.cat

To get MQ fully working, we need to extract this file from the package and copy it to the correct place. There is a utility which can extract files from rpm packages (rpmcpio) but file-roller - the pre-packaged graphical archive tool - can also read rpm's, so the easiest thing to do is to run the file-roller GUI, extract the file, and then copy it to the correct location like so:

$ file-roller
MQSeriesRuntime-7.0.1-0.i386.rpm
[extract amq.cat]
$ sudo cp
amq.cat /usr/share/locale/C/LC_MESSAGES/amq.cat
$ sudo chown mqm:mqm /usr/share/locale/C/LC_MESSAGES/amq.cat

This fixes the admin commands and allows MQ to display messages like so:

$ dspmq
QMNAME(mp1) STATUS(Running)
QMNAME(qm1) STATUS(Ended immediately)

That should be it - you can now enjoy MQ on your chosen Linux Distro.