Java installation is one of the mandatory things in installing Spark. Try the following command to verify the JAVA version.
$java -version
You should Scala language to implement Spark. So let us verify Scala installation using following command.
$scala -version
If Scala is already installed on your system, you get to see the following response −
Step 1: Downloading Scala
Download the latest version of Scala by visit the following link Download Scala. For this tutorial, we are using scala-2.11.6 version. After downloading, you will find the Scala tar file in the download folder.
Step 2: Installing Scala
Follow the below given steps for installing Scala.
Extract the Scala tar file
Type the following command for extracting the Scala tar file.
$ tar xvf scala-2.11.6.tgz
Move Scala software files
Use the following commands for moving the Scala software files, to respective directory (/usr/local/scala).
$ su – Password:
Set PATH for Scala
Use the following command for setting PATH for Scala.
$ export PATH = $PATH:/usr/local/scala/bin
Verifying Scala Installation
After installation, it is better to verify it. Use the following command for verifying Scala installation.
$scala -version
If Scala is already installed on your system, you get to see the following response −
Scala code runner version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL
Download the latest version of Spark by visiting the following link Download Spark. For this tutorial, we are using spark-3.2.3-bin-hadoop3.2 version. After downloading it, you will find the Spark tar file in the download folder.
wget [https://dlcdn.apache.org/spark/spark-3.2.3/spark-3.2.3-bin-hadoop3.2.tgz](https://dlcdn.apache.org/spark/spark-3.2.3/spark-3.2.3-bin-hadoop3.2.tgz)
Follow the steps given below for installing Spark.
The following command for extracting the spark tar file.
$ tar xvf spark-3.2.3-bin-hadoop3.2.tgz
The following commands for moving the Spark software files to respective directory (/home/hadoop/spark).
# mv spark-3.2.3-bin-hadoop3.2 /usr/local/spark
# cd /home/Hadoop/Downloads/
# mv spark-3.2.3-bin-hadoop3.2 spark
# ex
Add the following line to ~/.bashrc file. It means adding the location, where the spark software file are located to the PATH variable.
export PATH=$PATH:/usr/local/spark/bin
Use the following command for sourcing the ~/.bashrc file.
$ source ~/.bashrc
Write the following command for opening Spark shell.
$spark-shell
If spark is installed successfully then you will find the following output.