15.2 C
Senior Writer and partner

How to install Payara Server on Ubuntu 18.04?

Java is a very popular programming language, widely used on servers and for software deployment. However, to perform this deployment and application service, it is necessary to have a server. That’s why today I’ll talk to you about how to install Payara Server.

Payara Server is the open source platform of choice for the development of Java EE production applications. In addition, it contains many improvements and better community support. Many companies worldwide use it for the deployment of their Java applications.

Installing the Payara Server will bring many advantages to our projects. For this reason, here are some of what it provides.

  • Fully Supported Server derived from GlassFish 5.x Open Source Edition.
  • Drop in Replacement for GlassFish Open Source Edition.
  • Microprofile 1.3 API support.
  • Supports deployment of JavaEE 8 applications.
  • Production Enhancements including JCache, JBatch, and Hazelcast session clustering.
  • Payara Micro for cloud and microservice deployments.

It is possible to install Payara Server in different operating systems such as Windows Server, Ubuntu, Debian, CentOS, RHEL, OpenSUSE, SUSE 11.4 and others.

- Advertisement -

In this tutorial, I will show you how to install it on Ubuntu 18.04 and Linux Mint 19.

1. Installing JDK for Payara Server

Payara Server requires JDK for its operation. In the case of version 5, the recommended is the JDK 8, so the first step is to check if it is installed. Type on the terminal:

:~$ java --version

1.- Showing java version installed
1.- Showing java version installed

In this case, note that I have JDK10 installed. In this case, I must install the 8.

:~$ sudo apt install openjdk-8-jdk

2.- Installing OpenJDK 8
2.- Installing OpenJDK 8

Now you must tell the system which version of Java it will use by default.

:~$ sudo update-alternatives --config java

After executing the command, enter the number corresponding to the installed Java version. And finally, run:

:~$ java -version

2-1 Setting default java
2-1 Setting default java

For now, we’re done with the JDK.

2. Install Payara Server

In a first place, you must download Payara Server from its website.

3.- Downloading Payara Server
3.- Downloading Payara Server

Then unzip it to the folder of your choice.

:~$ unzip payara-5.183.zip

4.- Unziping the downloaded file
4.- Unziping the downloaded file

Next, enter the folder. And in the path payara5/bin, run:

:~$ cd payara5/bin/
:~$ ./asadmin start-domain

5.- Starting Payara Server
5.- Starting Payara Server

This command will start the server running domain1, which is the default domain included in Payara Server. In case you want to start another domain, this must be explicitly specified as an argument of the command.

Now, go to localhost:4848 on your web browser.

6.- Principal screen for Payara Server
6.- Principal screen for Payara Server

3. Changing the default port

It is always a good idea to change the default port to avoid conflicts with others.

In a first place, stop the domain:

:~$ ./asadmin stop-domain

Note: remember to execute the command being located in the payara/bin folder.

Then, edit the domain.xml file. Located in the payara5/glassfish/domains/domain1/config/ directory.

:~$ cd payara5/glassfish/domains/domain1/config/
:~$ nano domain.xml

Next, locate the network-listener section, specifically in admin-listener and modify the port you want.

8.- Editing the default port
8.- Editing the default port

Now place yourself in the bin folder and run again:

:~$ ./asadmin start-domain

10.- Starting the domain again
9.- Starting the domain again

4. Deploy an application on Payara Server

There are two ways to deploy an application with Payara Server. Using the terminal the command is:

:~$ ./asadmin deploy /home/angelo/example.war

9.- Deploying an application
10.- Deploying an application

In case you want undeploy the application, run:

:~$ ./asadmin undeploy /home/angelo/example.war

12.- Undeploying a application
12.- Undeploying an application

And that’s all there is to it. Remember that Payara Server is very flexible so there are many options and its management although simple is very powerful.

Tell us about your experience with Payara Server. Have you used it?

Please spread this article to your social networks.


- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article