- Published on
Installation and Configuration of Message Broker with RabbitMQ
Step 1: Installation
Add the RabbitMQ 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 repository and install the RabbitMQ server
$ sudo apt update
$ sudo apt install rabbitmq-server
Step 2: Service
Create a service for RabbitMQ to start automatically at boot and start it
$ sudo systemctl enable rabbitmq-server
$ sudo systemctl start rabbitmq-server
If you encounter a warning when starting the RabbitMQ service as shown below
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "id_ID.UTF-8",
LC_MONETARY = "id_ID.UTF-8",
LC_ADDRESS = "id_ID.UTF-8",
LC_TELEPHONE = "id_ID.UTF-8",
LC_NAME = "id_ID.UTF-8",
LC_MEASUREMENT = "id_ID.UTF-8",
LC_IDENTIFICATION = "id_ID.UTF-8",
LC_NUMERIC = "id_ID.UTF-8",
LC_PAPER = "id_ID.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
LANGUAGE dan LC_ALL yg nilai nya (unset) itu berarti pada field tersebut belum kita atur. Kita tambahkan value ke field tersebut agar tidak muncul pesan warning
$ export LANGUAGE="en_US.UTF-8"
$ export LC_ALL="en_US.UTF-8"
Step 3: Create Users (optional)
The default login credentials for RabbitMQ are the username guest and the password guest. The default user can only log in locally and cannot access the server remotely. Therefore, we need to create an administrator user to enable remote access to the RabbitMQ web management interface.
$ sudo rabbitmqctl add_user admin password-untuk-admin
Creating user "admin"
$ sudo rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator]
$ sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "/"
Step 4: Web Management (optional)
Enable the management console for RabbitMQ server via the web GUI
$ sudo rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
amqp_client
cowlib
cowboy
rabbitmq_web_dispatch
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@example... started 6 plugins.
Then, open the web management console in your browser at http://{hostname}:15672/
That's it for now, see you~