Installing RabbitMQ on Linux

Pre-Installation Task

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.

Installing RabbitMQ on Linux

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, netbraintemp8.0.3.

3.Run the cd /opt/netbraintemp8.0.3 command to navigate to the /opt/netbraintemp8.0.3 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.3.tar.gz file from NetBrain and then upload it to the /opt/netbraintemp8.0.3 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/netbraintemp8.0.3 directory to directly download the rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.3.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.3.tar.gz command under the /opt/netbraintemp8.0.3 directory to extract installation files.

[[email protected] netbraintemp8.0.3]# tar -zxvf rabbitmq-linux-x86_64-rhel7-3.8.1-8.0.3.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 and save the changes. For how to modify the configuration file, refer to Editing a File with VI Editor.

[[email protected] 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/cert.pem
KeyFile=/etc/ssl/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.

[[email protected] rabbitmq]# ./install.sh
INFO: Creating installation log file
INFO: Preprocessing SUCCEEDED
INFO: Start checking system
...
warning: /opt/netbraintemp8.0.3/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-22.1.7-1.el7           ########################################
INFO: Installing /opt/netbraintemp8.0.3/rabbitmq/sources/rabbitmq-server-3.8.1-1.el7.noarch.rpm
warning: /opt/netbraintemp8.0.3/rabbitmq/sources/rabbitmq-server-3.8.1-1.el7.noarch.rpm: Header V4 RSA/SHA256 
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
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 Mon 2020-07-13 16:04:46 EDT; 8ms ago
 Main PID: 53927 (beam.smp)
   Status: "Initialized"
   Memory: 70.8M (limit: 15.5G)
...
   Active: active (running) since MON 2020-07-13 16:05:23 EDT; 7ms ago
INFO: Verification SUCCEEDED
INFO: Backing up uninstall.sh SUCCEEDED
INFO: Successfully installed RabbitMQ

10. Run the systemctl status rabbitmq-server command to verify whether its service starts successfully.

[[email protected] ~]# 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 Mon 2020-07-13 16:05:23 EDT; 13min ago
   Process: 19522 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=0/SUCCESS)
 Main PID: 4509 (beam.smp)
   Status: "Initialized"
   Memory: 96.5M
...

Tip: It is highly recommended to run the rm -rf /opt/netbraintemp8.0.3/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.

Parameters

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.
{ } [ ] : " , ' | < > @ & ^ % \ and spaces

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. If you plan to deploy a cluster, enter the hostname of the master node when you configure the setting for the slave node.

Note: FQDN and IP address are not supported.

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.

[[email protected] check]# vi rabbitmq.yaml
init_config:
 
instances:
    - name: default
      managementPort: 15672,
      checkAvailableIntervalSeconds: 300
      ssl: true
      collectQueues:
          equal: []
          startWith: ['FullTextSearch','TaskManager','event_callback','RMClientCallback','ETL_Task']
          endWith: ['IndexDriver']

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.