1.創建mq用戶及目錄。linux
[root@GCP2-APP38-VM]#mkdir /var/mqm ###業務數據存放目錄ide
[root@GCP2-APP38-VM]#mkdir /opt/mqm ###軟件安裝目錄測試
[root@GCP2-APP38-VM]#groupadd mqmthis
[root@GCP2-APP38-VM]#useradd -d /var/mqm -g mqm -s /usr/sbin -m mqmrest
[root@GCP2-APP38-VM]#passwd mqm隊列
[root@GCP2-APP38-VM]#chown -R mqm:mqm /opt/mqmci
[root@GCP2-APP38-VM]#chown -R mqm:mqm /var/mqmget
2. 獲取mq介質CI8HQML-linux.tar.gz,放到/tmp下並解壓。it
[root@GCP2-APP38-VM tmp]# mkdir mqio
[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便可。