Set up the server using the command line on Linux
Follow these instructions to create a queue manager, queue, and channel on the server. We can then use these objects to verify the installation.
About this task
These instructions assume that no queue manager or other IBM MQ objects have been defined.
IBM MQ object definitions are case-sensitive. Any text entered as an MQSC command in lowercase is converted automatically to uppercase unless you enclose it in single quotation marks. Make sure that you type the examples exactly as shown.
Procedure
- Create a user ID on the server that is not in the mqm group. This user ID must exist on the server and client. This is the user ID that the sample applications must be run as, otherwise a 2035 error is returned.
- Log in as a user in the mqm group.
- We must set various environment variables so that the installation can be used in the current shell. We can set the environment variables by entering the following command:
. MQ_INSTALLATION_PATH/bin/setmqenv -swhere MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.- Create a queue manager called QUEUE.MANAGER.1 by entering the following command:
crtmqm QUEUE.MANAGER.1You see messages telling you that the queue manager has been created.- Start the queue manager by entering the following command:
strmqm QUEUE.MANAGER.1A message tells you when the queue manager has started.- Start MQSC by entering the following command:
runmqsc QUEUE.MANAGER.1A message tells you that an MQSC session has started. MQSC has no command prompt.- Define a local queue called QUEUE1 by entering the following command:
DEFINE QLOCAL(QUEUE1)A message tells you when the queue has been created.- Allow the user ID that you created in step 1 to use QUEUE1 by entering the following command:
SET AUTHREC PROFILE(QUEUE1) OBJTYPE(QUEUE) PRINCIPAL(' non_mqm_user ') AUTHADD(PUT,GET)where non_mqm_user is the user ID created in step 1. A message tells you when the authorization has been set. We must also run the following command to give the user ID authority to connect:SET AUTHREC OBJTYPE(QMGR) PRINCIPAL(' non_mqm_user ') AUTHADD(CONNECT)If this command is not run, a 2305 stop error is returned.- Define a server-connection channel by entering the following command:
DEFINE CHANNEL (CHANNEL1) CHLTYPE (SVRCONN) TRPTYPE (TCP)A message tells you when the channel has been created.- Allow your client channel to connect to the queue manager and run under the user ID that you created in step 1, by entering the following MQSC command:
SET CHLAUTH(CHANNEL1) TYPE(ADDRESSMAP) ADDRESS(' client_ipaddr ') MCAUSER(' non_mqm_user ')where client_ipaddr is the IP address of the client system, and non_mqm_user is the user ID created in step 1. A message tells you when the rule has been set.- Define a listener by entering the following command:
DEFINE LISTENER (LISTENER1) TRPTYPE (TCP) CONTROL (QMGR) PORT (port_number)where port_number is the number of the port the listener is to run on. This number must be the same as the number used when defining your client-connection channel in Installing an IBM MQ client on Linux using rpm.Note: If we omit the port parameter from the command, a default value of 1414 is used for the listener port. To specify a port other than 1414, we must include the port parameter in the command, as shown.- Start the listener by entering the following command:
START LISTENER (LISTENER1)- Stop MQSC by entering:
endYou see some messages, followed by the command prompt.
What to do next
Follow the instructions to set up the client. See Connect to a queue manager, using the MQSERVER environment variable on Linux. Parent topic: Set up the server and client using the command line on Linux