[스크랩] JBoss 6.0 설치하기

Posted 2014. 6. 19. 13:30


출처 : http://blueray21.tistory.com/22




1. JBoss 다운로드 및 설치

1.1 다운로드

[root@centos ~]$ wget http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.Final/jboss-as-distribution-6.0.0.Final.zip/download

1.2 파일 이동 및 압축해제

[root@centos ~]$ mv jboss-as-distribution-6.0.0.Final.zip /usr/share/

1.3 압축 풀기

[root@centos ~]$ cd /usr/share/ 
[root@centos share]$ unzip -q jboss-as-distribution-6.0.0.Final.zip


2. 계정 생성 및 프로파일 수정

2.1 계정 새성

[root@centos share]$ groupadd jboss
[root@centos share]$ useradd -s /bin/bash -g jboss jboss
[
root@centos share]$ chown -Rf jboss.jboss /usr/share/jboss-as-distribution-6.0.0.Final/


2.2 프로파일 수정

  • JAVA_HOME
  • JBOSS_HOME

[root@centos share]$ vi /home/jboss/.bash_profil

1
2
3
4
5
6
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
JBOSS_HOME=/usr/share/jboss-6.0.0.Final
export JBOSS_HOME

2.3 설치 경로 소유자 변경

[root@centos share]$ chgrp -R jboss /usr/share/jboss-6.0.0.Final
[root@centos share]$ chown -R jboss /usr/share/jboss-6.0.0.Final


3. 스크립트 생성

[root@centos share]$ su - jboss
[jboss@centos ~]$ mkdir bin
[jboss@centos ~]$ cd bin
[jboss@centos bin]$ 
vi jboss.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
RETVAL=0
USER=`whoami`
JBOSS_HOME=/usr/share/jboss-6.0.0.Final
SERVER_IP=127.0.0.1
start() {
 # Start daemons.
 echo $"start JBoss6 : "
 if [ "$USER" = "root" ]; then
  su - jboss -c "$JBOSS_HOME/bin/run.sh -b $SERVER_IP -c all &"
 else
  if [ "$USER" = "jboss" ]; then
                        $JBOSS_HOME/bin/run.sh -b $SERVER_IP  -c all
  else
   echo "************* please! run by jboss ***************"
  fi
 fi
}
stop() {
 # Stop daemons.
 echo $"stop JBoss6 : "
 if [ "$USER" = "root" ]; then
  su - jboss -c "$JBOSS_HOME/bin/shutdown.sh -o $SERVER_IP"
 else
  if [ "$USER" = "jboss" ]; then
   $JBOSS_HOME/bin/shutdown.sh -o $SERVER_IP
  else
   echo "************* please! run by jboss ***************"
  fi
 fi
}
case "$1" in
 start)
  start
  ;;
 stop)
  stop
  ;;
 restart|reload)
  stop
  sleep 5
  start
  RETVAL=$?
  ;;
 *)
  echo $"Usage: $0 {start|stop|restart}"
  exit 1
esac
exit $RETVAL

[jboss@centos bin]$ chmod +x jboss.sh 


4. JBoss 실행 및 종료

4.1 JBoss 실행

[jboss@centos bin]$ ./jboss.sh start &

4.2 JBoss 상태 조회

[jboss@centos bin]$ netstat -an | grep 8080
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      

4.3 JBoss 종료

[jboss@centos bin]$ ./jboss.sh stop &


5. JBoss Admin Console 접속

  • http://localhost:8080/

  • Administration Console 클릭

  • Username : admin
  • Password : admin


6. JBoss Admin 비밀번호 변경

[jboss@centos bin]$ cd /usr/share/jboss-6.0.0.Final/server/default/conf/props
[jboss@centos props]$ vi jmx-console-users.properties

1
2
# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin