WebSphere MQ7 在Ubuntu上的安装
可参照文档http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.amq1ac.doc/lq10120_.htm和http://blog.csdn.net/lang_ysh/archive/2010/03/18/5391971.aspx
1. Download WebSphere MQ7 tar.gz
2. run tar -zxvf CZ4VDML.tar.gz
3(optional). 创建WebSphere MQ 必需的文件系统,命令如下:
?? # for product code
?? mkdir /opt/mqm
?? # for working data
?? mkdir /var/mqm
?? 网上看到说MQ安装时候默认的目录就是这两个
4. 创造MQ用户和用户组,命令如下:
?? groupadd mqm
?? useradd -d /var/mqm -g mqm -G mqm mqm
?? # change password to "password"
?? passwd mqm
5. 为mqm用户组添加root组
?? cd /etc
?? vi group
?? 找到mqm:x:1003:mqm增加",root",修改成: mqm:x:1003:mqm,root
6(optional). 调整系统参数(视需要而定,我安装时并没修改)
?? make following kernel changes (/etc/sysctl.conf ):
?? kernel.msgmni = 1024
?? kernel.shmmni = 4096
?? kernel.shmall = 2097152
?? kernel.sem = 500 256000 250 1024
?? fs.file-max = 32768
?? net.ipv4.tcp_keepalive_time = 300
?? To load these sysctl values immediately, enter the command sysctl -p.
?? If you do not issue the sysctl -p command, the new values are loaded when the system is rebooted.
7. 安装rpm
?? sudo apt-get install rpm
8. 转到WebSphere MQ解压后的目录中,获得WebSphere MQ授权,命令如下:
?? ./mqlicense.sh -text_only
?? 阅读全文后,选择1接受授权。
9. 安装WebSphere MQ客户端和服务端,命令如下:
??????? rpm --nodeps -ivh MQSeriesRuntime-7.0.1-0.i386.rpm
??????? rpm --nodeps -ivh MQSeriesSDK-7.0.1-0.i386.rpm
??????? rpm --nodeps -ivh MQSeriesJava-7.0.1-0.i386.rpm
??????? rpm --nodeps -ivh MQSeriesClient-7.0.1-0.i386.rpm
??????? rpm --nodeps -ivh MQSeriesSamples-7.0.1-0.i386.rpm
??????? rpm -nodeps -ivh MQSeriesServer-7.0.1-0.i386.rpm(如果只装客户端,这个没必要安装)
?? 原因: 不加-nodeps会报:
?? root@localhost:/apps# rpm -ivh MQSeriesRuntime-7.0.1-0.i386.rpm
?? error: Failed dependencies:
????????? /bin/sh is needed by MQSeriesRuntime-7.0.1-0.i386
10. 安装校验
??? rpm -qa | grep MQSeries
??? MQSeriesSDK-7.0.1-0
??? MQSeriesClient-7.0.1-0
??? MQSeriesServer-7.0.1-0
??? MQSeriesRuntime-7.0.1-0
??? MQSeriesJava-7.0.1-0
??? MQSeriesSamples-7.0.1-0
??? 安装MQ Explorer还需要安装其它的包:
??? MQSeriesConfig-7.0.1-0.i386.rpm
??? MQSeriesEclipseSDK33-7.0.1-0.i386.rpm
??? MQSeriesJRE-7.0.1-0.i386.rpm
至此MQ安装完成。
下面简要说明一下MQ的配置操作:
安装完MQ,程序本身会把/opt/mqm/bin/目录下面的一些程序链接到/usr/bin/下面,例如crtmqm,runmqsc等等,这些命令只有安装了服务端才有。
???? 1:? 创建队列管理器
?????????? crtmqm q QMgrName
?????????? -q是指创建缺省的队列管理器 。
???? for example:
???? root@localhost:/apps# su mqm
???? $ crtmqm -q QMGR
?????? WebSphere MQ queue manager created.
?????? Directory '/var/mqm/qmgrs/QMGR' created.
?????? Creating or replacing default objects for QMGR.
?????? Default objects statistics : 65 created. 0 replaced. 0 failed.
?????? Completing setup.
?????? Setup completed.
???? 2:? 删除队列管理器
?????????? dltmqm QMgrName
???? 3:? 启动队列管理器
????????? strmqm QmgrName
????????? 如果是启动默认的队列管理器,可以不带其名字
???? 4: 停止队列管理器
???????? endmqm QmgrName 受控停止
???????? endmqm i QmgrName 立即停止
???????? endmqm p QmgrName 强制停止
??? 5:? 显示队列管理器
????????? dspmq m QmgrName
????????? 如果输入dspmq,那么显示的是默认的队列管理器。
???? 6: 运行MQSeries命令
?????????? runmqsc QmgrName
????????? 如果是默认队列管理器,可以不带其名字
???? 7:往队列中放消息
????????? amqsput QName QmgrName
????????? 如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字
????????? 从队列中取出消息
????????? amqsget QName QmgrName
????????? 如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字
???? 8:启动通道
????????? runmqchl c ChlName m QmgrName
????????? 启动侦听
????????? runmqlsr t TYPE p PORT m QMgrName
????????? 停止侦听
????????? endmqlsr -m QmgrName
???? 9: 定义死信队列
???????? DEFINE QLOCAL(QNAME) DEFPSIST(YES) REPLACE
???????? 设定队列管理器的死信队列
???????? ALTER QMGR DEADQ(QNAME)
???????? 定义本地队列
???????? DEFINE QL(QNAME) REPLACE
???????? 定义别名队列
???????? DEFINE QALIAS(QALIASNAME) TARGQ(QNAME)
???????? 远程队列定义
???????? DEFINE QREMOTE(QRNAME) + RNAME(AAA) RQMNAME(QMGRNAME) + XMITQ(QTNAME)
???????? 定义模型队列
???????? DEFINE QMODEL(QNAME) DEFTYPE(TEMPDYN)
???????? 定义本地传输队列
???????? DEFINE QLOCAL(QTNAME) USAGE(XMITQ) DEFPSIST(YES) +
???????? INITQ(SYSTEM.CHANNEL.INITQ)+
???????? PROCESS(PROCESSNAME) REPLACE
??? 10:创建发送方通道
???????? DEFINE CHANNEL(SDRNAME) CHLTYPE(SDR)+
???????? CONNAME(‘100.100.100.215(1418)’) XMITQ(QTNAME) REPLACE
???????? 其中CHLTYPE可以是:SDR、SVR、RCVR、RQSTR、CLNTCONN、SVRCONN、CLUSSDR和CLUSRCVR。
???????? 创建接收方通道
???????? DEFINE CHANNEL(SDR_ TEST) CHLTYPE(RCVR) REPLACE
???????? 创建服务器连接通道
???????? DEFINE CHANNEL(SVRCONNNAME) CHLTYPE(SVRCONN) REPLACE
???????? 显示队列的所有属性
???????? DISPLAY QUEUE(QNAME) [ALL]
???????? 显示队列的所选属性
???????? DISPLAY QUEUE(QNAME) DESCR GET PUT
???????? DISPLAY QUEUE(QNAME)MAXDEPTH CURDEPTH
???????? 显示队列管理器的所有属性
???????? DISPLAY QMGR [ALL]
???????? 显示进程定义
???????? DISPLAY PROCESS(PRONAME)
???????? 更改属性
???????? ALTER QMGR DESCR(‘NEW DESCRIPTION’)
???????? ALTER QLOCAL(QNAME) PUT—ISABLED)
???????? ALTER QALIAS(QNAME) TARGQ(TARGQNAME)
??????? 删除队列
??????? DELETE QLOCAL(QNAME)
??????? DELETE QREMOTE(QRNAME)
??????? 清除队列中的所有消息
??????? CLEAR QLOCAL(QNAME)
?
- This example shows a minimum installation:

Mandatory component. Needed for applicationdevelopment and provides support for external applications.MQSeriesRuntimeXXThe server feature allows you to run queue managerson your computer and connect to other computers over a network. Providesmessaging and queuing services to applications, and support for MQSeriesServerXRequired for compiling applications.MQSeriesSDKXXThe MQSeriesClientXXSample application programs. Needed if you wantto check your MQSeriesSamplesXXThe files needed for messagingusing Java (includes Java Messaging Service).MQSeriesJavaXXSupport for SSL key managementMQSeriesKeymanXXJRE Version 5 for Linux on Intel?,AMD64, i5/OS?, pSeries?, and zSeries?.
MQSeriesJREXBrazilian Portuguese message catalogsMQSeriesMsg_ptXXCzech message catalogsMQSeriesMsg_csXXFrench message catalogsMQSeriesMsg_frXXGerman message catalogsMQSeriesMsg_de XXHungarian message catalogsMQSeriesMsg_huXXItalian message catalogsMQSeriesMsg_itXXJapanese message catalogsMQSeriesMsg_jaXXKorean message catalogsMQSeriesMsg_koXXPolish message catalogsMQSeriesMsg_plXXRussian message catalogsMQSeriesMsg_ruXXSpanish message catalogsMQSeriesMsg_esXXSimplified Chinese message catalogsMQSeriesMsg_Zh_CNXXTraditional Chinese message catalogsMQSeriesMsg_Zh_TWXXUNIX? manpages, in U.S. English, for the following:
MQSeriesManXMQSeriesTXClientXThe MQSeriesConfigXThe WebSphere EclipsePlatform is a prerequisite for the XThe File Transfer Application allows you tosend and receive ordinary files in the form of MQSeriesFTAX
?
Certificate and SSL Base Runtime - 32 bitXXCertificate and SSL Base Runtime - 64 bit. gsk7bas64XX
?
Starting the WebSphere MQ Explorer
About this taskTo start the WebSphere? MQ Explorer,use the following command:
strmqcfgThiscommand is described in the Control Commands section of the WebSphere MQ System Administration Guide.Use this command to ensure the WebSphere MQ Explorerlaunches correctly.
MQSeriesJavaXXSupport for SSL key managementMQSeriesKeymanXXJRE Version 5 for Linux on Intel?,AMD64, i5/OS?, pSeries?, and zSeries?.