目录
1、安装openJDK1.7.0. 1
1.1、运行安装命令... 1
1.2、确认Java 成功安装... 2
2、安装JBoss7.1.1. 2
2.1、jboss7.1下载... 2
2.2、添加用户... 2
2.3、设置开机启动... 5
2.4、赋予执行权限... 7
2.5、访问... 8
3、安装maven3.0.4. 8
3.1、安装下载apache-maven-3.0.4-bin.tar.gz. 8
3.2、解压到目标目录... 8
3.3、设置环境变量... 8
3.4、测试是否成功... 8
3.5、修改默认的主页... 9
1、安装openJDK1.7.0
1.1、运行安装命令
yum install java-1.7.0-openjdk-devel
yum在分析完依赖包之后会要求确认安装,输入y并回车确认安装。
1.2、确认Java 成功安装
java -version
应该能看到控制台打印java的版本。
2、安装JBoss7.1.1
2.1、jboss7.1下载
tar -zxvf jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz
2.2、添加用户
# mv /root/jboss-as-7.1.1.Final /usr/local/jboss
# cd /usr/local/jboss/
# /usr/local/jboss/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
Enter the details of the new user to add.
Realm (ManagementRealm) : (回车)
Username : adminjboss
Password : 至少六位密码
Re-enter Password :
About to add user 'adminjboss' for realm 'ManagementRealm'
Is this correct yes/no?yes
Added user 'adminjboss' to file '/usr/local/jboss/standalone/configuration/mgmt-users.properties'
Added user 'adminjboss' to file '/usr/local/jboss/domain/configuration/mgmt-users.properties'
修改 jboss/standalone/configuration/standalone.xml 文件中127.0.0.1 改为 0.0.0.0 可以其他机器访问
启动 配置文件的路径为:
/usr/share/jboss-as-7.1.1.Final/standalone/configuration/standalone.xml
找到interfaces 定义,然后将jboss.bind.address 和 jboss.bind.address.management 两个变量默认值改为 0.0.0.0
<interfaces>
<interface name=”management”>
<inet-address value=”${jboss.bind.address.management:127.0.0.1}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:127.0.0.1}”/>
</interface>
<interface name=”unsecure”>
<inet-address value=”${jboss.bind.address.unsecure:127.0.0.1}”/>
</interface>
</interfaces>
修改前
<interfaces>
<interface name=”management”>
<inet-address value=”${jboss.bind.address.management:0.0.0.0}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:0.0.0.0}”/>
</interface>
<interface name=”unsecure”>
<inet-address value=”${jboss.bind.address.unsecure:127.0.0.1}”/>
</interface>
</interfaces>
修改后
如需要修改Jboss HTTP的绑定端口,可以修改行socket-binding。例如将端口改为80:
<socket-binding name=”http” port=”80″/>
注意:绑定端口<1024的话,需要root权限启动Jboss。
[root@mysqlnode2 bin]# /usr/local/jboss/bin/standalone.sh -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0&
2.3、设置开机启动
# cd /etc/init.d
vi jboss,脚本内容如下:
#!/bin/sh
#chkconfig: 345 99 10
#description: JBoss auto start-stop script.
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
### CHANGE THE STARTUP PATH TO YOUR START SCRIPT ###
startup='/usr/local/jboss/bin/standalone.sh > /dev/null 2> /dev/null &'
shutdown='killall java'
start(){
echo -n $"Starting JBoss service: "
$startup
RETVAL=$?
echo
}
stop(){
action $"Stopping JBoss service: " $shutdown
RETVAL=$?
echo
}
restart(){
stop
sleep 10
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac