Scala-on-Z

How to install Scala on LinuxONE Community Cloud

Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries. Great for BigData and ML.

In this tutorial, We will be using RHEL (7.8, 8) & SLES 15

Prerequisites

  1. Request access to LinuxONE Community Cloud. Follow instructions here

Step 1: Build and Install Scala

1.1 Install the dependencies with OpenJDK and AdoptOpenJDK

For RHEL7.8,8

# sudo yum install -y java-11-openjdk java-11-openjdk-devel wget

Screenshot 2020-08-18 at 10 50 02

# sudo yum install -y tar wget

Screenshot 2020-08-18 at 10 50 22

For SLES 15

# sudo zypper install -y java-11-openjdk java-11-openjdk-devel wget

Screenshot 2020-08-18 at 12 36

# sudo zypper install -y tar wget gzip

Step 2: Download and Install Scala

2.1 For RHEL and SLES:

# wget http://www.scala-lang.org/files/archive/scala-2.13.3.rpm

Screenshot 2020-08-18 at 10 54 11

# sudo rpm -ivh scala-2.13.3.rpm

Screenshot 2020-08-18 at 12 39 44

2.2 Check Scala & Scalac version

# scala -version
Scala code runner version 2.13.3 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
# scalac -version
Scala compiler version 2.13.3 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.

Step 3:Testing Scala

3.1 Create at test program

# sudo vi HelloWorld.scala
# object HelloWorld
{
 def main(args: Array[String]): Unit = {
     println("Hello, world!")
 }
}
# wq:
# scala HelloWorld

The output of the above should result:

Hello, world!
# scala
# scala> 16*70

The output of the above should result:

val res0: Int = 1120
# scala> println("Hello Developer")

The output of the above should result:

Hello Developer

Well Done!