install glassfish4 on CentOS 6

download and install

# wget http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip
# unzip glassfish-4.0.zip
# mv glassfish4 /usr/local

confirm installation

# cd /usr/local/glassfish4/bin
# ./asadmin start-domain

<open http://hostname:8080, http://hostname:4848>

#./asadmin stop-domain

Configuate Secure Admin Access

when you access glass admin console on port 4848, you will get Secure Admin must be enabled to access the DAS remotely.error.
Glassfish force you access admin console remotely by https. reference

#./asadmin

asadmin> change-admin-password
Enter admin user name [default: admin]>admin
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.

asadmin> enable-secure-admin
Enter admin user name>  admin
Enter admin password for user "admin">
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.

asadmin> stop-domain
Waiting for the domain to stop .
Command stop-domain executed successfully.

asadmin> start-domain
Waiting for domain1 to start .....
Successfully started the domain : domain1
domain  Location: /usr/local/glassfish4/glassfish/domains/domain1
Log File: /usr/local/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

open http://hostname:4848, and you can login now.

set glassfish as a service

create /etc/init.d/glassfish.

# chkconfig --add glassfish
# chkconfig glassfish on

# service glashfish start
#!bin/bash

# description: glassfish start stop restart
# processname: glassfish
# chkconfig: 2345 95 20

GLASSFISH_HOME=/usr/local/glassfish4
RETVAL=0

case "$1" in
        start)
                "$GLASSFISH_HOME/bin/asadmin" "start-domain"
                ;;
        stop)
                "$GLASSFISH_HOME/bin/asadmin" "stop-domain"
                ;;
        restart)
                "$GLASSFISH_HOME/bin/asadmin" "restart-domain"
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart}"
                RETVAL=1
esac
exit $RETVAL
подсмотрено тут

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.