linux安装glassfish并布署
1
https://glassfish.java.net/download.html
2
准备工作:需要jdk7以上版本 Java EE 7 requires JDK 7 (or above)
下载glassfish-4.0.zip /home/centos/下载/glassfish-4.0.zip
3
解压unzip glassfish-4.0.zip
注意:这个命令会解压zip并且配置一个Domain1默认域
su - root
mkdir -p /decompress/glassfish
chown -R centos:centos /decompress/glassfish
cd /decompress/glassfish
mv /home/centos/下载/glassfish4 /decompress/glassfish
/decompress/glassfish/glassfish4/bin/asadmin start-domain
4
domain-root-dir as-install/domains/domain-dir 默认创建的domain1的位置
5
命令
默认只有一个domain1的情况下可以使用
5.1 start启动domain1
as-install /bin/asadmin start-domain
5.2 stop停止domain1
as-install /bin/asadmin stop-domain
5.3 查看启动状态(如果不知道有没有启动)
as-install /bin/asadmin list-domains
5.4 启动javadb数据库(如果需要的话)
as-install/bin/asadmin start-database --dbhome as-install-parent/javadb
/decompress/glassfish/glassfish4/bin/asadmin start-database --dbhome /decompress/glassfish/glassfish4/javadb
5.5停止javadb数据库
as-install/bin/asadmin stop-database
/decompress/glassfish/glassfish4/bin/asadmin stop-database
6
部署(配置程序,并且使程序能在应用服务器上运行被称为部署)
6.1
下载sample war
http://glassfish.java.net/downloads/quickstart/hello.war
/home/centos/下载/hello.war
6.2
部署
as-install/bin/asadmin deploy sample-dir/hello.war
/decompress/glassfish/glassfish4/bin/asadmin deploy /home/centos/下载/hello.war
http://localhost:8080/hello
6.3
显示部署的应用
as-install/bin/asadmin list-applications
/decompress/glassfish/glassfish4/bin/asadmin list-applications
6.4
卸载应用hello.war
as-install/bin/asadmin undeploy war-name
/decompress/glassfish/glassfish4/bin/asadmin undeploy hello
6.5
通过控制台部署卸载禁用 应用
可以在domain1/applications/中看到hello 这个应用
6.6 自动部署
可以把war包拷贝到自动部署文件夹autodeploy下面
cp sample-dir/hello.war as-install/domains/domain-dir/autodeploy
cp /home/centos/下载/hello.war /decompress/glassfish/glassfish4/glassfish/domains/domain1/autodeploy
6.7 卸载自动部署
cd as-install\domains\domain-dir\autodeploy
cd /decompress/glassfish/glassfish4/glassfish/domains/domain1/autodeploy
rm hello.war