1.建立mq用户及目录。
[root@GCP2-APP38-VM]#mkdir /var/mqm ###业务数据存放目录
[root@GCP2-APP38-VM]#mkdir /opt/mqm ###软件安装目录
[root@GCP2-APP38-VM]#groupadd mqm
[root@GCP2-APP38-VM]#useradd -d /var/mqm -g mqm -s /usr/sbin -m mqm
[root@GCP2-APP38-VM]#passwd mqm
[root@GCP2-APP38-VM]#chown -R mqm:mqm /opt/mqm
[root@GCP2-APP38-VM]#chown -R mqm:mqm /var/mqm
2. 获取mq介质CI8HQML-linux.tar.gz,放到/tmp下并解压。
[root@GCP2-APP38-VM tmp]# mkdir mq
[root@GCP2-APP38-VM tmp]# tar -zxf CI8HQML-linux.tar.gz -C mq
3.查看解压后的文件
[root@GCP2-APP38-VM tmp]# cd mq
[root@GCP2-APP38-VM mq]# ls
copyright MQSeriesFTLogger-7.5.0-0.x86_64.rpm MQSeriesMsg_fr-7.5.0-0.x86_64.rpm
MQSeriesRuntime-7.5.0-0.x86_64.rpm
crtmqpkg MQSeriesFTService-7.5.0-0.x86_64.rpm MQSeriesMsg_hu-7.5.0-0.x86_64.rpm
MQSeriesSamples-7.5.0-0.x86_64.rpm
lap MQSeriesFTTools-7.5.0-0.x86_64.rpm MQSeriesMsg_it-7.5.0-0.x86_64.rpm
MQSeriesSDK-7.5.0-0.x86_64.rpm
licenses MQSeriesGSKit-7.5.0-0.x86_64.rpm MQSeriesMsg_ja-7.5.0-0.x86_64.rpm
MQSeriesServer-7.5.0-0.x86_64.rpm
mqlicense.sh MQSeriesJava-7.5.0-0.x86_64.rpm MQSeriesMsg_ko-7.5.0-0.x86_64.rpm
MQSeriesXRClients-7.5.0-0.x86_64.rpm
MQSeriesAMS-7.5.0-0.x86_64.rpm MQSeriesJRE-7.5.0-0.x86_64.rpm MQSeriesMsg_pl-7.5.0-0.x86_64.rpm
MQSeriesXRService-7.5.0-0.x86_64.rpm
MQSeriesClient-7.5.0-0.x86_64.rpm MQSeriesMan-7.5.0-0.x86_64.rpm MQSeriesMsg_pt-7.5.0-0.x86_64.rpm PreReqs
MQSeriesExplorer-7.5.0-0.x86_64.rpm MQSeriesMsg_cs-7.5.0-0.x86_64.rpm MQSeriesMsg_ru-7.5.0-0.x86_64.rpm READMEs
MQSeriesFTAgent-7.5.0-0.x86_64.rpm MQSeriesMsg_de-7.5.0-0.x86_64.rpm MQSeriesMsg_Zh_CN-7.5.0-0.x86_64.rpm repackage
MQSeriesFTBase-7.5.0-0.x86_64.rpm MQSeriesMsg_es-7.5.0-0.x86_64.rpm MQSeriesMsg_Zh_TW-7.5.0-0.x86_64.rpm
4.运行授权命令 ###-text_only作为测试使用,90天试用期。-accept需要购买license。
[root@GCP2-APP38-VM mq]# ./mqlicense.sh -text_only
Licensed Materials - Property of IBM
5724-H72
(C) Copyright IBM Corporation 1994, 2012 All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure
restricted by GSA ADP Schedule Contract with IBM Corp.
License has already been accepted: Proceed with install.
5.执行安装命令。我安装的是最简服务端。
[root@GCP2-APP38-VM mq]# rpm -ivh MQSeriesRuntime-7.5.0-0.x86_64.rpm
Preparing... ########################################### [100%]
1:MQSeriesRuntime ########################################### [100%]
[root@GCP2-APP38-VM mq]# rpm -ivh MQSeriesSDK-7.5.0-0.x86_64.rpm
Preparing... ########################################### [100%]
1:MQSeriesSDK ########################################### [100%]
[root@GCP2-APP38-VM mq]# rpm -ivh MQSeriesServer-7.5.0-0.x86_64.rpm
Preparing... ########################################### [100%]
1:MQSeriesServer ########################################### [100%]
[root@GCP2-APP38-VM mq]# rpm -ivh MQSeriesJava-7.5.0-0.x86_64.rpm
Preparing... ########################################### [100%]
1:MQSeriesJava ########################################### [100%]
[root@GCP2-APP38-VM mq]# rpm -ivh MQSeriesSamples-7.5.0-0.x86_64.rpm
Preparing... ########################################### [100%]
1:MQSeriesSamples ########################################### [100%]
6.查看组件安装详情。
[root@GCP2-APP38-VM mq]# rpm -qa |grep MQ
MQSeriesJava-7.5.0-0.x86_64
MQSeriesSDK-7.5.0-0.x86_64
MQSeriesRuntime-7.5.0-0.x86_64
MQSeriesSamples-7.5.0-0.x86_64
MQSeriesServer-7.5.0-0.x86_64
7.用mqm登陆,创建测试队列管理器和队列
[mqadmin@GCP2-APP38-VM ~]$ su - mqm
密码:
[mqm@GCP2-APP38-VM ~]$ crtmqm -q venus.queue.manager ###创建缺省队列管理器
There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Directory '/var/mqm/qmgrs/venus!queue!manager' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'venus.queue.manager'.
Default objects statistics : 74 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
-------PS:如果出现ctrmqm:command not found,在mqm用户环境变量中添加PATH=/var/mqm/bin:/opt/mqm/samp/bin:/opt/mqm/bin:bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin,刷新即可。
[mqm@GCP2-APP38-VM ~]$ strmqm venus.queue.manager ###启动队列管理器
There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager 'venus.queue.manager' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'venus.queue.manager' during the log replay phase.
Log replay for queue manager 'venus.queue.manager' complete.
Transaction manager state recovered for queue manager 'venus.queue.manager'.
WebSphere MQ queue manager 'venus.queue.manager' started using V7.5.0.0.
8.进入控制台,定义本地队列
[mqm@GCP2-APP38-VM ~]$ runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2011. ALL RIGHTS RESERVED.
Starting MQSC for queue manager venus.queue.manager.
define qlocal (orange.queue) ###需要先建立orange.queue队列
2 : define qlocal (orange.queue)
AMQ8006: WebSphere MQ queue created.
end
9.切换到/opt/mqm/samp/bin下,向队列发送消息。
[mqm@GCP2-APP38-VM bin]$ ./amqsput ORANGE.QUEUE ###队列必须用大写
Sample AMQSPUT0 start
target queue is ORANGE.QUEUE
THIS IS A TEST MESSAGE ###这是自己输入的一条消息,回车两次发送
Sample AMQSPUT0 end
10.从队列中读取消息。
[mqm@GCP2-APP38-VM bin]$ ./amqsget ORANGE.QUEUE
Sample AMQSGET0 start
message <THIS IS A TEST MESSAGE> ###这里表示成功接收消息。
no more messages
Sample AMQSGET0 end
11.升级到生产版
获取license,运行./setmqprd $path/amqpcert.lic
####如果给队列赋权限后用户仍无法连接,需要给bin目录赋权chmod +s bin即可。