• Get In Touch
December 15, 2016

How to Setup RabbitMQ Server on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Rabbitmq is a free and open source message broker system that implements the Advanced Message Queuing Protocol (AMQP). It is also known as message-oriented middleware written in the Erlang programming language and built on the Open Telecom Platform framework for clustering and failover.

Rabbitmq is a scalable implementation of an AMQP broker. AMQP is the most widely used open-source standard for distributing and transferring messages from a source to a destination.

The Rabbitmq message broker system provides lot’s of features some of them are listed below:

  1. Supports multiple protocols such as MQTT, STOMP and HTTP.
  2. Supports routing capabilities, you can implement rules to route messages between exchanges and queues.
  3. Supports multiple programming language with a variety of supported clients.
  4. Supports clustering, so you can clustered several rabbinmq server on local network.
  5. Supports high availability, so if a broker fails then communication will be redirected to different broker instance.
  6. Provides user friendly web interface to monitor and control every aspect of your message broker.
  7. Rabbitmq comes with lot’s of plugins, you can easily extend it and also write your own.
  8. Rabbitmq provides tracing features that can be used to find out what’s going on.

In this tutorial, we will learn how to install rabbitmq on Ubuntu 16.04 server.

Requirements

  • A server running Ubuntu 16.04.
  • A non-root user with sudo privileges configure on your server.

Update System

Before starting, you will need to update Ubuntu repository with the latest one.

You can do this by running the following commands:

sudo apt-get update -y
sudo apt-get upgrade -y

Installing Erlang

Before installing rabbitmq, you will need to install erlang as a prerequisite of rabbitmq. You can install them by running the following commands:

wget http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
sudo apt-get update -y
sudo apt-get install erlang -y
sudo apt-get install erlang-nox -y

Once you have Erlang, you can continue with installing RabbitMQ:

Installing RabbitMQ

First, you will need to add rabbitmq repository to apt. You can easily add it with the following command:

sudo echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list

Once the repository is added, you will need to add the RabbitMQ public key to our trusted key list to avoid any warnings about unsigned packages:

wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc

Next update the apt repository with the following command:

sudo apt-get update

Once the repository is up to date, then install rabbitmq server by running the following command:

sudo apt-get install rabbitmq-server

Once installation is complete, start the rabbitmq server and enable it to start on boot by running the following command:

sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server

You can check the status of rabbitmq server with the following command:

sudo systemctl status rabbitmq-server

RabbitMQ comes with default built-in settings which will quite likely be sufficient for running your RabbitMQ server effectively. If it runs fine, then you possibly don’t need any configuration at all.

There are three way to customize RabbitMQ server.

  1. environment variables

You can define ports, file location and names using environment variable file.

  1. configuration file

You can defines server component settings for permissions, limits and clusters using configuration file.

  1. runtime parameters and policies
    You can defines cluster-wide settings which can change at run time .

You can find location of configuration file by inspecting RabbitMQ log file.

If you want to manage the maximum amount of connections upon launch, then you will need to modify rabbitmq-server file located at /etc/default/ directory.

sudo nano /etc/default/rabbitmq-server

Find the line that containing word ulimit and uncomment it:

ulimit -n 1024

Save and close the file, then you can proceed to next step.

Allow RabbitMQ Through Firewall

By default RabbitMQ web management console runs on port 15672. So you will need to allow this port through UFW firewall. By default UFW firewall is disabled in Ubuntu 16.04, so you will need to enable it first.
You can enable UFW filrewall with the following command:

sudo ufw enable

Once UFW is enabled, allow port 15672 using the following command:

sudo ufw allow 15672

Once you are done, you can proceed to next step.

Accessing RabbitMQ Web Management Console

Once everything is setup properly, it’s time to access Rabbitmq web management console.
Before starting, you will need to install rabbitmq web management plugin first. You can easily manage and monitor your RabbitMQ server in a variety of ways using this plugin.
Using this console, you can manage queues, bindings and users, monitor queues, message rates, connections and also monitor Erlang processes, memory usage etc.

To install this plugin simply run the following command:

sudo rabbitmq-plugins enable rabbitmq_management

The above command will enable the following plugins:

  • mochiweb
  • webmachine
  • rabbitmq_web_dispatch
  • amqp_client
  • rabbitmq_management_agent
  • rabbitmq_management

Once the plugin is enabled, you will need to restart rebbitmq service for the changes to come into effect.

Next, you will also need to create new admin user.

You can create a new admin user with the following commands:

sudo rabbitmqctl add_user radmin radmin
sudo rabbitmqctl set_user_tags radmin administrator
sudo rabbitmqctl set_permissions -p / radmin ".*" ".*" ".*"

Next, open your favourite web browser and type the URL http://server-ip-address:15672 and login with your newly create user and password.

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1227298460.png” alt=”” />

After login the RabbitMQ web management console you should see the dashboard in following image:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1106298597.png” alt=”” />

Finally, you have successfully installed RabbitMQ server on Ubuntu 16.04. You can now easily manage your RabbitMQ server from your web.

Conclusion

In this tutorial, you have learn how to install RabbitMQ server on Ubuntu 16.04 server. You have also learned how to enable the RabbitMQ web management plugins. I hope, you can now easily deploy RabbitMQ server in production environment.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]