版本glassfish-4.0.zip
1、解压,拷贝到指定安装路径
unzip glassfish-4.0.zip
cp cp glassfish4 /usr/local/ -rf
2、设置glassfish环境变量
vim /etc/profile
export GLASSFISH_HOME=/usr/local/glassfish4
export PATH=.:$PATH:$JAVAHOME/bin:$MYSQLHOME/bin:$GLASSFISH_HOME/bin
source /etc/profle
进入/usr/local/glassfish4/glassfish/config,编辑该目录下的asevn.conf文件,在文件末尾加入AS_JAVA="/usr/local/jdk"(值为本机jdk安装路径)
AS_JAVA="/usr/jdk1.7.0_60"
3、如果不想使用默认domain可在此步骤创建自己的domain,并指定domaindir和admin port
执行如下命令,创建端口为4848,名称为虹盘的domain
asadmin create-domain --adminport 4848 hongpan
Enter admin user name [Enter to accept default "admin" / no password]>
Bad Network Configuration. DNS can not resolve the hostname:
java.net.UnknownHostException: dev: dev: Name or service not known
Using port 4848 for Admin.
Using default port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Using default port 6666 for OSGI_SHELL.
Using default port 9009 for JAVA_DEBUGGER.
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=localhost,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=localhost-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
Domain hongpan created.
Domain hongpan admin port is 4848.
Domain hongpan allows admin login as user "admin" with no password.
Command create-domain executed successfully.
4、启动刚才建立的domain虹盘
asadmin start-domain hongpan
Waiting for hongpan to start .........................
Successfully started the domain : hongpan
domain Location: /usr/local/glassfish4/glassfish/domains/hongpan
Log File: /usr/local/glassfish4/glassfish/domains/hongpan/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
5、修改刚刚创建的domain的admin密码,并使之能够通过web登录到控制台
asadmin change-admin-password
Enter admin user name [default: admin]>
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.
每次操作的时候控制台都提示输入用户名密码,比较麻烦
可以建立密码配置文件
AS_ADMIN_PASSWORD=xxxx
6、开启远程登录权限
asadmin enable-secure-admin
Enter admin user name>
Enter admin password>
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.
7、重启domain
asadmin restart-domain hongpan
Ubuntu 12.04 安装 GlassFish3.1.2
现在就可通过控制台进行管理了