Skip to content

Instantly share code, notes, and snippets.

@fernandoaleman
Last active November 21, 2022 04:09
Show Gist options
  • Save fernandoaleman/72f0ad39e11915c0077d544b50096b50 to your computer and use it in GitHub Desktop.
Save fernandoaleman/72f0ad39e11915c0077d544b50096b50 to your computer and use it in GitHub Desktop.
Install RabbitMQ on Ubuntu 16.06

Install RabbitMQ on Ubuntu 16.04

Install Erlang

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update -y
sudo apt-get install -y erlang erlang-nox

Add RabbitMQ apt repository

echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

Update the package list

sudo apt-get update -y

Install RabbitMQ

sudo apt-get install -y rabbitmq-server

Start RabbitMQ

sudo systemctl start rabbitmq-server

Check RabbitMQ status

sudo systemctl status rabbitmq-server

Enable RabbitMQ service so it starts on boot

sudo systemctl enable rabbitmq-server

Setup RabbitMQ Web Management Console

sudo rabbitmq-plugins enable rabbitmq_management

Single RabbitMQ Instances

Create Admin User in RabbitMQ

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

Clustered RabbitMQ Instances

Setup Cluster On The Master Node

wget https://gist.githubusercontent.com/fernandoaleman/05cbf15e0e58f8de7a29a21b24f9debb/raw/55efa7b36c245a9f6ffa3bcd2382c078cce0e9a2/rabbitmq-cluster.sh
chmod +x rabbitmq-cluster.sh
./rabbitmq-cluster.sh

Enable SSL

Enable RabbitMQ and Management SSL

[
 {rabbit, [
 {ssl_listeners, [5671]},
 {ssl_options, [{cacertfile,"/path/to/cacertfile"},
 {certfile,"/path/to/certfile"},
 {keyfile,"/path/to/keyfile"},
 {verify,verify_peer},
 {fail_if_no_peer_cert,true}]}
 ]},
 {rabbitmq_management, [
 {listener, [{port, 15671},
 {ssl, true},
 {ssl_opts, [{cacertfile, "/path/to/cacertfile"},
             {certfile,   "/path/to/certfile"},
             {keyfile,    "/path/to/keyfile"}]}
            ]
 }
 ]}
].
@axat1
Copy link

axat1 commented May 10, 2021

./rabbitmq-cluster.sh
when I run this command it asks for server's host name and IP address then what to write there ?

Setup RabbitMQ Master

Enter the master server's hostname : admin
[admin] Setting up master
ssh: Could not resolve hostname admin: Temporary failure in name resolution
Master's Erlang Cookie : ''
Enter the master server's IP as seen from the slaves (Use a local IP if available) : 127.0.0.1
Setup RabbitMQ Slaves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment