Install Payara Server 5.1 on CentOS 7 - CentLinux


Wednesday, 22 May 2019

Install Payara Server 5.1 on CentOS 7

Install Payara Server 5.1 on CentOS 7

Payara Server is a fork of famous open-source application server i.e. GlassFish Server. Payara Server was created in year 2014, as a drop in replacement for GlassFish after Oracle announced to discontinue commercial support for GlassFish. Payara server is sponsored by Payara Services Ltd since April 2016. Payara Server 5.1 is the latest release of this project.

In this article, we will install Payara Server 5.1 on CentOS 7 and deploy a Java App on Payara Server.


Table of Contents:


System Specification:

We have provisioned a CentOS 7 virtual machine on CentOS 7.

  • Hostname -
  • IP Address - /24
  • Operating System - CentOS 7.6
  • Payara Server - 5.1


Installing OpenJDK 8 on CentOS 7:

Connect with using ssh as root user.

Payara Server is a Java based application server and it requires JRE (Java Runtime Environment). Therefore, we are installing OpenJDK using yum command.

[root@payara-01 ~]# yum install -y java-1.8.0-openjdk ... Installed: java-1.8.0-openjdk.x86_64 1: Dependency Installed: atk.x86_64 0:2.28.1-1.el7 avahi-libs.x86_64 0:0.6.31-19.el7 cairo.x86_64 0:1.15.12-3.el7 copy-jdk-configs.noarch 0:3.3-10.el7_5 cups-libs.x86_64 1:1.6.3-35.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 fribidi.x86_64 0:1.0.2-1.el7 gdk-pixbuf2.x86_64 0:2.36.12-3.el7 giflib.x86_64 0:4.1.6-9.el7 graphite2.x86_64 0:1.3.10-1.el7_3 gtk-update-icon-cache.x86_64 0:3.22.30-3.el7 gtk2.x86_64 0:2.24.31-1.el7 harfbuzz.x86_64 0:1.7.5-2.el7 hicolor-icon-theme.noarch 0:0.12-7.el7 jasper-libs.x86_64 0:1.900.1-33.el7 java-1.8.0-openjdk-headless.x86_64 1: javapackages-tools.noarch 0:3.4.1-11.el7 jbigkit-libs.x86_64 0:2.0-11.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXcomposite.x86_64 0:0.4.4-4.1.el7 libXcursor.x86_64 0:1.1.15-1.el7 libXdamage.x86_64 0:1.1.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7 libXft.x86_64 0:2.3.2-2.el7 libXi.x86_64 0:1.7.9-1.el7 libXinerama.x86_64 0:1.1.3-2.1.el7 libXrandr.x86_64 0:1.5.1-2.el7 libXrender.x86_64 0:0.9.10-1.el7 libXtst.x86_64 0:1.2.3-1.el7 libXxf86vm.x86_64 0:1.1.4-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-egl.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libjpeg-turbo.x86_64 0:1.2.90-6.el7 libthai.x86_64 0:0.1.14-9.el7 libtiff.x86_64 0:4.0.3-27.el7_3 libwayland-client.x86_64 0:1.15.0-1.el7 libwayland-server.x86_64 0:1.15.0-1.el7 libxcb.x86_64 0:1.13-1.el7 libxshmfence.x86_64 0:1.2-1.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 mesa-libEGL.x86_64 0:18.0.5-4.el7_6 mesa-libGL.x86_64 0:18.0.5-4.el7_6 mesa-libgbm.x86_64 0:18.0.5-4.el7_6 mesa-libglapi.x86_64 0:18.0.5-4.el7_6 pango.x86_64 0:1.42.4-2.el7_6 pcsc-lite-libs.x86_64 0:1.8.8-8.el7 pixman.x86_64 0:0.34.0-1.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 ttmkfdir.x86_64 0:3.0.9-42.el7 tzdata-java.noarch 0:2019a-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 Complete!

Set Java related enironment variables.

[root@payara-01 ~]# echo "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-" >> /etc/profile [root@payara-01 ~]# . /etc/profile [root@payara-01 ~]# env | grep JAVA_HOME JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-

Verify Java installation by checking its version.

[root@payara-01 ~]# java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)


Installing Payara Server 5.1 on CentOS 7:

Create a user to own Payara software.

[root@payara-01 ~]# useradd -s /sbin/nologin payara

Payara Server 5.1 can be downloaded from Payara website.

[root@payara-01 ~]# cd /tmp [root@payara-01 tmp]# curl -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 140M 100 140M 0 0 288k 0 0:08:17 0:08:17 --:--:-- 450k

Extract downloaded file in /opt directory.

[root@payara-01 tmp]# unzip -d /opt/ ... inflating: /opt/payara5/mq/lib/imqxm.jar inflating: /opt/payara5/mq/lib/javax.json.jar inflating: /opt/payara5/mq/lib/javax.servlet-api.jar inflating: /opt/payara5/mq/lib/javax.transaction-api.jar inflating: /opt/payara5/mq/lib/jaxm-api.jar inflating: /opt/payara5/mq/lib/jhall.jar inflating: /opt/payara5/mq/lib/jms.jar inflating: /opt/payara5/mq/lib/tyrus-standalone-client.jar creating: /opt/payara5/META-INF/ extracting: /opt/payara5/META-INF/MANIFEST.MF inflating: /opt/payara5/README.txt

Adjust ownership of the /opt/payara5 directory.

[root@payara-01 tmp]# chown -R payara:payara /opt/payara5/

Create a Systemd service for Payara Server.

[root@payara-01 tmp]# vi /usr/lib/systemd/system/payara.service

and add following directives therein.

[Unit] Description = Payara Server v5.1 After = [Service] User = payara ExecStart = /usr/bin/java -jar /opt/payara5/glassfish/lib/client/appserver-cli.jar start-domain ExecStop = /usr/bin/java -jar /opt/payara5/glassfish/lib/client/appserver-cli.jar stop-domain ExecReload = /usr/bin/java -jar /opt/payara5/glassfish/lib/client/appserver-cli.jar restart-domain Type = forking [Install] WantedBy =

Enable and start payara.service.

[root@payara-01 tmp]# systemctl enable payara.service Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/payara.service. [root@payara-01 tmp]# systemctl start payara.service

Payara server uses following Service ports.

4848 - Administration Console
8080 - HTTP Service
8181 - HTTPS Service

Allow above service ports in Linux firewall.

[root@payara-01 tmp]# firewall-cmd --permanent --add-port={4848,8080,8181}/tcp success [root@payara-01 tmp]# firewall-cmd --reload success

Browse URL using a client's browser.


Payara Server 5.1 is installed and running on designated port.

Add Payara server binaries to PATH environment variable.

[root@payara-01 tmp]# sed -i 's/^PATH=*/PATH=\/opt\/payara5\/bin:/g' ~/.bash_profile [root@payara-01 tmp]# . ~/.bash_profile

Set password for Payara Server 5.1 Admin user.

[root@payara-01 tmp]# asadmin --port 4848 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.

By default, Payara Server Admin Console is running as a clear text HTTP service. Run following command to enable secure administration console.

[root@payara-01 tmp]# asadmin --host --port 4848 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.

Restart payara.service.

[root@payara-01 tmp]# systemctl restart payara.service

Browse URL using a client's browser. You may encounter a security certificate warning; just ignore it and continue.



Login with admin user and password.


We are at the dashboard of Payara Server Administration Console.


Deploy a Java App in Payara Server 5.1:

There are many Java applications available on GitHub. We are also downloading a Simple Java App. Although this Java App is for the demonstration purpose of BoxFuse, however we can use it for testing purpose of Payara Server as well.

But first, we need git to clone the project and Apache Maven to compile and build the project. Therefore, we are installing both of these tools using yum command.

[root@payara-01 ~]# yum install -y git maven ... Installed: git.x86_64 0: maven.noarch 0:3.0.5-17.el7 Dependency Installed: aether-api.noarch 0:1.13.1-13.el7 aether-connector-wagon.noarch 0:1.13.1-13.el7 aether-impl.noarch 0:1.13.1-13.el7 aether-spi.noarch 0:1.13.1-13.el7 aether-util.noarch 0:1.13.1-13.el7 aopalliance.noarch 0:1.0-8.el7 apache-commons-cli.noarch 0:1.2-13.el7 apache-commons-codec.noarch 0:1.8-7.el7 apache-commons-io.noarch 1:2.4-12.el7 apache-commons-lang.noarch 0:2.6-15.el7 apache-commons-logging.noarch 0:1.1.2-7.el7 apache-commons-net.noarch 0:3.2-8.el7.centos atinject.noarch 0:1-13.20100611svn86.el7 avalon-framework.noarch 0:4.3-10.el7 avalon-logkit.noarch 0:2.1-14.el7 bcel.noarch 0:5.2-18.el7 cal10n.noarch 0:0.7.7-4.el7 cdi-api.noarch 0:1.0-11.SP4.el7 cglib.noarch 0:2.2-18.el7 easymock2.noarch 0:2.5.2-12.el7 felix-framework.noarch 0:4.2.1-5.el7 geronimo-annotation.noarch 0:1.0-15.el7 geronimo-jms.noarch 0:1.1.1-19.el7 google-guice.noarch 0:3.1.3-9.el7 guava.noarch 0:13.0-6.el7 hamcrest.noarch 0:1.3-6.el7 httpcomponents-client.noarch 0:4.2.5-5.el7_0 httpcomponents-core.noarch 0:4.2.4-6.el7 jakarta-commons-httpclient.noarch 1:3.1-16.el7_0 java-1.8.0-openjdk-devel.x86_64 1: javamail.noarch 0:1.4.6-8.el7 javassist.noarch 0:3.16.1-10.el7 jboss-ejb-3.1-api.noarch 0:1.0.2-10.el7 jboss-el-2.2-api.noarch 0:1.0.1-0.7.20120212git2fabd8.el7 jboss-interceptors-1.1-api.noarch 0:1.0.2-0.9.20120319git49a904.el7 jboss-jaxrpc-1.1-api.noarch 0:1.0.1-7.el7 jboss-servlet-3.0-api.noarch 0:1.0.1-9.el7 jboss-transaction-1.1-api.noarch 0:1.0.1-8.el7 jline.noarch 0:1.0-8.el7 jsch.noarch 0:0.1.50-5.el7 jsoup.noarch 0:1.6.1-10.el7 junit.noarch 0:4.11-8.el7 jzlib.noarch 0:1.1.1-6.el7 log4j.noarch 0:1.2.17-16.el7_4 maven-wagon.noarch 0:2.4-3.el7 nekohtml.noarch 0:1.9.14-13.el7 objectweb-asm.noarch 0:3.3.1-9.el7 perl.x86_64 4:5.16.3-294.el7_6 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-Git.noarch 0: perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-294.el7_6 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-4.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-TermReadKey.x86_64 0:2.30-20.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-294.el7_6 perl-macros.x86_64 4:5.16.3-294.el7_6 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 plexus-cipher.noarch 0:1.7-5.el7 plexus-classworlds.noarch 0:2.4.2-8.el7 plexus-component-api.noarch 0:1.0-0.16.alpha15.el7 plexus-containers-component-annotations.noarch 0:1.5.5-14.el7 plexus-containers-container-default.noarch 0:1.5.5-14.el7 plexus-interactivity.noarch 0:1.0-0.14.alpha6.el7 plexus-interpolation.noarch 0:1.15-8.el7 plexus-sec-dispatcher.noarch 0:1.4-13.el7 plexus-utils.noarch 0:3.0.9-9.el7 qdox.noarch 0:1.12.1-10.el7 regexp.noarch 0:1.5-13.el7 rsync.x86_64 0:3.1.2-6.el7_6.1 sisu-inject-bean.noarch 0:2.3.0-11.el7 sisu-inject-plexus.noarch 0:2.3.0-11.el7 slf4j.noarch 0:1.7.4-4.el7_4 tomcat-servlet-3.0-api.noarch 0:7.0.76-9.el7_6 xalan-j2.noarch 0:2.7.1-23.el7 xbean.noarch 0:3.13-6.el7 xerces-j2.noarch 0:2.11.0-17.el7_0 xml-commons-apis.noarch 0:1.4.01-16.el7 xml-commons-resolver.noarch 0:1.2-15.el7 Complete!

Use git to clone the required project.

[root@payara-01 ~]# git clone Cloning into 'boxfuse-sample-java-war-hello'... remote: Enumerating objects: 74, done. remote: Total 74 (delta 0), reused 0 (delta 0), pack-reused 74 Unpacking objects: 100% (74/74), done.

Now, Build the project using Apache Maven.

[root@payara-01 ~]# cd boxfuse-sample-java-war-hello [root@payara-01 boxfuse-sample-java-war-hello]# mvn package ... [INFO] Packaging webapp [INFO] Assembling webapp [hello] in [/root/boxfuse-sample-java-war-hello/target/hello-1.0] [INFO] Processing war project [INFO] Copying webapp resources [/root/boxfuse-sample-java-war-hello/src/main/webapp] [INFO] Webapp assembled in [83 msecs] [INFO] Building war: /root/boxfuse-sample-java-war-hello/target/hello-1.0.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7:48.082s [INFO] Finished at: Tue May 21 14:09:56 PKT 2019 [INFO] Final Memory: 14M/35M [INFO] ------------------------------------------------------------------------

Check currently deployed applications on Payara server.

[root@payara-01 boxfuse-sample-java-war-hello]# asadmin list-applications Enter admin user name> admin Enter admin password for user "admin"> Nothing to list. No applications are deployed to this target server. Command list-applications executed successfully.

Deploy the WAR file in Payara server 5.1 as follows.

[root@payara-01 boxfuse-sample-java-war-hello]# asadmin deploy target/hello-1.0.war Enter admin user name> admin Enter admin password for user "admin"> Application deployed with name hello-1.0. Command deploy executed successfully.

Again check list of deployed Java Apps.

[root@payara-01 boxfuse-sample-java-war-hello]# asadmin list-applications Enter admin user name> Enter admin password> hello-1.0 <web> Command list-applications executed successfully.

Now, it displays our recently deployed Java App in the list.

Browse URL from a client's browser.


We have successfully installed Payara Server 5.1 on CentOS 7 and deployed a Simple Java App on Payara Server.

No comments:

Post a Comment