Setting up the server using the command line

Follow these instructions to create a queue manager, queue, and channel on the server. You 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

  1. 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.
  2. If your server is running on UNIX, Linux® or IBM i, log in as a user in the mqm group.
  3. If you are verifying an installation on UNIX, Linux, or Windows, you must set various environment variables so that the installation can be used in the current shell. You can set the environment variables by entering one of the following commands:
    • On UNIX and Linux systems:
      . MQ_INSTALLATION_PATH/bin/setmqenv -s
      
      where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
    • On Windows:
      . MQ_INSTALLATION_PATH\bin\setmqenv -s
      
      where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
  4. Create a queue manager called QUEUE.MANAGER.1 by entering one of the following commands:
    • On UNIX, Linux, and Windows:
      crtmqm QUEUE.MANAGER.1
      
    • On IBM i:
      CRTMQM MQMNAME('QUEUE.MANAGER.1')
      
    • On z/OS®, you do not need to create a queue manager.
    You see messages telling you that the queue manager has been created.
  5. Start the queue manager by entering one of the following commands:
    • On UNIX, Linux, and Windows:
      strmqm QUEUE.MANAGER.1
      
    • On IBM i:
      STRMQM MQMNAME('QUEUE.MANAGER.1')
      
    • On z/OS:
      START QMGR
      
    A message tells you when the queue manager has started.
  6. On UNIX, Linux, and Windows, start MQSC by entering the following command:
    runmqsc QUEUE.MANAGER.1
    
    A message tells you that an MQSC session has started. MQSC has no command prompt.
  7. Define a local queue called QUEUE1 by entering one of the following commands:
    • On UNIX, Linux, and Windows:
      DEFINE QLOCAL (QUEUE1)
      
    • On IBM i:
      CRTMQMQ QNAME(QUEUE1) QTYPE(*LCL)
      
    • On z/OS:
      DEFINE QLOCAL(QUEUE1)
      
    A message tells you when the queue has been created.
  8. 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. You 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.
  9. Define a server-connection channel by entering one of the following commands:
    • On all platforms except IBM i:
      DEFINE CHANNEL (CHANNEL1) CHLTYPE (SVRCONN) TRPTYPE (TCP)
      
    • On IBM i:
      CRTMQMCHL CHLNAME(CHANNEL1) CHLTYPE(*SVRCN) TRPTYPE(*TCP) MCAUSRID('QMQM')
      
    A message tells you when the channel has been created.
  10. 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.
  11. On UNIX, Linux, and Windows, 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 ; see the appropriate HP-UX and Linux sections for more information.
    Note: If you omit the port parameter from the command, a default value of 1414 is used for the listener port. If you want to specify a port other than 1414, you must include the port parameter in the command, as shown.
  12. Start the listener by entering one of the following commands:
    • On UNIX, Linux, and Windows:
      START LISTENER (LISTENER1)
      
    • On IBM i:
      STRMQMLSR MQMNAME('QUEUE.MANAGER.1') PORT(1414)
      
    • On z/OS:
      START CHINIT
      START LSTR TRPTYPE(TCP) PORT(port)
      
  13. On UNIX, Linux, and Windows, stop MQSC by entering the following command:
    end
    
    You see some messages, followed by the command prompt.

What to do next

Follow the instructions to set up the client. See Connecting an IBM MQ MQI client to a queue manager, using the MQSERVER environment variable.