Step-by-Step Guide
- Update the Package Index
Open a terminal and update the package index to ensure you have the latest information about available packages:
sudo apt update
- Install Erlang
RabbitMQ requires Erlang to be installed. Add the Erlang repository:
sudo apt install -y gnupg
curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
echo "deb https://packages.erlang-solutions.com/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list
sudo apt update
sudo apt install -y erlang
- Add RabbitMQ Repository
Add the RabbitMQ repository to your system:
curl -fsSL https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey | sudo apt-key add -
echo "deb https://packagecloud.io/rabbitmq/rabbitmq-server/debian/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
sudo apt update
- Install RabbitMQ
Install RabbitMQ using theapt
package manager:
sudo apt install -y rabbitmq-server
- Start and Enable RabbitMQ
Start the RabbitMQ service:
sudo systemctl start rabbitmq-server
Enable RabbitMQ to start on boot:
sudo systemctl enable rabbitmq-server
- Verify RabbitMQ Installation
Check the RabbitMQ service status to ensure it is running:
sudo systemctl status rabbitmq-server
If RabbitMQ is running, you should see an active (running) status.
- Enable RabbitMQ Management Plugin
Enable the RabbitMQ management plugin to access the web-based management interface:
sudo rabbitmq-plugins enable rabbitmq_management
The management interface will be available at http://your_server_ip:15672/
.
- Create an Administrative User
Create an administrative user for the RabbitMQ management interface:
sudo rabbitmqctl add_user your_username your_password
sudo rabbitmqctl set_user_tags your_username administrator
sudo rabbitmqctl set_permissions -p / your_username ".*" ".*" ".*"
- Access the Management Interface
Open your web browser and navigate tohttp://your_server_ip:15672/
. Log in using the administrative user credentials you created. - Secure RabbitMQ (Optional)
For added security, consider setting up SSL/TLS and configuring a firewall to restrict access. Edit the RabbitMQ configuration file:sudo nano /etc/rabbitmq/rabbitmq.conf
Add the necessary SSL/TLS configuration parameters. For example:listeners.ssl.default = 5671 ssl_options.cacertfile = /path/to/cacert.pem ssl_options.certfile = /path/to/cert.pem ssl_options.keyfile = /path/to/key.pem ssl_options.verify = verify_peer ssl_options.fail_if_no_peer_cert = true
Restart RabbitMQ to apply the changes:sudo systemctl restart rabbitmq-server
- Monitor RabbitMQ
You can monitor RabbitMQ using the management interface or by using therabbitmqctl
command-line tool:bash sudo rabbitmqctl status