1.Glassfish4.0下载地址:https://glassfish.java.net/download.html#gfoseTab
2.将下载的glassfish-4.0.zip传输到服务器/home/[usrname]/opt目录下,使用命令传输:
scp glassfish-4.0.zip cmmcc@ [usrname][1-5]: /home/[usrname]/opt
3.创建文件夹:/home/[usrname]/opt/glassfish4,使用命令:
sudo mkdir glassfish4 /home/[usrname]/opt/
4.将.zip文件解压到/home/[usrname]/opt/glassfish4文件夹下,使用命令:
unzip glassfish-4.0.zip /home/[usrname]/opt/glassfish4
5.添加glassfish用户:
sudo useradd --system glassfish -d /home/[usrname]/opt/glassfish4
6.设置目录权限:
sudo chgrp -R [usrname] /home/[usrname]/opt/glassfish4/
sudo chown -R glassfish /home/[usrname]/opt/glassfish4/
7.设置脚本执行权限:
sudo chmod -R +x /home/[usrname]/opt/glassfish4/bin?
sudo chmod -R +x /home/[usrname]/opt/glassfish4/glassfish/bin?
8.在glassfish用户下启动服务
sudo su glassfish
cd /home/[usrname]/opt/glassfish4/bin
./asadmin start-domain domain1
9.修改默认用户admin的密码
在bin目录下找到asadmin文件,启动后依次执行:
./asadmin
asadmin>change-admin-password
提示输入用户名: 直接按Enter(不要输入,否则会报错)
提示密码: 直接按Enter
输入新密码:[usrname]glassfish
确认密码:[usrname]glassfish
回车后即提示修改成功
10.开启远程访问权限并退出glassfish用户
asadmin >enable-secure-admin
asadmin >exit
11.关闭服务并重启服务
./asadmin stop-domain
./asadmin start-domain domain1
12.添加命令自启动
sudo vi /etc/rc.local
/home/[usrname]/opt/glassfish4/bin/asadmin start-domain domain1?
13.重新启动系统,检查安装结果:
http://[机器IP]:4848/