Thursday, July 23, 2020

how to install glassfish server without setup in centos 7.5

 i have centos 7.5 as server. I am going  to install glassfish server in centos 7.5 server. i did like this :-

    for this you have to install jdk-8u181-linux-x64.rpm then
in /etc/profile

    export JAVA_HOME=/usr/java/jdk1.8.0_20
    export PATH=$JAVA_HOME/bin:$PATH

 then run following command  and create user "glassfish":-

    # useradd -s /bin/bash -g glassfish

glassfish                                                                      

  # chown -R glassfish: /opt/glassfish4/                                                                                  

# passwd glassfish
    Changing password for user glassfish.
    New password:

create a file in "/etc/systemd/system/glassfish.service"
and write following :-

    [Unit]
    Description = Glassdfish server 4.1
    After = syslog.target network.target

    [Service]
    user=glassfish
    ExecStart = /usr/java/jdk1.8.0_20/bin/java -jar /opt/glassfish4/glassfish/lib/client/appserver-cli.jar start-domain
    ExecStop = /usr/java/jdk1.8.0_20/bin/java  -jar /opt/glassfish4/glassfish/lib/client/appserver-cli.jar stop-domain
    ExecReload = /usr/java/jdk1.8.0_20/bin/java  -jar /opt/glassfish4/glassfish/lib/client/appserver-cli.jar restart-domain

    Type = forking

    [Install]
    WantedBy = multi-user.target


    now run commands :-

        # systemctl start glassfish.service
        # systemctl status glassfish.service

        it should show following output :-

        [glassfish@serverglassfish ~]$ systemctl status glassfish
        ● glassfish.service - Glassdfish server 4.1
           Loaded: loaded (/etc/systemd/system/glassfish.service; enabled; vendor preset: disabled)
           Active: active (running) since Thu 2019-07-25 13:03:22 IST; 18s ago
          Process: 13937 ExecStart=/usr/java/jdk1.8.0_20/bin/java -jar /opt/glassfish4/glassfish/lib/client/appserver-cli.jar start-domain (code=exited, status=0/SUCCESS)
         Main PID: 13956 (java)
            Tasks: 88
           CGroup: /system.slice/glassfish.service
                   └─13956 /usr/java/jdk1.8.0_20/bin/java -cp /opt/glassfish4/glassfi...

        now enable glassfish server :-

        # systemctl enable glassfish

 run in web browser :-

    localhost:8080

this will show

    Your server is now running

 now to go in admin mode :-

    localhost:4848



No comments:

Post a Comment