Share on Social Media

In this guide, you will learn, how to install Payara Server on CentOS 7 or other Redhat based Linux OS. #centlinux #linux #java

What is Payara Server? :

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 on CentOS 7 and deploy a Java App on Payara Server.

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

Install OpenJDK 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.

# yum install -y java-1.8.0-openjdk

Set Java related enironment variables.

# echo "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-" >> /etc/profile
# . /etc/profile
# env | grep JAVA_HOME

Verify Java installation by checking its version.

# 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)

Install Payara Server on CentOS 7:

Create a user to own Payara software.

# useradd -s /sbin/nologin payara

Payara Server 5.1 can be downloaded from Payara website.

# cd /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.

# unzip -d /opt/

Adjust ownership of the /opt/payara5 directory.

# chown -R payara:payara /opt/payara5/

Create a Systemd service for Payara Server.

# vi /usr/lib/systemd/system/payara.service

and add following directives therein.

Description = Payara Server v5.1
After =

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

WantedBy =

Enable and start payara.service.

# systemctl enable payara.service
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/payara.service.
# systemctl start payara.service

Configure Linux Firewall:

Payara server uses following Service ports.

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

Allow above service ports in Linux firewall.

# firewall-cmd --permanent --add-port={4848,8080,8181}/tcp
# firewall-cmd --reload

Access Payara Server Web UI:

Browse URL using a client’s browser.

Payara Server Default HomePage

Payara Server 5.1 is installed and running on designated port.

Add Payara server binaries to PATH environment variable.

# sed -i 's/^PATH=*/PATH=/opt/payara5/bin:/g' ~/.bash_profile
# . ~/.bash_profile

Set password for Payara Server 5.1 Admin user.

# 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.

# 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.

# systemctl restart payara.service

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

Payara Server Administration Console
Payara Server Administration Console Login

Login with admin user and password.

Payara Server Administration Console Dashboard

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.

# yum install -y git maven

Use git to clone the required project.

# 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.

# cd 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] ------------------------------------------------------------------------
[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.

# 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.

# 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.

# 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.

Payara Server Test Application Deployed


In this article, you have learned, how to install Payara Server on CentOS 7 and deployed a Simple Java App on Payara Server.

Leave a Reply

Your email address will not be published. Required fields are marked *