How To Install RabbitMQ on Ubuntu 18.04

RabbitMQ is software that is cross-platform oriented. RabbitMQ is an open source message broker written in the Erlang programming language. This software consists of a server, libraries supporting HTTP, XMPP and STOMP [en] protocols, AMQP client libraries for Java and .NET Framework and various plugins (such as plugins for monitoring and control via HTTP or web interface or plugin “Shovel” to transfer messages between brokers). There is a client implementation for accessing RabbitMQ for a number of programming languages, including Perl, Python, Ruby, PHP. Horizontal scaling is supported for building cluster solutions.

Update your System files

First, before installing the software, you need to update the packages for the latest state (Ubuntu 18.04 updates are taken into account here)

sudo apt-get update
sudo apt-get upgrade

Installing Erlang

Since this software is written in the Erlang programming language, before installing RabbitMQ you need to install this particular programming language

cd ~
wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.1-1~ubuntu~xenial_amd64.deb
sudo dpkg -i esl-erlang_20.1-1\~ubuntu\~xenial_amd64.deb

Check your Erlang installation:

erl

You will be taken to the Erlang shell:

Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.1  (abort with ^G)

Ctrl + C Press twice to exit the Erlang shell.

Install RabbitMQ

Add the Apt repository to your Apt source list directory (/etc/apt/sources.list.d):

echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list

Then add our public key to the list of trusted keys using apt-key:

wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

Run the following command to update the package list:

sudo apt-get update

Install rabbitmq-server package:

sudo apt-get install rabbitmq-server

Run the Server

In order to start the server, you must enter the following command:

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

You can check the RabbitMQ status:

sudo rabbitmqctl status

By default RabbitMQ creates a user named “guest with the password” guest. You can also create your administrator account on RabbitMQ server using the following commands. Change password to your own password.

sudo rabbitmqctl add_user admin password 
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin .....

Enable using RabbitMQ Management Console

Enable RabbitMQ Management Console so you can monitor RabbitMQ server processes from your web browser:

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

Next, you need to set up an administrator account to access the RabbitMQ server management console. In the following commands, “mqadmin” is the administrator username and “mqadminpassword” is the password. Remember to replace them with your own

sudo rabbitmqctl add_user mqadmin mqadminpassword
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin .....

Now visit the following URL:

http://[your-hostry-IPv4]:15672/

Log in with the credentials you provided earlier. You will be greeted by the RabbitMQ Remote Management Console, where you can learn more about RabbitMQ.

Was this article helpful?

Related Articles