Getting Java and Jenkins Working on Linux on Mainframe
By: Petr Plavjaník
Tags: Jenkins, Linux, Mainframe, Zowe, Java

In a previous story, we have learned about Linux on IBM's mainframe (System z) and how you can get free access to an IBM LinuxONE machine on real mainframe hardware.

This story is about using Java on such a machine so we can get Java applications such as Jenkins running well on this system.

Installing Java on LinuxONE

Let’s try if there is Java already installed:

[linux1@plape ~]$ java

-bash: java: command not found

No, it is not. IBM recommends using Java builds from https://adoptopenjdk.net/. It is a project that IBM sponsors and IBM provides commercial support for these Java runtimes at https://www.ibm.com/cloud/support-for-runtimes.

When you open https://adoptopenjdk.net/, you need to click on the Other platform button and choose the s390x architecture.

Available JVM versions and types

What type of JVM should you choose? HotSpot or OpenJ9? IBM invests in the Eclipse OpenJ9 project and its benefits are described at https://developer.ibm.com/blogs/openjdk-with-eclipse-openj9-no-worries-just-improvements/.

When you download the HotSpot version for s390x it runs only in interpreted mode, so the OpenJ9 is a clear choice. Let’s install it!

Copy the link at the AdoptOpenJDK.net web page and download the package using curl:

Unpack it:

tar -xf OpenJDK8U-jdk_s390x_linux_openj9_8u242b08_openj9-0.18.1.tar.gz

It creates a new directory jdk8u242-b08 .

Move it to the /opt:

sudo mv jdk8u242-b08 /opt/

sudo chmod -R a+r /opt/jdk8u242-b08

Add it to the path:

export PATH=/opt/jdk8u242-b08/bin:$PATH

And check if it works:

[linux1@plape ~]$ java -version

openjdk version "1.8.0_242"

OpenJDK Runtime Environment (build 1.8.0_242-b08)

Eclipse OpenJ9 VM (build openj9-0.18.1, JRE 1.8.0 Linux s390x-64-Bit Compressed References 20200122_505 (JIT enabled, AOT enabled)

OpenJ9 - 51a5857d2

OMR - 7a1b0239a

JCL - 8cf8a30581 based on jdk8u242-b08)

Benchmarks

We will use the Renaissance Suite (https://renaissance.dev) to have some understanding of the performance of this system. Renaissance is a suite of JVM benchmarks. We will use only one: finagle-http.

Let’s download the .jar file:

And run the tests:

java -jar renaissance-gpl-0.10.0.jar finagle-http --csv jdk8u242-b08-openj9.csv

The average time all tests (except for the one) is 1613 ms. Is it good or not? The result on my Mac with 2.3 GHz Intel Core i9 was 11357 ms. This makes this LinuxONE system quite a decent system for Java!

The HotSpot JVM for s390x runs in interpreted mode and it makes it about 50x slower than OpenJ9 in this benchmark.

The package java-1.8.0-openjdk.s390x : OpenJDK Runtime Environment 8 that you can install using the RedHat package manager installs the slower HotSpot JVM. It is better to install the OpenJ9 JVM using the steps above.

Jenkins

Jenkins is an open-source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.

When paired with Zowe CLI it can be used to automate tasks even on z/OS.

We will follow the steps described in Installing Jenkins on Red Hat distributions.

Add the Jenkins repository to the yum repos, and install Jenkins from here.

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key sudo yum install jenkins

The Jenkins package does not know where you Java is so you need to modify the Jenkins configuration parameters:

sudo vi /etc/sysconfig/jenkins

Add the path to the java executable to the JENKINS_JAVA_CMD parameter:

## Type: string

## Default: ""

## ServiceRestart: jenkins

#

# Java executable to run Jenkins

# When left empty, we'll try to find the suitable Java.

#

JENKINS_JAVA_CMD="/opt/jdk8u242-b08/bin/java"

Next step is to open port 8080 at the firewall:

sudo su firewall-cmd --permanent --new-service=jenkins firewall-cmd --permanent --service=jenkins --set-short="Jenkins Service Ports" firewall-cmd --permanent --service=jenkins --set-description="Jenkins service firewalld port exceptions" firewall-cmd --permanent --service=jenkins --add-port=8080/tcp firewall-cmd --permanent --add-service=jenkins firewall-cmd --zone=public --add-service=http --permanent firewall-cmd --reload exit

You need to install another package to make possible for Jenkins to start:

sudo yum install fontconfig

Then you can start the Jenkins service:

sudo service jenkins restart

Starting jenkins (via systemctl): [ OK ]

Then you can open the URL: http://your-linux-one-ip-address:8080/ and complete the Jenkins installation.

Initial Jenkins web page to complete the installation

If you want to learn more about Jenkins installation, see this documentation: https://jenkins.io/doc/book/installing/#setup-wizard.

Summary

We have learned what is a good JVM for Linux on mainframe and have installed Jenkins to the LinuxONE system.

You can automate a lot of things with Jenkins. If you are interested in learning how you can automate processes on z/OS from another platform, learn about Zowe CLI.

Zowe CLI is using Node.js and we will cover how to get Node.js installed on the mainframe, both Linux and z/OS, in the future!