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 yum update -y
- Install Erlang
RabbitMQ requires Erlang to be installed. Add the Erlang repository:
sudo yum install -y epel-release
sudo yum install -y erlang
- Add RabbitMQ Repository
Add the RabbitMQ repository to your system:
sudo rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sudo tee /etc/yum.repos.d/rabbitmq.repo <<EOF
[rabbitmq-server]
name=rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/\$basearch
gpgcheck=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
enabled=1
EOF
- Install RabbitMQ
Install RabbitMQ using theyum
package manager:
sudo yum 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
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 the rabbitmqctl command-line tool:
sudo rabbitmqctl status