Best Guide To Install Scala 3 on Debian 12 Terminal

In this guide, you will learn to Install Scala 3 on Debian 12 Terminal. Scala is a scalable, high-level, general-purpose programming language running on JVM. It means that you can use both Scala and Java features. There are two versions of Scala including Scala 3 and Scala 2. Scala 3 has more features that make the language smaller and more regular. You can follow the steps below to get Scala 3 in the latest version on Debian 12. To do this, you can use the CS setup.

Steps To Install Scala 3 on Debian 12 Terminal

Before you start your Scala 3 installation, you must log in to your Debian 12 as a non-root user with sudo privileges. For this purpose, you can check Debian 12 Initial Server Setup.

Now follow the steps below to complete this guide.

Step 1 – Install Java for Scala Installation on Debian 12

Because Scala runs on JVM, you must have Java installed on your server. First, run the system update with the command below:

sudo apt update

Then, use the following command to install Java:

sudo apt install default-jdk -y

Verify your Java installation by checking its version:

java --version

Example Output:

Scala Java installation Debian

Step 2 – Scala 3 Installation on Debian 12

To get Scala 3 in the latest version, you must use the CS setup installer script that is provided by the official site. To do this, you can use the following curl command to get the CS installer script:

# sudo apt install curl -y
# sudo curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | sudo gzip -d > cs 

When your download is completed, make your file executable with the command below:

sudo chmod +x cs

Then, run the Scala CS installer to start your installation:

sudo ./cs setup

During the installation, you will be asked to add the path to the profile. Enter Y to continue.

Run Scala CS installer script

When your installation is completed, you will see:

Install Scala 3 on Debian 12 Terminal

Next, run the following command to apply the changes:

sudo source ~/.profile 

Now you can verify your Scala 3 installation by checking its version:

scala -version
Example Output
Scala code runner version 3.3.1 -- Copyright 2002-2023, LAMP/EPFL

Step 3 – Access Scala Shell on Debian

At this point, you can easily use the following command to access your Scala language shell on Debian 12:

scala

You will see:

Access Scala Shell terminal

To check your Scala is working correctly, you can run a sample code as follows, and exit from your shell by using:

Test Scala Language is working correctly

Step 4 – Uninstall Scala 3 From Debian 12

If you no longer want to use Scala 3 on your server, you can easily uninstall it by using the following CS script:

sudo cs uninstall scala

Conclusion

At this point, you have learned to Install Scala 3 on Debian 12 Terminal. Scala 3 is smaller and has more features instead Scala 2. You can easily use the CS installer to run Scala 3 and access your Shell.

Hope you enjoy using it. Also, you may like to read:

Install GitHub Desktop on Debian 12

Install Chromium Browser on AlmaLinux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!