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.

Wednesday 12 August 2009

Sending Google talk messages using Python

Google Talk uses the Jabber (XMPP) protocol, and I wanted to use it to send myself notifications from my home weather station and CurrentCost electricity meter.

I found a python module xmpp which looked like it should do the trick, and got it working as follows...

Installed the python xmpp egg by doing:
  • sudo python ./ez_setup.py
  • sudo easy_install xmpppy
(NB: sudo apt-get install python-xmpp works just as well for Linux Debian releases)

Tried the code in the article and comments here: http://www.larsen-b.com/Article/214.html but kept getting authentication errors.

Failed SASL authentification:

This article led me to try turning off SASL with the following line:

client.auth(user='myuser', password='password', sasl=0)

Which dumped some more helpful errors, and eventually made me realise that (for my gmail address) the domain expected in the xmpp.Client is not 'gmail.com' but 'googlemail.com'

I fixed up the paraemters passed to the xmpp.Client constructor, and the following code worked:

import xmpp
client = xmpp.Client('googlemail.com')
client.connect(server=('talk.google.com',5222))
client.auth(user='myuser', password='password')
client.send( xmpp.Message('markrp@gmail.com', 'Hello World'))

Now I have proper push notification to my IM client (Pidgin)

Thursday 19 February 2009

I do like to be beside the seaside

Working from the Sun Bay Hotel in Hope Cove (South Devon) today (on their free WiFi)
http://www.sunbayhotel-hopecove.co.uk/

Monday 9 February 2009

Google Calendar Sync on Linux

To display multiple calendars in Evolution (view only)

  • Create a new Web calendar (right click on calendar)
  • Copy the ICAL address from google
  • change http:// to webcal://
  • Change Refresh interval to something reasonable (otherwise for big calendars Evolution will spend ages getting calendar)

To do 2 way sync

http://gcaldaemon.sourceforge.net/usage16.html#offline

First sync got an error:

FATAL | Connection refused!
com.google.gdata.client.GoogleService$CaptchaRequiredException: Captcha required
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(Unknown Source)

...so needed to unlock a Captcha - https://www.google.com/accounts/DisplayUnlockCaptcha

Your Turn My Turn Notifier

The "Your Turn My Turn Notifier" is available for free download from here:

http://drop.io/ytmtnotifier

It is a simple Java program which puts an icon in your system tray.
The notifier periodically checks the "Your Turn My Turn" RRS feeds, and changes colour and pops up a message when it is your turn to play a game on the "Your Turn My Turn" website.

You can click the icon to see all outstanding games, and to go to a specific game.