Jboss default方式下的Cluster配置[一]

Dependent Software:

jboss-4.2.2.GA.zip
httpd-2.2.9.tar.gz
mod_jk-1.2.26-httpd-2.2.6.so
jdk-1_5_0_16-linux-i586-rpm.bin

Install JDK

Install
# cd /home/tools
# chmod +x jdk-1_5_0_16-linux-i586-rpm.bin
#./ jdk-1_5_0_16-linux-i586-rpm.bin


Configuration

# vim /etc/profile
JAVA_HOME=/usr/java/jdk1.5.0_16
CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
PATH=$PATH:$JAVA_HOME/bin

export JAVA_HOME PATH CLASSPATH

# source /etc/profile
# echo $JAVA_HOME

# cd /usr/bin
# ln -s -f /usr/java/jdk1.5.0_16/bin/java
# ln -s -f /usr/java/jdk1.5.0_16/bin/javac



Check

# java –version

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Server VM (build 1.5.0_16-b02, mixed mode)

Install Jboss

Install
# su jboss
# cd /home/tools
# unzip -d /opt/ jboss-4.2.2.GA.zip


Configuration
# create group - change group id as needed
groupadd -g jboss

# create user - change user id as needed
useradd -g jboss -c "JBoss Admin" jboss


# vim /etc/profile 

JBOSS_HOME=/opt/jboss-4.2.2.GA
PATH=$PATH:$JBOSS_HOME/bin
export JBOSS_HOME PATH

# source /etc/profile
# echo $JBOSS_HOME

# chmod -Rf 755 $JBOSS_HOME


# vim jboss_init_redhat.sh

Add at front:
#JBOSS_HOST=${JBOSS_HOST:-"0.0.0.0"}
JBOSS_HOST=${JBOSS_HOST:-"192.168.150.75"}

Update the attributes:
JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss-4.2.2.GA"} 
JBOSS_USER=${JBOSS_USER:-"jboss"} 
JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.5.0_16/bin"} 
JBOSS_CONF=${JBOSS_CONF:-”default”} 

#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}

#JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF"}

JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}


Config for the shut down
#JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.sh -S -s $JBOSS_HOST"}
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"cd $JBOSS_HOME/bin; $JBOSSCP"}

# vim run.conf
Update [Xmx can be set as the 80% of the max available memory]:
JAVA_OPTS=-Xms512m –Xmx1024m



Jboss Security

Security jmx-console:

#vim deploy/jmx-console.war/WEB-INF/jboss-web.xml

Uncomment this part:
<security-domain>java:/jaas/jmx-console</security-domain>

#vim deploy/jmx-console.war/WEB-INF/web.xml

Uncomment this part:
<security-constraint>
     <web-resource-collection>
       <web-resource-name>HtmlAdaptor</web-resource-name>
       <description>An example security config that only allows users with the
         role JBossAdmin to access the HTML JMX console web application
       </description>
       <url-pattern>/*</url-pattern>
       <http-method>GET</http-method>
       <http-method>POST</http-method>
     </web-resource-collection>
     <auth-constraint>
       <role-name>JBossAdmin</role-name>
     </auth-constraint>
</security-constraint>

Check the user file path of jmx-console:
#cat conf/login-config.xml

Update the user & password [Format username=password]:
#vim conf/props/jmx-console-users.properties
admin=admin


Security web-console:

#vim deploy/ management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml

Uncomment this part:
<jboss-web> 
<depends>jboss.admin:service=PluginManager</depends> 
</jboss-web>

#vim deploy/ management/console-mgr.sar/web-console.war/WEB-INF/web.xml

Uncomment this part:
<security-constraint> 
<web-resource-collection> 
<web-resource-name>HtmlAdaptor</web-resource-name> 
<description>An example security config that only allows users with the 
role JBossAdmin to access the HTML JMX console web application 
</description> 
<url-pattern>/*</url-pattern> 
<http-method>GET</http-method> 
<http-method>POST</http-method> 
</web-resource-collection> 
<auth-constraint> 
<role-name>JBossAdmin</role-name> 
</auth-constraint> 
</security-constraint>

Check the user file path of web-console:
#cat conf/login-config.xml

Update the user & password [Format username=password]:
#vim console-mgr.sar/web-console.war/WEB-INF/classes/web-console-users.properties

admin=admin


Security invoker

Uncomment this paragraph in the “/deploy/jmx-invoker-service.xml” file.

<!-- Uncomment to require authenticated users
<interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
securityDomain="java:/jaas/jmx-console"/>
-->


Check
Check whether the Jboss is successful:

http:// 192.168.150.75/
http:// 192.168.150.75/jmx-console/
http:// 192.168.150.75/web-console/

你可能感兴趣的:(java,Web,linux,jboss,vim)