WebSphere MQ Tutorial – 1

Any tutorial requires a base to operate on. This first part shows how to install and configure WebSphere MQ 7 on RedHat Enterprise Linux 6.2.

Prepare the Operating System

Download and unzip the installation image

  1. Login to the IBM Partnerworld Software site and download the IBM WebSphere MQ installation image as a tar.gz file
  2. Login as root
  3. Issue the following commands
cd /tmp
mkdir MQ7
cd MQ7
gunzip < | tar -xvf –

Create users and groups

  1. MQ runs only under the mqm user id and mqm group. Any user assigned to the mqm group can administer the server
  2. Issue the following commands
groupadd mqm
useradd -m -g mqm mqm
su – mqm
[mqm@mq1 ~]$ id
uid=501(mqm) gid=502(mqm) groups=502(mqm) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[mqm@mq1 ~]$ exit

Verify Operating System Parameters

  1. Ensure that the sh command points to the bash shell instead of dash or any other shell using the following command
  2. ls -l /bin/sh
    lrwxrwxrwx. 1 root root 4 Apr 23 20:59 /bin/sh -> bash
  3. Check the Operating system kernel parameters using the following commands. For explanation of each of the parameters, check the RedHat Linux manual
  4. cat /proc/sys/kernel/msgmni
    1736
    cat /proc/sys/kernel/shmmni
    4096
    cat /proc/sys/kernel/shmall
    268435456
    cat /proc/sys/kernel/shmmax
    4294967295
    cat /proc/sys/kernel/sem
    250      32000 32    128
    cat /proc/sys/fs/file-max
    100862
    cat /proc/sys/net/ipv4/tcp_keepalive_time

    7200

  5. Edit the /etc/sysctl.conf  file and paste in the following lines
  6. kernel.sem = 500 256000 250 1024
    fs.file-max = 524288 
  7. Check the settings using the following command
  8. sysctl -p
    net.ipv4.ip_forward = 0
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.conf.default.accept_source_route = 0
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    net.ipv4.tcp_syncookies = 1
    error: “net.bridge.bridge-nf-call-ip6tables” is an unknown key
    error: “net.bridge.bridge-nf-call-iptables” is an unknown key
    error: “net.bridge.bridge-nf-call-arptables” is an unknown key
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.shmmax = 4294967295
    kernel.shmall = 268435456
    kernel.sem = 500 256000 250 1024
    fs.file-max = 524288
    /sbin/sysctl fs.file-max
    fs.file-max = 524288
    /sbin/sysctl fs.file-nr
    fs.file-nr = 3936    0     524288

  9. Check the ulimit for max files that can be opened
  10. ulimit -n
    1024
  11. Edit the /etc/security/limits.conf file and paste the following lines
  12. mqm              hard    nofile          10240
    mqm              soft    nofile          10240 
  13. From within the /tmp/MQ7 directory issue the following command to accept the MQ license
  14. ./mqlicense.sh -accept
    Licensed Materials – Property of IBM
                    
     5724-H72
     (C) Copyright IBM Corporation 1994, 2011 All rights reserved.
    US Government Users Restricted Rights – Use, duplication or disclosure
    restricted by GSA ADP Schedule Contract with IBM Corp.
    Agreement accepted:  Proceed with install.

Begin MQ7 Installation

Create MQ7 packages

1. Issue the following commands to create the package rpm’s
pwd
/tmp/MQ7
ls
./crtmqpkg 1
Repackaging WebSphere MQ for “i386” using suffix “1”
#################################################
Repackaging complete  – rpms are at “/var/tmp/mq_rpms/1/i386”

Install the packages

1. Issue the following commands to begin the rpm installation
cd /var/tmp/mq_rpms/1/i386

[root@mq1 i386]# ls
MQSeriesClient_1-7.1.0-0.i386.rpm    MQSeriesMsg_es_1-7.1.0-0.i386.rpm  MQSeriesMsg_ru_1-7.1.0-0.i386.rpm MQSeriesExplorer_1-7.1.0-0.i386.rpm  MQSeriesMsg_fr_1-7.1.0-0.i386.rpm  MQSeriesMsg_Zh_CN_1-7.1.0-0.i386.rpm MQSeriesGSKit_1-7.1.0-0.i386.rpm     MQSeriesMsg_hu_1-7.1.0-0.i386.rpm  MQSeriesMsg_Zh_TW_1-7.1.0-0.i386.rpm MQSeriesJava_1-7.1.0-0.i386.rpm      MQSeriesMsg_it_1-7.1.0-0.i386.rpm  MQSeriesRuntime_1-7.1.0-0.i386.rpm MQSeriesJRE_1-7.1.0-0.i386.rpm       MQSeriesMsg_ja_1-7.1.0-0.i386.rpm  MQSeriesSamples_1-7.1.0-0.i386.rpm MQSeriesMan_1-7.1.0-0.i386.rpm       MQSeriesMsg_ko_1-7.1.0-0.i386.rpm  MQSeriesSDK_1-7.1.0-0.i386.rpm MQSeriesMsg_cs_1-7.1.0-0.i386.rpm    MQSeriesMsg_pl_1-7.1.0-0.i386.rpm  MQSeriesServer_1-7.1.0-0.i386.rpm MQSeriesMsg_de_1-7.1.0-0.i386.rpm    MQSeriesMsg_pt_1-7.1.0-0.i386.rpm  MQSeriesTXClient_1-7.1.0-0.i386.rpm


[root@mq1 i386]# rpm -ivh MQSeries*.rpm
Preparing…                ########################################### [100%]
   1:MQSeriesRuntime_1      ########################################### [  4%]
   2:MQSeriesJRE_1          ########################################### [  8%]
   3:MQSeriesClient_1       ########################################### [ 13%]
   4:MQSeriesJava_1         ########################################### [ 17%]
   5:MQSeriesTXClient_1     ########################################### [ 21%]
   6:MQSeriesExplorer_1     ########################################### [ 25%]
   7:MQSeriesGSKit_1        ########################################### [ 29%]
   8:MQSeriesMan_1          ########################################### [ 33%]
   9:MQSeriesMsg_cs_1       ########################################### [ 38%]
  10:MQSeriesMsg_de_1       ########################################### [ 42%]
  11:MQSeriesMsg_es_1       ########################################### [ 46%]
  12:MQSeriesMsg_fr_1       ########################################### [ 50%]
  13:MQSeriesMsg_hu_1       ########################################### [ 54%]
  14:MQSeriesMsg_it_1       ########################################### [ 58%]
  15:MQSeriesMsg_ja_1       ########################################### [ 63%]
  16:MQSeriesMsg_ko_1       ########################################### [ 67%]
  17:MQSeriesMsg_pl_1       ########################################### [ 71%]
  18:MQSeriesMsg_pt_1       ########################################### [ 75%]
  19:MQSeriesMsg_ru_1       ########################################### [ 79%]
  20:MQSeriesMsg_Zh_CN_1    ########################################### [ 83%]
  21:MQSeriesMsg_Zh_TW_1    ########################################### [ 88%]
  22:MQSeriesSamples_1      ########################################### [ 92%]
  23:MQSeriesSDK_1          ########################################### [ 96%]
  24:MQSeriesServer_1       ########################################### [100%]
[root@mq1 i386]# 

Verify the installation

cd /opt/mqm/bin
./setmqinst -i -p /opt/mqm
83 of 83 tasks have been completed successfuly.
‘Installation1’ (/opt/mqm) set as the Primary Installation.
cd /opt
chown -R mqm:mqm ./mqm
su – mqm
. /opt/mqm/bin/setmqenv -s
dspmqver
Name:        WebSphere MQ
Version:     7.1.0.0
Level:       p000-L111024
BuildType:   IKAP – (Production)
Platform:    WebSphere MQ for Linux (x86 platform)
Mode:        32-bit
O/S:         Linux 2.6.32-220.el6.i686
InstName:    Installation1
InstDesc:   
InstPath:    /opt/mqm
DataPath:    /var/mqm
Primary:     Yes
MaxCmdLevel: 710
crtmqm QMA
There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Directory ‘/var/mqm/qmgrs/QMA’ created.
The queue manager is associated with installation ‘Installation1’.
Creating or replacing default objects for queue manager ‘QMA’.
Default objects statistics : 71 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
strmqm QMA
There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager ‘QMA’ starting.
The queue manager is associated with installation ‘Installation1’.
5 log records accessed on queue manager ‘QMA’ during the log replay phase.
Log replay for queue manager ‘QMA’ complete.
Transaction manager state recovered for queue manager ‘QMA’.
WebSphere MQ queue manager ‘QMA’ started using V7.1.0.0.
runmqsc QMA
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QMA.
DEFINE QLOCAL (QUEUE1)
     1 : DEFINE QLOCAL (QUEUE1)
AMQ8006: WebSphere MQ queue created.
End
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
pwd
/home/mqm
cd /opt/mqm/samp/bin
./amqsput QUEUE1 QMA
Sample AMQSPUT0 start
target queue is QUEUE1
Message1
Message2
Sample AMQSPUT0 end
./amqsget QUEUE1 QMA
Sample AMQSGET0 start
message
message
no more messages
Sample AMQSGET0 end

Tutorial – 1 – End