Saturday, January 27, 2018

Installing Erlang version 20.1 and RabbitMQ 3.7 on AWS EC2 Amazon Linux instance

Today we are going to install Erlang version 20.1 and RabbitMQ 3.7 on an Amazon EC2 instance which is having an Amazon Linux version installed in it. In a nutshell we can say that, Amazon Linux can be considered equivalent to CentOS 6.

I am not going to eat your time and jumping directly towards the commands that you have to execute on your new instance. Before we start, please ensure:


  1. you have the administrative privileges. 
  2. Java 8 installed.
Just a brief, to install RabbitMQ, we would need Erlang and Socat to install first.

OK.. So, you have to execute the following commands as mentioned below.

Installing Erlang version 20.1

# cd /opt


# rpm -ivh erlang-20.1.7-1.el6.x86_64.rpm

Installing Socat


# yum install socat

 Installing RabbitMQ



# rpm -ivhrabbitmq-server-3.7.0-1.el6.noarch.rpm

# service rabbitmq-server start

Now we have to make sure that RabbitMQ is up as a service as soon as the server start up. To do this, execute the following command: 

# chkconfigrabbitmq-server on

To access the RabbitMQ Management Console on web, we need to enable the plugin. To do so execute the following command:

#  cd /usr/lib/rabbitmq/bin/

# rabbitmq-plugins enable rabbitmq_management

# cd /etc/rabbitmq/

# vim rabbitmq.config

[{rabbit, [{tcp_listeners, [{"", 5672}]},{loopback_users, []}]}].


Esc+:wq!

Now you can access the RabbitMQ on browser using:

http://<IP_Of_Your_AWS_Machine>:15672/

To login, use guest/guest as default password which you can change later.


Congratulations!! You did it.. :)

Do share your thoughts if you have any query, suggestion. 

Thanks!!

Installing Java 8 on AWS EC2 Amazon Linux instance

Today we are going to install Java 8 (JDK 8, I must say from the developer's perspective) in an Amazon EC2 instance which is having an Amazon Linux version installed in it. In a nutshell we can say that, Amazon Linux can be considered equivalent to CentOS 6.

I am not going to eat your time and jumping directly towards the commands that you have to execute to install JDK 8 on your new instance. Before we start, please ensure you have the administrative privileges. OK.. So, you have to execute the following commands as mentioned below.

Installing Java 8

$ cd /opt

$ sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz


$ sudo tar xzf jdk-8u151-linux-x64.tar.gz

$ cd jdk1.8.0_151/

$ sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_151/bin/java 2

$ sudo alternatives --config java
There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /opt/jdk1.8.0_151/bin/java

Enter to keep the current selection[+], or type selection number: 2 

(If you are getting some other options as well, choose the one with "/opt/jdk1.8.0_151/bin/java")


$ sudo alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_151/bin/jar 2

$ sudoalternatives --set jar /opt/jdk1.8.0_151/bin/jar

$ sudo alternatives --set javac /opt/jdk1.8.0_151/bin/javac

Check Java version 


$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Setting environment variables.


# vim /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_151
export JRE_HOME=/opt/jdk1.8.0_151/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin


Congratulations!! You did it.. :)

Do share your thoughts if you have any query, suggestion. 

Thanks!!