Thursday 30 May 2013

How to install jboss in rhel 6.x / Centos 6.x

This post will cover installing JBoss 7.1.1 on CentOS 6.x.

We'll also set up JBoss to run as a service, as well as set up access to the management console

Finally, we will look at how run JBoss on port 80 or, alternatively, placing JBoss behind Apache.

Firstly, we will need to install Java.

JBoss 7.1.1 will work with JDK 6 or JDK 7.

I'm using JDK 7

[root@vellore 3rdparty_packages]# rpm -ivh jdk-7u7-linux-x64.rpm
-->
[root@vellore Downloads]# unzip jboss-as-7.1.1.Final.zip -d /usr/share/
[root@vellore Downloads]# cd /usr/share
[root@vellore share]# mv jboss-as-7.1.1.Final/ jboss-as

Since we will want to run JBoss as a non-root user with minimal privileges, we'll create a user, jboss, who will own the JBoss files and JBoss will run under his account.

To do this, do the following.

Create a new group, jboss, and then create the user jboss and add the user to the jboss group.

[root@vellore Downloads]# groupadd jboss;useradd -s /bin/bash -g jboss jboss
[root@vellore Downloads]# chown -Rf jboss.jboss /usr/share/jboss-as/
[root@vellore Downloads]# passwd jboss
[root@vellore Downloads]# cat /root/.bash_profile
JAVA_HOME=/usr/java/jdk1.7.0_07
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[root@vellore Downloads]# . ~/.bash_profile
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
[root@vellore Downloads]# java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
[root@vellore Downloads]# su - jboss
[jboss@vellore ~]$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
[jboss@vellore ~]$ exit
logout
[root@vellore Downloads]# cp /usr/share/jboss-as/bin/init.d/jboss-as-standalone.sh /etc/init.d/jboss
[root@vellore Downloads]# vim /etc/init.d/jboss
5 # chkconfig: 234 80 20
18 JBOSS_USER=jboss
19 export JBOSS_USER
[root@vellore Downloads]# chmod 755 /etc/init.d/jboss
[root@vellore Downloads]# chkconfig --add jboss
[root@vellore Downloads]# chkconfig --level 234 jboss on
[root@vellore Downloads]# service jboss start
Starting jboss-as: [ OK ]
[root@vellore Downloads]# service jboss stop
Stopping jboss-as: *** JBossAS process (16287) received TERM signal *** [ OK ]
[root@vellore ~]# vim /usr/share/jboss-as/standalone/configuration/standalone.xml
By default, JBoss 7.1.1 is bound to the loopback IP of 127.0.0.1, so if we want to make it available on the web, we need to change this.

Locate standalone.xml under /usr/share/jboss-as/standalone/configuration/.

Open standalone.xml in vi or a text editor and look for the public interfaces node as shown below.

<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>

To make JBoss publicly accessible, change 127.0.0.1 to either 0.0.0.0 to allow access on all interfaces or to your public IP.

So, for example, if your public IP is 10.66.191.232, you would change it as so:

[root@vellore ~]# vim /usr/share/jboss-as/standalone/configuration/standalone.xml
275 <interfaces>
276 <interface name="management">
277 <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
278 </interface>
279 <interface name="public">
280 <inet-address value="${jboss.bind.address:10.66.191.232}"/>
281 </interface>
282 <!-- TODO - only show this if the jacorb subsystem is added -->
283 <interface name="unsecure">
284 <!--
285 ~ Used for IIOP sockets in the standard configuration.
286 ~ To secure JacORB you need to setup SSL
287 -->
288 <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
289 </interface>
[root@vellore ~]# service jboss start
Starting jboss-as: [ OK ]
[root@vellore ~]#

Again, if you wish to have JBoss publicly accessible on all interfaces, use 0.0.0.0 in place of your IP above.

Save your changes, start up JBoss, and check it is publicly accessible via http://10.66.191.232:8080



How to install glassfish in rhel 6.x / Centos 6.x


-->

[root@vellore 3rdparty_packages]# rpm -ivh jdk-7u7-linux-x64.rpm


[root@vellore Downloads]# unzip glassfish-3.1.2.2.zip -d /usr/share/
[root@vellore Downloads]# vim /etc/init.d/glassfish
#!/bin/bash
# description: Glassfish Start Stop Restart
# processname: glassfish
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/jdk1.7.0_07
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
GLASSFISH_HOME=/usr/share/glassfish3/glassfish/
case $1 in
start)
sh $GLASSFISH_HOME/bin/asadmin start-domain domain1
;;
stop)
sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1
;;
restart)
sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1
sh $GLASSFISH_HOME/bin/asadmin start-domain domain1
;;
esac
exit 0
[root@vellore Downloads]# chmod 755 /etc/init.d/glassfish
[root@vellore Downloads]# chkconfig --add glassfish
[root@vellore Downloads]# chkconfig --level 234 glassfish on
[root@vellore Downloads]# service glassfish start

check this URL in your browser http://localhost:8080/

Click Administration Console it will take you to http://localhost:4848
Change password and logout



Tuesday 21 May 2013

How to find serial number of server in rhel/centos

[root@vellore Desktop]# dmidecode | egrep -i "serial|product"

                      Serial services are supported (int 14h)
        Product Name: ProLiant ML350 G5
        Serial Number: SGH839XC4Y     
        Serial Number: SGH839XC4Y     
        String 1: Product ID: 412645-B21