Monday, September 1, 2014

Amazon Web Services (AWS) FREE Hello World!

In the following steps, we will setup a simple AWS architecture assuming that you already completed your AWS account registration. We will be using the FREE AWS instances, so you do not have to worry about the billing ;)

1. Login the AWS Dashboard Console:

https://console.aws.amazon.com/console/home

2. Go to EC2:


3. Go to Instances > Launch Instance.

4. Make sure to check the "Free tier only" from the left side.

5. Select the OS that like from the list, in my case I will select Amazon Linux AMI 2014.09.1 (HVM).

6. Select the instance type of General Purpose, t2.micro which is FREE.

7. In the next configuration step, make sure to set Auto-assign Public IP to Enabled.



8. Add storage.


9. Configure the security.










10. Now you are ready to launch your first AWS instance.




11. Select to create new key pair to download it to your local PC.





12. After launching your instance, you should be able to see its status.






13. Check the Public IP and DNS in the instance properties:






14. To access the instance using SSH:

a. Open an SSH client PuTTY on Windows
b. Locate your private key file (aws-demo.pem). 
c. Restrict access to the key
    chmod 400 aws-demo.pem
d. Connect to your instance using its Public IP or DNS:
    ssh -i aws-demo.pem ec2-user@54.68.96.206


Congratulations!! :)

Tuesday, May 13, 2014

Installing JBoss EAP 6.2 on RedHat Linux

In this tutorial, I will be installing JBoss EAP 6.2 that will be using Oracle JDK 1.6 Update 45 on Red Hat Linux.

1.   Download Oracle jdk-6u45-linux-x64.bin
2.   Download JBoss EAP 6.2 (jboss-eap-6.2.0.zip) from JBoss download page.
3.   Create jboss user which will install and manage JBoss using:

     # adduser jboss 
     # su - jboss

4.   Copy the downloaded JDK and JBoss to the jboss home /home/jboss
5.   Install the JDK this extract the JBoss using:

      [jboss@lab04 ~]$ ./jdk-6u45-linux-x64.bin
      [jboss@lab04 ~]$ unzip jboss-eap-6.2.0.zip

6.   To setup JBoss as OS service and make it start automatically, use:

      [root@lab04 ~]# mkdir /etc/jboss-as
      [root@lab04 ~]# cp /home/jboss/jboss-eap-6.2/bin/init.d/jboss-as.conf /etc/jboss-as/.
      [root@lab04 ~]# cp /home/jboss/jboss-eap-6.2/bin/init.d/jboss-as-domain.sh /etc/init.d/.
      [root@lab04 ~]# cd /etc/init.d/
      [root@lab04 init.d]# chkconfig --add jboss-as-domain.sh
      [root@lab04 init.d]# chkconfig jboss-as-domain.sh on

7.   Edit the following parameters in /etc/jboss-as/jboss-as.conf

      JBOSS_USER=jboss
      JBOSS_HOME=/home/jboss/jboss-eap-6.2
      JAVA_HOME=/home/jboss/jdk1.6.0_45 

8. Now, you can start the domain using:

      [root@lab04 init.d]# service jboss-as-domain.sh start

Monday, May 12, 2014

How to add PostgreSQL JDBC driver to JBoss as core module?

1.   Check the support version of the PostgreSQL JDBC driver that is supported with JBoss version that you are using in "JBoss Enterprise Application Platform (EAP) 6 Supported Configurations"

For example, JBoss 6.2 is supported with PostgreSQL 9.2 JDBC4 Postgresql Driver.

2.   Download the PostgreSQL JDBC Driver from PostgreSQL JDBC Drivers download page.

3.  Place the download jar file postgresql-9.2-1004.jdbc4.jar under

     $EAP_HOME/modules/org/postgresql/main/

4.   Create XML file $EAP_HOME/modules/org/postgresql/main/module.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
   <resources>
     <resource-root path="postgresql-9.2-1004.jdbc4.jar"/>
   </resources>
   <dependencies>
     <module name="javax.api"/>
     <module name="javax.transaction.api"/>
   </dependencies>
</module>

5.   Restart JBoss domain/standalone servers to get the new module loaded using:

     # service jboss-as-domain.sh restart

6. Start the jboss-cli in connected mode:

     $EAP_HOME/bin/jboss-cli.sh --connect

7.   Execute the below command in CLI:

     /profile=full/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

NOTE:
Use the above bold values in all steps because this caused some pain while configuring this by myself :) any inconsistency in names, paths, parameters will cause this error:


JBAS010441: Failed to load module for driver [org.postgres]