Instalar e configurar JBOSS AS 7.1.1 no CentOs 6

Publicado por Fabio Lopes em 24/03/2016

[ Hits: 10.150 ]

 


Instalar e configurar JBOSS AS 7.1.1 no CentOs 6



Adicionar usuário jboss:

# adduser jboss

Deixar usuário jboss assim (/etc/passwd):

jboss:x:500:500::/home/jboss:/bin/bash

# cd /opt/
# wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz
# tar -zxvf jboss-as-7.1.1.Final.tar.gz
# mv jboss-as-7.1.1.Final jboss7
# rm -rf jboss-as-7.1.1.Final.tar.gz


# yum install java-1.7.0-openjdk.x86_64

Verificar se o Java está instalado:

# java -version

# vim /etc/profile

Adicionar essas 6 linhas ao final do arquivo:

# Variaveis ambiente JAVA
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
PATH=$JAVA_HOME/bin:$PATH export PATH JAVA_HOME
CLASSPATH=$JAVA_HOME/lib/tools.jar
CLASSPATH=.:$CLASSPATH
export PATH JAVA_HOME CLASSPATH

# chown -R jboss:jboss /opt/jboss
# cd /opt/jboss7/bin/


Instalar:

# .standalone.sh

# vim /etc/init.d/jboss

#!/bin/sh
#
# JBoss standalone control script
#
# chkconfig: - 80 20
# description: JBoss Application Server
# processname: standalone
# pidfile: /var/run/jboss7/jboss.standalone.pid
# config:  /opt/jboss7/bin/standalone.conf

# Source function library.
. /etc/init.d/functions

# Load Java configuration.
[ -r /etc/java/java.conf ] && . /etc/java/java.conf

export JAVA_HOME

# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
  JBOSS_CONF="/opt/jboss7/bin/standalone.conf"
fi

[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"

if [ -z "$JBOSS_HOME" ]; then
  JBOSS_HOME=/opt/jboss7
fi

export JBOSS_HOME

if [ -z "$JBOSS_PIDFILE" ]; then
  JBOSS_PIDFILE=/var/run/jboss7/jboss.standalone.pid
fi
export JBOSS_PIDFILE

if [ -z "$JBOSS_CONSOLE_LOG" ]; then
  JBOSS_CONSOLE_LOG=/var/log/jboss7/console.log
fi

if [ -z "$STARTUP_WAIT" ]; then
  STARTUP_WAIT=30
fi

if [ -z "$SHUTDOWN_WAIT" ]; then
  SHUTDOWN_WAIT=30
fi

if [ -z "$JBOSS_CONFIG" ]; then
  JBOSS_CONFIG=standalone.xml
fi

JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh

prog='jboss7'

CMD_PREFIX=''

JBOSS_USER=jboss

if [ ! -z "$JBOSS_USER" ]; then
  if [ -x /etc/rc.d/init.d/functions ]; then
    CMD_PREFIX="daemon --user $JBOSS_USER"
  else
    CMD_PREFIX="su - $JBOSS_USER -c"
  fi
fi

start() {
  echo -n "Starting $prog: "
  if [ -f $JBOSS_PIDFILE ]; then
    read ppid < $JBOSS_PIDFILE
    if [ `ps --pid $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then
      echo -n "$prog is already running"
      failure
      echo
      return 1
    else
      rm -f $JBOSS_PIDFILE
    fi
  fi
  mkdir -p $(dirname $JBOSS_CONSOLE_LOG)
  cat /dev/null > $JBOSS_CONSOLE_LOG

  mkdir -p $(dirname $JBOSS_PIDFILE)
  chown $JBOSS_USER $(dirname $JBOSS_PIDFILE) || true
  #$CMD_PREFIX JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT 2>&1 > $JBOSS_CONSOLE_LOG &
  #$CMD_PREFIX JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT &

  if [ ! -z "$JBOSS_USER" ]; then
    if [ -x /etc/rc.d/init.d/functions ]; then
      daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG 2>&1 > $JBOSS_CONSOLE_LOG &
    else
      su - $JBOSS_USER -c "LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG" 2>&1 > $JBOSS_CONSOLE_LOG &
    fi
  fi

  count=0
  launched=false

  until [ $count -gt $STARTUP_WAIT ]
  do
    grep 'JBoss AS.*started in' $JBOSS_CONSOLE_LOG > /dev/null
    if [ $? -eq 0 ] ; then
      launched=true
      break
    fi
    sleep 1
    let count=$count+1;
  done
  
  success
  echo
  return 0
}

stop() {
  echo -n $"Stopping $prog: "
  count=0;

  if [ -f $JBOSS_PIDFILE ]; then
    read kpid < $JBOSS_PIDFILE
    let kwait=$SHUTDOWN_WAIT

    # Try issuing SIGTERM

    kill -15 $kpid
    until [ `ps --pid $kpid 2> /dev/null | grep -c $kpid 2> /dev/null` -eq '0' ] || [ $count -gt $kwait ]
    do
      sleep 1
      let count=$count+1;
    done

    if [ $count -gt $kwait ]; then
      kill -9 $kpid
    fi
  fi
  rm -f $JBOSS_PIDFILE
  success
  echo
}

status() {
  if [ -f $JBOSS_PIDFILE ]; then
    read ppid < $JBOSS_PIDFILE
    if [ `ps --pid $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then
      echo "$prog is running (pid $ppid)"
      return 0
    else
      echo "$prog dead but pid file exists"
      return 1
    fi
  fi
  echo "$prog is not running"
  return 3
}

case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  restart)
      $0 stop
      $0 start
      ;;
  status)
      status
      ;;
  *)
      echo "Usage: $0 {start|stop|status|restart|reload}"
      exit 1
      ;;
esac

# /etc/init.d/jboss restart

Verificar se as portas estão abertas:

# netstat -nlp | grep java
tcp   0  0 0.0.0.0:4447  0.0.0.0:*  OUÇA  3564/java           
tcp   0  0 0.0.0.0:9990  0.0.0.0:*  OUÇA  3564/java           
tcp   0  0 0.0.0.0:9999  0.0.0.0:*  OUÇA  3564/java           
tcp   0  0 0.0.0.0:8080  0.0.0.0:*  OUÇA  3564/java  

# vim /opt/jboss7/standalone/configuration/standalone.xml

Editar: deixar as duas com 0.0.0.0:

<inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
<inet-address value="${jboss.bind.address:0.0.0.0}"/>

# /etc/init.d/jboss restart

# vim /opt/jboss7/bin
# ./add-user.sh

What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a

Realm (ManagementRealm) : TECLE ENTER

Username: jboss
Password: sua senha
Re-enter Password: Repita sua senha
About to add user 'jboss' for realm 'ManagementRealm'
Is this correct yes/no? yes

Added user 'jboss' to file '/opt/jboss7/standalone/configuration/mgmt-users.properties'
Added user 'jboss' to file '/opt/jboss7/domain/configuration/mgmt-users.properties'

http://127.0.0.1:8080


Fim.

Outras dicas deste autor

Instalação OASIS 2.2.1 no CentOs/Red Hat 6.7

Instalar e configurar TOMCAT 7 no CentOS/RedHat 6

Instalar Apache-Arquiva 2.2.0 no CentOs 6

Verificar quantos cores e processadores existem na máquina

Leitura recomendada

Resolvedo problema do teclado ABNT2 no LTSP 4.2

Montando shares do Samba no Thunar

Obtenha novos esquemas de cores para o seu terminal

Instalando Automatix2 no Ubuntu Feisty Fawn

[RESOLVIDO] Erro: "VERR_FILE_NOT_FOUND" do VirtualBox no Arch Linux

  

Comentários

Nenhum comentário foi encontrado.



Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner
Linux banner
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts