Install rabbitmq on Ubuntu Linux

RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP). It is written in the Erlang programming language. Here are steps to install rabbitmq on Ubuntu Linux (14.04.3 LTS)

  1. Add rabbitmq public key to trusted keys

    $ wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
    $ sudo apt-key add rabbitmq-signing-key-public.asc
    
  2. Update package source list to add rabbitmq source and resynchronize the package index files.

    $ sudo sh -c "echo 'deb http://www.rabbitmq.com/debian/ testing main' > /etc/apt/sources.list.d/rabbitmq.list"
    $ sudo apt-get update
    
  3. Check where will rabbitmq be installed from
    $ apt-cache policy rabbitmq-server
    rabbitmq-server:
      Installed: 3.6.1-1
      Candidate: 3.6.1-1
      Version table:
     *** 3.6.1-1 0
            500 http://www.rabbitmq.com/debian/ testing/main amd64 Packages
            100 /var/lib/dpkg/status
         3.2.4-1 0
            500 http://us-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    
  4. Install rabbitmq
    $ sudo apt-get install rabbitmq-server
    
  5. List rabbitmq-server package version details
    $ dpkg -l rabbitmq-server
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name                           Version              Architecture         Description
    +++-==============================-====================-====================-==================================================================
    ii  rabbitmq-server                3.6.1-1              all                  Multi-protocol messaging broker
    
  6. Look at rabbitmq log files

    $ ls -l /var/log/rabbitmq/
    total 8
    -rw-r--r-- 1 rabbitmq rabbitmq 2285 Mar  3 06:42 rabbit@ip-172-30-0-211.log
    -rw-r--r-- 1 rabbitmq rabbitmq    0 Mar  2 15:14 rabbit@ip-172-30-0-211-sasl.log
    -rw-r--r-- 1 rabbitmq rabbitmq    0 Mar  2 15:14 startup_err
    -rw-r--r-- 1 rabbitmq rabbitmq  362 Mar  2 15:14 startup_log
    $ cat /var/log/rabbitmq/startup_log
    
                  RabbitMQ 3.6.1. Copyright (C) 2007-2016 Pivotal Software, Inc.
      ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
      ##  ##
      ##########  Logs: /var/log/rabbitmq/rabbit@ip-172-30-0-211.log
      ######  ##        /var/log/rabbitmq/rabbit@ip-172-30-0-211-sasl.log
      ##########
                  Starting broker... completed with 0 plugins.
    
  7. Check if rabbitmq is setup to auto-start at boot

    $ ls -l /etc/rc*.d/*rabbit*
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc0.d/K20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc1.d/K20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc2.d/S20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc3.d/S20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc4.d/S20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc5.d/S20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root 25 Mar  2 15:14 /etc/rc6.d/K20rabbitmq-server -> ../init.d/rabbitmq-server
    

    Presence of these syblinks shows that rabbitmq will start on its own at boot time. Note that rabbitmq is a service based on sysv init. You may also want to visit Ubuntu – how to auto start services on boot using update-rc.d (sysv init).

  8. Check status of rabbitmq-server service

    $ sudo service rabbitmq-server status
    
  9. View rabbitmq system limits in rabbitmq config file.

    $ cat /etc/default/rabbitmq-server
    # This file is sourced by /etc/init.d/rabbitmq-server. Its primary
    # reason for existing is to allow adjustment of system limits for the
    # rabbitmq-server process.
    #
    # Maximum number of open file handles. This will need to be increased
    # to handle many simultaneous connections. Refer to the system
    # documentation for ulimit (in man bash) for more information.
    #
    #ulimit -n 1024
    

    You may want to consider increasing ulimit value in production.

  10. List rabbitmq exchanges

    $ sudo rabbitmqctl list_exchanges
    Listing exchanges ...
    amq.rabbitmq.trace	topic
    amq.rabbitmq.log	topic
    amq.match	headers
    amq.headers	headers
    amq.topic	topic
    amq.direct	direct
    amq.fanout	fanout
    	direct
    
  11. List queues (for fresh install there won’t be any queue)

    $ sudo rabbitmqctl list_queues
    

Related links

RabbitMQ official site

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments