Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ashutosh049/d06e48ffb2db5ad9da18b043b197bcf7 to your computer and use it in GitHub Desktop.
Save ashutosh049/d06e48ffb2db5ad9da18b043b197bcf7 to your computer and use it in GitHub Desktop.
Install RabbitMq on Amamzon EC2 (Amazon Linux 2)

#1.Updates all packages the the latest version available.

sudo yum -y update

#2.Package Dependencies before installing RabbitMq

  • erlang
  • socat
  • logrotate

#3.Enable the EPEL repository

Standard repositories might not provide all the packages that can be installed on CentOS, Red Hat Enterprise Linux (RHEL), or Amazon Linux-based distributions. Enabling the EPEL repository provides additional options for package installation

  • Amazon Linux 2:

    Install the EPEL release package for EL 7 and enable the EPEL repository.

    sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    sudo yum-config-manager --enable epel
  • Amazon Linux AMI:

    The EPEL repository is already installed on the original version of Amazon Linux, but you must enable it. You can enable this repository either by using the yum-config-manager command or by editing the epel.repo file.

        sudo yum-config-manager --enable epel

See more at ec2-enable-epel

#4. Install Erlang

sudo yum install erlang --enablerepo=epel

TIP: Prevent Erlang unwanted upgrades To do this, follow:

Install package named yum-plugin-versionlock (called yum-versionlock in RHEL 5).

	yum install yum-plugin-versionlock

The /etc/yum/pluginconf.d/versionlock.list will be created on the system.

To install or lock the version of the gcc package, add that package name to the /etc/yum/pluginconf.d/versionlock.list file by running:

```sh
    yum versionlock gcc-*
```

(Alternatively, you can edit the filelist, /etc/yum/pluginconf.d/versionlock.list, directly.)

The above configuration will not allow to upgrade the gcc package to version greater than what was installed at the time the locking was performed. Yum will attempt to update all packages, while excluding the packages listed in the versionlock file.

#4. Install socat

sudo yum install -y socat

#4. Install logrotate

sudo yum install logrotate

#5. Install RabbitMq get latest stavble version at http://www.rabbitmq.com/releases/rabbitmq-server, like I chose v3.6.10

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el6.noarch.rpm
sudo rpm -Uvh rabbitmq-server-3.6.10-1.el6.noarch.rpm

#6. Enable RabbitMq management

sudo rabbitmq-plugins enable rabbitmq_management

#7. Set RabbitMQ Server to start automatically on machine-reboot The RabbitMQ server does not start as a daemon by default when your system starts. If, however, you want it to start by default, then run the following command as the root user or a user with sudo privileges

chkconfig rabbitmq-server on

#8. Start/Stop the server

Start /sbin/service rabbitmq-server start Stop /sbin/service rabbitmq-server stop Status /sbin/service rabbitmq-server status

####9. Loggin in tot he server management from browser

By default, the guest user is prohibited from connecting from remote hosts; it can only connect over a loopback interface (i.e. localhost). This applies to connections regardless of the protocol. Any other users will not (by default) be restricted in this way.

It is possible to allow the guest user to connect from a remote host by setting the loopback_users configuration to none

# DANGER ZONE!
#
# allowing remote connections for default user is highly discouraged
# as it dramatically decreases the security of the system. Delete the user
# instead and create a new one with generated secure credentials.
loopback_users = none

Or, in the classic config file format (rabbitmq.config):

%% DANGER ZONE!
%%
%% Allowing remote connections for default user is highly discouraged
%% as it dramatically decreases the security of the system. Delete the user
%% instead and create a new one with generated secure credentials.
[{rabbit, [{loopback_users, []}]}].

See more at "guest" user can only connect from localhost

TIP: It is advisable to delete the guest user or at least change its password to reasonably secure generated value that won't be known to the public.

#10. Create new user

  • Add a new/fresh user, say user test and password test:

    rabbitmqctl add_user guest1 guest1
    
  • Give administrative access to the new user:

    rabbitmqctl set_user_tags guest1 administrator
    
  • Set permission to newly created user:

    rabbitmqctl set_permissions -p / guest1 ".*" ".*" ".*"
    

No try to login via guest1/guest1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment