How To Install scala on Ubuntu 18.04

In this tutorial we learn how to install scala on Ubuntu 18.04. scala is Scala programming language

Introduction

In this tutorial we learn how to install scala on Ubuntu 18.04.

What is scala

scala is:

Scala is a Java-compatible programming language with many modern language features. It is Java-compatible in that Scala and Java classes can directly reference each other and subclass each other with no glue code needed. It includes modern language features such as closures, pattern-matching, parametric types, and virtual type members.

This package includes the various tools used to develop code written in Scala. It includes a compiler (scalac), an interpreter and script runner (scala), the offline compiler (fsc), and source-scanning documentation generator (scaladoc).

There are three methods to install scala on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install scala Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install scala using apt-get by running the following command:

sudo apt-get -y install scala

Install scala Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install scala using apt by running the following command:

sudo apt -y install scala

Install scala Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install scala using aptitude by running the following command:

sudo aptitude -y install scala

How To Uninstall scala on Ubuntu 18.04

To uninstall only the scala package we can use the following command:

sudo apt-get remove scala

Uninstall scala And Its Dependencies

To uninstall scala and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove scala

Remove scala Configurations and Data

To remove scala configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge scala

Remove scala configuration, data, and all of its dependencies

We can use the following command to remove scala configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge scala

References

Summary

In this tutorial we learn how to install scala package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.