centos 6.5下安装glassfish4

来源:互联网 发布:淘宝餐具店铺装修素材 编辑:程序博客网 时间:2024/06/05 09:10
第一步:下载软件
网址:https://glassfish.java.net/
可以下载最新版本了,也可以下载早期版本,带有ml后缀的中文版的
下载的包是zip格式的
第二步:解压文件
先上传到服务器相关目录:比如/usr/local/software
unzip glassfish-4.0-ml.zip
得到一个glassfish4的目录
第三步:把glassfish4拷贝到你想安装的目录 本人放在/usr/local下
cp glassfish4 /usr/local/
第四步:创建一个domain
$cd/usr/local/glassfish4/glassfish/bin
$./asadmin create-domain domain1//domain1是自定义名字
提示输入用户名:比如admin   回车
再输入密码,再次确定,即可
第五步:开启远程管理
此步骤是在根目录的bin下
$sh asadminenable-secure-admin
第六步:开启,关闭glassfish4
#开启
$cdglassfish4/glassfish/bin
$sh asadminstart-domain sh asadminstart -domain domain1 //关闭把相应的start换成stop即可
启动成功后,浏览器里输入http://IP:4848就可以看到控制界面了
注:
1、设置账号,口令
$cd/usr/local/glassfish4/glassfish/bin
$./asadminchange-admin-password

 2、如果浏览器不能访问,请查看防火墙是否阻挡,如果阻挡,添加下面的配置到防火墙

 -A INPUT -m state--state NEW -m tcp -p tcp --dport 4848 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080-j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8181-j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3700-j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 7676-j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306-j ACCEPT

保存并退出,重启防火墙

$service iptables restart

3、注册系统服务并设置开启自启动

$cd /usr/local/glassfish4/glassfish/bin

$./asadmin create-service domain1

出现下列提示表示成功

Found the Linux Service and successfullyuninstalled it.

The Service was createdsuccessfully. Here are the details:

Name of theservice:domain1

Type of theservice:Domain

Configuration location of theservice:/etc/init.d/GlassFish_domain1

User account that will run theservice: root

You have created the service but youneed to start it yourself.  Here are the mosttypical Linux commands of interest:

* /etc/init.d/GlassFish_domain1start

* /etc/init.d/GlassFish_domain1stop

* /etc/init.d/GlassFish_domain1restart

For yourconvenience this message has also been saved to this file:$HOME_PATH$/glassfish4/glassfish/domains/domain1/PlatformServices.log

Commandcreate-service executed successfully.

#查看系统服务:$service--status-all | grep GlassFish_domain1

可以看到注册成功

usage: /etc/init.d/GlassFish_domain1(start|stop|restart|help)

测试GlassFish是否成功启动关闭

$service GlassFish_domain1start/stop

#设置开机自启动

$vi /etc/init.d/GlassFish_domain1

在脚本开头#!/bin/sh 之后加入下几行:

# @author kinseorg kinse

# chkconfig: 2345 15 95

# description: GlassFish_domain1

设置GlassFish服务开机启动:$chkconfig GlassFish_domain1on

查看是否成功:$chkconfig --list

 


新建多个domain

./asadmincreate-domain --adminport 4849 --instanceport8080 domain2   (端口自己选择,别和以前的domain重复就行)

新建完了还要开通远程管理权限,否则会报错,如下图


很明显是没有权限造成的,那就开通权限吧
进入到glassfish安装的要目录的bin下
./asadmin--port 4849 enable-secure-admin (端口要和上面的对应)
然后输入你的新domain的用户和密码就可以了!
0 0
原创粉丝点击