▪Ensure the hostname of the Linux server must be resolvable by DNS or configured in /etc/hosts because RabbitMQ needs a resolvable hostname no matter whether it is a standalone server or a cluster.
▪RabbitMQ has dependencies on the third-party package socat and logrotate. Before you install the RabbitMQ, run the rpm -qa|grep socat and rpm -qa|grep logrotate commands to check whether they have been installed on the server. If they have not been installed yet, you can choose either option below to install the dependencies.
oOnline Install: run the yum -y install socat and yum -y install logrotate commands to install them online.
oOffline Install: refer to Offline Installing Third-party Dependencies for more details.
1.Log in to the Linux server as the root user.
2.Run the mkdir command to create a directory under the /opt directory to place the installation package. For example, netbraintemp.
3.Run the cd /opt/netbraintemp command to navigate to the /opt/netbraintemp directory.
4.Download the installation package.
▪Option 1: If the Linux server has no access to the Internet, obtain the rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.2.tar.gz file from NetBrain and then upload it to the /opt/netbraintemp directory by using a file transfer tool.
▪Option 2: If the Linux server has access to the Internet, run the
wget <download link> command under the /opt/netbraintemp directory to directly download the rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.2.tar.gz file from NetBrain official download site.
Note: Contact NetBrain Support Team to get the download link. The download link is case-sensitive.
Tip: Run the yum -y install wget command to install the wget command if it has not been installed on the server.
5.Run the tar -zxvf rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.2.tar.gz command under the /opt/netbraintemp directory to extract installation files.
[root@localhost netbraintemp]# tar -zxvf rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.2.tar.gz
rabbitmq/
rabbitmq/config/
rabbitmq/config/setup.conf
...
rabbitmq/install.sh
..
6.Run the cd rabbitmq/config command to navigate to the config directory.
7.Modify the parameters in the setup.conf file located under the config directory and save the changes. For how to modify the configuration file, refer to Editing a File with VI Editor.
[root@centos config]# vi setup.conf
#RabbitMQ configuration file
#Account info
#The UserName or Password should not contain: {}[]:",'|<>@&^%\ or a space
#The length of UserName or Password should not be more than 64 characters
UserName=admin
Password=admin
# Mode (Mode can only be 'mirror' or 'standalone')
Mode=standalone
# A unique cluster string used to join all cluster nodes. Each cluster node
# must have the same cluster ID.
ClusterId=rabbitmqcluster
# The role of the current node in the cluster. Two roles can be configured:
# master or slave. If the role of the current node is slave, you must specify
# the hostname of the master node in MasterNode.
NodeRole=master
MasterNode=localhost
# Resource limitation
ResourceLimit=no
# CPULimit and MemoryLimit should be ended by % and the range is from 1% to 100%
CPULimit=100%
MemLimit=100%
# TLS
UseSSL=no
CertFile=/etc/ssl/rabbitmq/cert.pem
KeyFile=/etc/ssl/rabbitmq/key.pem
# Port
TcpPort=5672
# Log path
LogPath=/var/log/rabbitmq
8.Run the cd .. command to navigate to the rabbitmq directory.
9.Run the ./install.sh script under the rabbitmq directory to install RabbitMQ.
[root@localhost rabbitmq]# ./install.sh
INFO: Creating installation log file
INFO: Preprocessing SUCCEED
INFO: Start checking system
Collecting system information...
...
Collecting system information SUCCEEDED.
...
warning: /opt/netbraintemp/rabbitmq/sources/erlang-21.2.4-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA1
Signature, key ID 6026dfca: NOKEY
Preparing... ########################################
Updating / installing...
erlang-21.2.4-1.el7.centos ########################################
INFO: Installing /opt/netbraintemp/rabbitmq/sources/rabbitmq-server-3.8.1-1.el7.noarch.rpm
warning: /opt/netbraintemp/rabbitmq/sources/rabbitmq-server-3.8.1-1.el7.noarch.rpm: Header V4 RSA/SHA1
Signature, key ID 6026dfca: NOKEY
Preparing... ########################################
Updating / installing...
rabbitmq-server-3.8.1-1.el7 ########################################
INFO: Official rpm package installing SUCCEEDED
INFO: Configuration parameters updating SUCCEEDED
INFO: Permission setting SUCCEED
INFO: Deamon setting SUCCEED
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to
/usr/lib/systemd/system/rabbitmq-server.service.
rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-01-14 00:38:43 EST; 36min ago
Main PID: 53927 (beam.smp)
Status: "Initialized"
Memory: 70.8M (limit: 15.5G)
CGroup: /system.slice/rabbitmq-server.service
53927 /usr/lib64/erlang/erts-10.2.3/bin/beam.smp -W w -A 128 -MBas ageffcbf -MHas ageffcbf
-MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 1280000 -K true
-- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -p...
54068 /usr/lib64/erlang/erts-10.2.3/bin/epmd -daemon
54315 erl_child_setup 1024
54344 inet_gethost 4
54345 inet_gethost 4
54360 /usr/bin/socat unix-sendto:/run/systemd/notify STDIO
Mar 17 21:14:36 localhost.localdomain systemd[1]: Starting RabbitMQ broker...
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: ## ##
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: ## ## RabbitMQ 3.8.1.
Copyright (C) 2007-2018 Pivotal Software, Inc.
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: ########## Licensed under the MPL.
See http://www.rabbitmq.com/
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: ###### ##
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: ##########
Logs: /var/log/rabbitmq/[email protected]
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]:
/var/log/rabbitmq/rabbit@localhost_upgrade.log
Mar 17 21:14:39 localhost.localdomain rabbitmq-server[53927]: Starting broker...
Mar 17 21:14:42 localhost.localdomain rabbitmq-server[53927]: systemd unit for activation check:
"rabbitmq-server.service"
Mar 17 21:14:42 localhost.localdomain systemd[1]: Started RabbitMQ broker.
...
started 3 plugins.
INFO: Verification SUCCEED
Active: active (running) since Tue 2020-01-14 00:38:43 EST; 36min ago
10. Run the systemctl status rabbitmq-server command to verify whether its service starts successfully.
[root@localhost ~]# systemctl status rabbitmq-server
rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-01-14 00:38:43 EST; 36min ago
Main PID: 4509 (beam.smp)
Status: "Initialized"
Memory: 96.5M
...
Tip: It is highly recommended to run the rm -rf /opt/netbraintemp/rabbitmq/config/setup.conf command to delete the setup.conf file from the server after RabbitMQ is successfully installed because the file may cause security vulnerability.
The following table describes the parameters that can be configured when installing RabbitMQ.
Parameter |
Default Value |
Description |
---|---|---|
Username |
admin |
Specify the admin username used to connect to RabbitMQ. Note: The username and password cannot contain any of the following special characters, and its length cannot exceed 64 characters. Note: Each member in a cluster must have the same username and password. |
Password |
admin |
Specify the admin password used to connect to RabbitMQ. |
Mode |
standalone |
Set whether to enable cluster deployment. Modify it to standalone for a standalone deployment. If you plan to deploy a cluster, keep the default value. |
ClusterId |
rabbitmqcluster |
Specify the cluster id used by all nodes to join the cluster. This parameter is required only for cluster deployments. Note: Each member in a cluster must have the same cluster ID. Note: Make sure that you don’t reuse the same cluster ID, otherwise you might end up with nodes joining the wrong cluster. |
NodeRole |
master |
Set the role for the current node. Available options are master and slave. Keep the default value for a standalone deployment. If you plan to deploy a cluster, modify it to slave on the other node. |
MasterNode |
localhost |
This parameter is only required for cluster deployments. Keep the default value as it is for a standalone deployment. |
ResourceLimit |
no |
Set whether to limit the system resource usage for RabbitMQ. |
CPULimit |
100% |
Specify the maximum CPU utilization of the machine that can be consumed by RabbitMQ. |
MemoryLimit |
100% |
Specify the maximum memory capacity of the machine that can be consumed by RabbitMQ. |
UseSSL |
no |
Set whether to enable the encrypted connections to RabbitMQ by using SSL. Tip: If UseSSL is set to yes, you can follow the steps below to modify the RabbitMQ Plugin config file after the service monitor is installed. 1)Run the vi /etc/netbrain/nbagent/check/rabbitmq.yaml command to open the RabbitMQ Plugin config file. 2)Set the ssl value to true and save the changes. For how to modify the configuration file, see Editing a File with VI Editor for more details. [root@localhost check]# vi rabbitmq.yaml |
Certificate |
/etc/ssl/cert.pem |
Specify the storage path for all the certificates and key files used for SSL authentication. Note: It is required only if UseSSL is enabled. |
PrivateKey |
/etc/ssl/key.pem |
Specify the name of SSL private key file. Note: It is required only if UseSSL is enabled. |
TcpPort |
5672 |
Specify the port number that RabbitMQ service listens to. |
LogPath |
/var/log/rabbitmq |
Specify the directory to save logs of RabbitMQ. |