可参照文档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(DISABLED)
ALTER QALIAS(QNAME) TARGQ(TARGQNAME)
删除队列
DELETE QLOCAL(QNAME)
DELETE QREMOTE(QRNAME)
清除队列中的所有消息
CLEAR QLOCAL(QNAME)
Procedure
What to do next
If your Linux machine was not installed with RPM, you might see a prerequisites failure of /bin/sh when you try to install WebSphere MQ. The failure is because the RPM tables do not recognize that a valid shell interpreter is installed.
If the failure occurs, you can reinstall the /bin/sh shell using RPM, or specify the RPM option --nodeps to disable dependency checking during installation of WebSphere MQ.
WebSphere MQ Components
This lists all of the installable MQ components and other IBM® products that comprise Websphere MQ.
When you install WebSphere® MQ for Linux® , you can choose which components to install.
Component | Description | Package | Server | Client (with SSL) |
Runtime | Mandatory component. Needed for application development and provides support for external applications. | MQSeriesRuntime | X | X |
Server | The server feature allows you to run queue managers on your computer and connect to other computers over a network. Provides messaging and queuing services to applications, and support for WebSphere MQ client connections. | MQSeriesServer | X | |
SDK | Required for compiling applications. | MQSeriesSDK | X | X |
Client | The WebSphere MQ client is a small subset of WebSphere MQ, without a queue manager. Provides remote access to WebSphere MQ . Must be connected to a server. To install a client on the same machine as a server, use the Server CD-ROM; otherwise use the Clients CD-ROM. | MQSeriesClient | X | X |
Sample programs | Sample application programs. Needed if you want to check your WebSphere MQ installation using the verification procedures. | MQSeriesSamples | X | X |
Java™ messaging | ![]() ![]() |
MQSeriesJava | X | X |
SSL support | Support for SSL key management | MQSeriesKeyman | X | X |
IBM Java JRE (32-bit) | ![]() ![]() |
MQSeriesJRE | X | |
Brazilian Portuguese Message catalogs | Brazilian Portuguese message catalogs | MQSeriesMsg_pt | X | X |
Czech Message catalogs | Czech message catalogs | MQSeriesMsg_cs | X | X |
French Message catalogs | French message catalogs | MQSeriesMsg_fr | X | X |
German Message catalogs | German message catalogs | MQSeriesMsg_de | X | X |
Hungarian Message catalogs | Hungarian message catalogs | MQSeriesMsg_hu | X | X |
Italian Message catalogs | Italian message catalogs | MQSeriesMsg_it | X | X |
Japanese Message catalogs | Japanese message catalogs | MQSeriesMsg_ja | X | X |
Korean Message catalogs | Korean message catalogs | MQSeriesMsg_ko | X | X |
Polish Message catalogs | Polish message catalogs | MQSeriesMsg_pl | X | X |
Russian Message catalogs | Russian message catalogs | MQSeriesMsg_ru | X | X |
Spanish Message catalogs | Spanish message catalogs | MQSeriesMsg_es | X | X |
Simplified Chinese Message catalogs | Simplified Chinese message catalogs | MQSeriesMsg_Zh_CN | X | X |
Traditional Chinese Message catalogs | Traditional Chinese message catalogs | MQSeriesMsg_Zh_TW | X | X |
Man pages | UNIX® man pages, in U.S. English, for the following:
|
MQSeriesMan | X | |
Extended Transactional Client | WebSphere MQ component that allows a client application, within the same unit of work:
|
MQSeriesTXClient | X | |
WebSphere MQ Explorer (x86 platform & x86-64 platform only) | The WebSphere MQ Explorer allows you to administer and monitor WebSphere MQ resources. | MQSeriesConfig | X | |
WebSphere Eclipse Platform (x86 platform & x86-64 platform only) | The WebSphere Eclipse Platform is a prerequisite for the WebSphere MQ Explorer and WebSphere MQ File Transfer Application components. | MQSeriesEclipseSDK33 | X | |
WebSphere MQ File Transfer Application (x86 platform only) | The File Transfer Application allows you to send and receive ordinary files in the form of WebSphere MQ messages. You can use the File Transfer Application to send and receive any type of file in any format, for example: ASCII Linux format (with line feed characters), ASCII file Windows® format (with carriage return/line feed characters), binary (for example, image files, wordprocessor files, spreadsheet files, or compressed files), also reports, letters, memos and charts. The File Transfer Application has both a graphical user interface and a command line interface. | MQSeriesFTA | X |
Table 2. Other products supplied with WebSphere MQ
Component | Description | File set | Server | Client |
IBM Global Security Kit V7 | Certificate and SSL Base Runtime - 32 bit | gsk7bas | X | X |
IBM Global Security Kit V7 (POWER®, pSeries x86-64, zSeries s390x platforms only) | Certificate and SSL Base Runtime - 64 bit. | gsk7bas64 | X | X |
Starting the WebSphere MQ Explorer
About this task
strmqcfg
This command is described in the Control Commands section of the WebSphere MQ System Administration Guide . Use this command to ensure the WebSphere MQ Explorer launches correctly.