Tuesday 2 September 2014

Installing IBM WebSphere MQ on Linux

Following on from a previous post: -


I'm getting to grips with IBM Integration Bus 9.0.0.2 and it's prerequisite dependency IBM WebSphere MQ 8.0.

First I'm going to install WMQ ...

I downloaded WMQ from the IBM software download site, resulting in a single TAR file: -

-rw-r--r--@  1 hayd  staff  558767000  2 Sep 06:14 WS_MQ_LINUX_ON_X86_64_V8.0_IMG.tar.gz

This I expanded onto my target RHEL 6.3 box: -

mkdir /tmp/Repo/WMQ
cd /tmp/Repo/WMQ
tar xvzf /mnt/hgfs/Software/WMQ8/WS_MQ_LINUX_ON_X86_64_V8.0_IMG.tar.gz 

This results in a number ( 30 ) of RPMs: -

MQSeriesAMS-8.0.0-0.x86_64.rpm
MQSeriesClient-8.0.0-0.x86_64.rpm
MQSeriesExplorer-8.0.0-0.x86_64.rpm
MQSeriesFTAgent-8.0.0-0.x86_64.rpm
MQSeriesFTBase-8.0.0-0.x86_64.rpm
MQSeriesFTLogger-8.0.0-0.x86_64.rpm
MQSeriesFTService-8.0.0-0.x86_64.rpm
MQSeriesFTTools-8.0.0-0.x86_64.rpm
MQSeriesGSKit-8.0.0-0.x86_64.rpm
MQSeriesJava-8.0.0-0.x86_64.rpm
MQSeriesJRE-8.0.0-0.x86_64.rpm
MQSeriesMan-8.0.0-0.x86_64.rpm
MQSeriesMsg_cs-8.0.0-0.x86_64.rpm
MQSeriesMsg_de-8.0.0-0.x86_64.rpm
MQSeriesMsg_es-8.0.0-0.x86_64.rpm
MQSeriesMsg_fr-8.0.0-0.x86_64.rpm
MQSeriesMsg_hu-8.0.0-0.x86_64.rpm
MQSeriesMsg_it-8.0.0-0.x86_64.rpm
MQSeriesMsg_ja-8.0.0-0.x86_64.rpm
MQSeriesMsg_ko-8.0.0-0.x86_64.rpm
MQSeriesMsg_pl-8.0.0-0.x86_64.rpm
MQSeriesMsg_pt-8.0.0-0.x86_64.rpm
MQSeriesMsg_ru-8.0.0-0.x86_64.rpm
MQSeriesMsg_Zh_CN-8.0.0-0.x86_64.rpm
MQSeriesMsg_Zh_TW-8.0.0-0.x86_64.rpm
MQSeriesRuntime-8.0.0-0.x86_64.rpm
MQSeriesSamples-8.0.0-0.x86_64.rpm
MQSeriesSDK-8.0.0-0.x86_64.rpm
MQSeriesServer-8.0.0-0.x86_64.rpm
MQSeriesXRService-8.0.0-0.x86_64.rpm

First I needed to accept the license agreement: -

./mqlicense.sh 

...
Press Enter to continue viewing the license agreement, or 
enter "1" to accept the agreement, "2" to decline it, "3" 
to print it, "4" to read non-IBM terms, or "99" to go back 
to the previous screen.
1

Agreement accepted:  Proceed with install.

...

I then ran a loop to install the RPMs: -

for i in *.rpm; do rpm --prefix /opt/ibm/mqm -ivh $i; done

I needed to run this several times as  some RPMs depend upon others that have yet to be installed.

Eventually, all were installed: -

...
Preparing...                ########################################### [100%]
package MQSeriesMsg_Zh_TW-8.0.0-0.x86_64 is already installed
Preparing...                ########################################### [100%]
package MQSeriesRuntime-8.0.0-0.x86_64 is already installed

...

which I validated: -

rpm -qa | grep MQSeries

MQSeriesServer-8.0.0-0.x86_64
MQSeriesJRE-8.0.0-0.x86_64
MQSeriesMsg_es-8.0.0-0.x86_64
MQSeriesMsg_ja-8.0.0-0.x86_64
MQSeriesMsg_ru-8.0.0-0.x86_64
MQSeriesExplorer-8.0.0-0.x86_64
MQSeriesGSKit-8.0.0-0.x86_64
MQSeriesRuntime-8.0.0-0.x86_64
MQSeriesSDK-8.0.0-0.x86_64
MQSeriesAMS-8.0.0-0.x86_64
MQSeriesJava-8.0.0-0.x86_64
MQSeriesMan-8.0.0-0.x86_64
MQSeriesMsg_de-8.0.0-0.x86_64
MQSeriesMsg_fr-8.0.0-0.x86_64
MQSeriesMsg_it-8.0.0-0.x86_64
MQSeriesMsg_ko-8.0.0-0.x86_64
MQSeriesMsg_pt-8.0.0-0.x86_64
MQSeriesMsg_Zh_CN-8.0.0-0.x86_64
MQSeriesXRService-8.0.0-0.x86_64
MQSeriesFTBase-8.0.0-0.x86_64
MQSeriesFTTools-8.0.0-0.x86_64
MQSeriesFTAgent-8.0.0-0.x86_64
MQSeriesSamples-8.0.0-0.x86_64
MQSeriesClient-8.0.0-0.x86_64
MQSeriesMsg_cs-8.0.0-0.x86_64
MQSeriesMsg_hu-8.0.0-0.x86_64
MQSeriesMsg_pl-8.0.0-0.x86_64
MQSeriesMsg_Zh_TW-8.0.0-0.x86_64
MQSeriesFTLogger-8.0.0-0.x86_64
MQSeriesFTService-8.0.0-0.x86_64

rpm -qa | grep MQSeries | wc

     30      30     905

I did have one small fright - when I listed the contents of the /opt/ibm/mqm/bin directory, this is what I saw: -


and I assumed that the use of the red font indicated a problem with the installation :-(

Actually, it's NOT a problem - it's merely my shell's way of showing me that the red-flagged binaries have the sticky bit set, meaning that they'll always be executed with the mqm user.

Unlike earlier versions, the MQConfig command is shipped with WMQ 8: -

ls -al `locate mqconfig`

-r-xr-xr-x 1 mqm mqm 51989 Apr 29 15:54 /opt/mqm/bin/mqconfig

This I ran: -

/opt/mqm/bin/mqconfig 

mqconfig: V3.7 analyzing Red Hat Enterprise Linux Server release 6.3
          (Santiago) settings for WebSphere MQ V8.0

System V Semaphores
  semmsl     (sem:1)  250 semaphores                     IBM>=32           PASS
  semmns     (sem:2)  122 of 256000 semaphores   (0%)    IBM>=4096         PASS
  semopm     (sem:3)  32 operations                      IBM>=32           PASS
  semmni     (sem:4)  109 of 2048 sets           (5%)    IBM>=128          PASS

System V Shared Memory
  shmmax              68719476736 bytes                  IBM>=268435456    PASS
  shmmni              8 of 4096 sets             (0%)    IBM>=4096         PASS
  shmall              425311 of 4294967296 pages (0%)    IBM>=2097152      PASS

System Settings
  file-max            4992 of 792980 files       (0%)    IBM>=524288       PASS

Current User Limits (root)
  nofile       (-Hn)  8800 files                         IBM>=10240        WARN
  nofile       (-Sn)  8800 files                         IBM>=10240        WARN

  nproc        (-Hu)  0 of 8800 processes        (0%)    IBM>=4096         PASS
  nproc        (-Su)  0 of 8800 processes        (0%)    IBM>=4096         PASS


Following the recommendations, I increased the nofile ulimits from 8800 to 10240, by editing /etc/security/limits.conf from: -

# End of file
* hard nofile 8800
* soft nofile 8800

to: -

# End of file
* hard nofile 10240
* soft nofile 10240

One log out later, and we're good to go: -

mqconfig: V3.7 analyzing Red Hat Enterprise Linux Server release 6.3
          (Santiago) settings for WebSphere MQ V8.0

System V Semaphores
  semmsl     (sem:1)  250 semaphores                     IBM>=32           PASS
  semmns     (sem:2)  122 of 256000 semaphores   (0%)    IBM>=4096         PASS
  semopm     (sem:3)  32 operations                      IBM>=32           PASS
  semmni     (sem:4)  109 of 2048 sets           (5%)    IBM>=128          PASS

System V Shared Memory
  shmmax              68719476736 bytes                  IBM>=268435456    PASS
  shmmni              8 of 4096 sets             (0%)    IBM>=4096         PASS
  shmall              425311 of 4294967296 pages (0%)    IBM>=2097152      PASS

System Settings
  file-max            4992 of 792980 files       (0%)    IBM>=524288       PASS

Current User Limits (root)
  nofile       (-Hn)  10240 files                        IBM>=10240        PASS
  nofile       (-Sn)  10240 files                        IBM>=10240        PASS
  nproc        (-Hu)  0 of 8800 processes        (0%)    IBM>=4096         PASS
  nproc        (-Su)  0 of 8800 processes        (0%)    IBM>=4096         PASS


I created a dedicated group/user for WMQ: -

groupadd mqm
useradd -g mqm -d /home/mqm mqm
passwd mqm

To test WMQ, I following part of the instructions in this excellent IBM White Paper: -


as user mqm.

...
Create queue manager, with a Dead Letter Queue (DLQ)

crtmqm -u SYSTEM.DEAD.LETTER.QUEUE QM_MDB

Start the queue manager

strmqm QM_MDB

Invoke the administration utility

runmqsc QM_MDB

Within runmqsc, define and start an MQ Listener:

DEFINE LISTENER(TCP.LISTENER) TRPTYPE(TCP) CONTROL(QMGR) PORT(1420)

START LISTENER(TCP.LISTENER)

Define a channel to be used with the MQ Explorer (optional but very useful!):

DEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN)

Define a local queue:

DEFINE QLOCAL(Q_MDB)


Define a topic object:

DEFINE TOPIC(T_MDB) TOPICSTR('sports')

For MQ 7.1 and 7.5, and if desiring to allow remote connections by an MQ Administrator:

set CHLAUTH(*) TYPE(BLOCKUSER) USERLIST('nobody','*MQADMIN')
set CHLAUTH(SYSTEM.ADMIN.*) TYPE(BLOCKUSER) USERLIST('nobody')

Exit runmqsc:

END
...

I then continued to follow the White Paper to configure WebSphere Application Server (WAS) to access the QM_MDB Queue Manager, using JMS / Activation Specifications.

Which is nice :-)

9 comments:

Unknown said...

Hi Sir
I am bigginer in MQ, have followed your steps to install. Now i want to open the MQ in explorer, when i ran strmqcfg it didn’t open. Do i need to install anything befor running this command on linux. Need your help.

Unknown said...

Or do i need to install anything on my windows system, where i can see the things.

Dave Hay said...

Hi Sujeet

Thanks for the comments.

So I've just installed MQ 8 again, on a fresh VM: -

/tmp/mqlicense.sh -accept
rpm -ivh --prefix /opt/ibm/mqm /tmp/MQSeriesRuntime-8.0.0-0.x86_64.rpm
rpm -ivh --prefix /opt/ibm/mqm /tmp/MQSeriesServer-8.0.0-0.x86_64.rpm
rpm -ivh --prefix /opt/ibm/mqm /tmp/MQSeriesSamples-8.0.0-0.x86_64.rpm
rpm -ivh --prefix /opt/ibm/mqm /tmp/MQSeriesJRE-8.0.0-0.x86_64.rpm
rpm -ivh --prefix /opt/ibm/mqm /tmp/MQSeriesExplorer-8.0.0-0.x86_64.rpm
rpm -Uvh --prefix /opt/ibm/mqm /tmp/MQSeriesRuntime-U8009-8.0.0-9.x86_64.rpm
rpm -Uvh --prefix /opt/ibm/mqm /tmp/MQSeriesServer-U8009-8.0.0-9.x86_64.rpm
rpm -Uvh --prefix /opt/ibm/mqm /tmp/MQSeriesSamples-U8009-8.0.0-9.x86_64.rpm
rpm -Uvh --prefix /opt/ibm/mqm /tmp/MQSeriesJRE-U8009-8.0.0-9.x86_64.rpm
rpm -Uvh --prefix /opt/ibm/mqm /tmp/MQSeriesExplorer-U8009-8.0.0-9.x86_64.rpm

and have also installed the RPMs necessary to support the tunnelling of X11 over SSH etc.

/usr/bin/yum --noplugins install -y gtk2
/usr/bin/yum --noplugins install -y xterm
/usr/bin/yum --noplugins install -y libgtk-x11-2.0.so.0
/usr/bin/yum --noplugins install -y libXtst
/usr/bin/yum --noplugins install -y xeyes
/usr/bin/yum --noplugins install -y xauth

With these installed, I can SSH to my Linux VM: -

ssh -Y mqm@mqserver

and start MQ Explorer.

Bottom line, your VM will need to have the necessary X11-related RPMs installed, AND you'll need to be able to tunnel X11 over SSH from your host OS to the VM.

I'm using XQuartz to host an X11 server on macOS. On Windows, other tools such as XMing and Cygwin etc.

Cheers, Dave

Syed Aamer Saeed said...

Hi Dave,
Nice article. As a beginner I have multiple questions.
1. In already installed IBM MQ server how to check that how many queues, listener and channels are already created? and their names?
2. I have installed MQ V9 and I want to know does the order of creation of queue, listener or channel matters?

Dave Hay said...

Hi Syed

Thanks for your comments.

So, as a caveat, I'm not an MQ expert per se and haven't worked with it since I switched job roles in early 2019.

With regard to your first question, I'd suggest exploring a combination of dspmq and runmqsc in a script, similar to the examples in this most excellent presentation from 2014 - The WebSphere MQ Toolbox

The MQ Knowneldge Center is also worth a look ...

With regard to your second question, I believe that the order of creation is Queue > Channel > Listener, but I may well be wrong .....

Thanks, Dave

Syed Aamer Saeed said...

Okay thank you Dave. I have two more questions
Can we see all queues through a runmqsc command because I have read the commands list but in every command we have to give queue name to display its status ......But I want to check all queues that are already defined in a running system.

Dave Hay said...

Hey Syed

Yes, you can run commands such as echo "DISPLAY QUEUE(*)" | runmqsc QM_MDB to see ALL the Queues in a particular Queue Manger.

I'll write a separate post about this shortly ...

Cheers, Dave

Dave Hay said...

Syed

As promised, a post here: -

It's been a while, tinkering with IBM MQ and scripting ...

Hope it's of some use.

Dave

Syed Aamer Saeed said...

Awesome

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...