Share your love
Best Steps to Install Scala 3 in RHEL 9 using Terminal

In this guide, you will learn to Install Scala 3 in RHEL 9 using Terminal including AlmaLinux 9 and Rocky Linux 9. Scala is a high-level, object-oriented, and general-purpose programming language that is based on Java. It can be used to build data-intensive distributed applications and systems.
Scala 3 is the latest and complete version. You can follow the steps below provided by the Orcacore team to Install Scala 3 in RHEL 9 using Terminal.
Note: If you are an Ubuntu user, you can get Scala by visiting Install Scala in the Ubuntu Terminal Command Line.
Table of Contents
Learn To Install Scala 3 in RHEL 9 Using Terminal
Before you start your Scala 3 installation, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can visit the Orcacore website and get the RHEL 9 initial server setup guides such as AlmaLinux 9 and Rocky Linux 9.
In this guide, we use AlmaLinux 9 to show the installation steps. Proceed to the next steps to Install Scala 3 in RHEL 9 using Terminal.
Step 1 – Update RHEL 9 Server using Terminal
First, you must run the system update on your RHEL 9 server. To do this, you can run the commands below:
# sudo dnf makecache
# sudo dnf update
Now you can start to install the requirements for Scala 3 and get the latest version.
Step 2 – Installing Java for Scala 3 on RHEL 9
Because Scala is based on JVM, you must have Java installed on your server. To do this, you can run the command below to install Java and other requirements tools:
sudo dnf install -y wget gzip java-17-openjdk
Then, verify your Java installation by checking its version:
java --version
Output
openjdk 17.0.9 2023-10-17 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.9.0.9-1) (build 17.0.9+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.9.0.9-1) (build 17.0.9+9-LTS, mixed mode, sharing)
Step 3 – Get Scala Setup Installer on RHEL 9
At this point, you can use the following wget command to get the Scala installer script on your RHEL 9 server:
sudo wget https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz
Then, unzip your downloaded file with the following command:
sudo gunzip cs-x86_64-pc-linux.gz
Move your extracted file to the CS directory and make the file executable with the commands below:
# sudo mv cs-x86_64-pc-linux cs
# sudo chmod +x cs
Step 4 – Run Scala 3 Installer Setup Script on RHEL 9
Now you can easily run your Scala setup installer to Install Scala 3 in RHEL 9 using Terminal:
sudo ./cs setup
It will check for your JVM files that are installed and ask you to add the path to the profile and bashrc. Enter Y to continue.

Next, apply the changes by sourcing the bash profile:
sudo source ~/.bash_profile
Now you should have Scala installed on your server. To verify it, you can check its version:
scala -version
Output
Scala code runner version 3.3.1 -- Copyright 2002-2023, LAMP/EPFL
As you can see, you have Scala 3 in the latest version on your RHEL 9 server.
Step 5 – Access Scala 3 Shell and Test it from RHEL 9 Terminal
At this point, you can access and run Scala from the RHEL 9 terminal. To do this, you can simply run the command below:
scala
In the output, you should see:
Output
Welcome to Scala 3.3.1 (17.0.9, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>
To see if your Scala is working correctly, you can run a sample project. For example:
scala> println("Hello This is Orcacore Team!")
Hello This is Orcacore Team!
To exit from the Scala shell, you can type:
scala> q:
To get more information, you can visit the Scala Documentation.
Step 6 – Uninstall Scala with CS Installer From RHEL 9
If you no longer want to use Scala, you can simply use the CS installer setup to remove it. To do this, run the command below:
cs uninstall scala
Output
Uninstalled scala
Conclusion
Now you have learned to Install Scala 3 in RHEL 9 using Terminal in the latest version with the CS setup installer. Also, you have learned access to your Scala shell and test your installation.
Hope you enjoy it. You may also like the following guides: