Introduction
Apache Spark is an open-source, general-purpose, multi-language analytics engine for large-scale data processing. It works on both single and multiple nodes by utilizing the RAM in clusters to perform fast data queries on large amounts of data. It offers batch data processing and real-time streaming, with support of high-level APIs in languages such as Python, SQL, Scala, Java or R. The framework offers in-memory technologies that allow it to store queries and data directly in the main memory of the cluster nodes.
This article explains how to install Apache Spark on Ubuntu 20.04 server.
Prerequisites
- Deploy a fully updated Rcs Ubuntu 20.04 Server.
- Create a non-root user with sudo access.
1. Install Java
Update system packages.
$ sudo apt updateInstall Java.
$ sudo apt install default-jdk -yVerify Java installation.
$ java -version2. Install Apache Spark
Install required packages.
$ sudo apt install curl mlocate git scala -yDownload Apache Spark. Find the latest release from the downloads page.
$ curl -O https://archive.apache.org/dist/spark/spark-3.2.0/spark-3.2.0-bin-hadoop3.2.tgzExtract the Spark tarball.
$ sudo tar xvf spark-3.2.0-bin-hadoop3.2.tgzCreate an installation directory /opt/spark.
$ sudo mkdir /opt/sparkMove the extracted files to the installation directory.
$ sudo mv spark-3.2.0-bin-hadoop3.2/* /opt/sparkChange the permission of the directory.
$ sudo chmod -R 777 /opt/sparkEdit the bashrc configuration file to add Apache Spark installation directory to the system path.
$ sudo nano ~/.bashrcAdd the code below at the end of the file, save and exit the file:
export SPARK_HOME=/opt/spark
export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbinSave the changes to take effect.
$ source ~/.bashrcStart the standalone master server.
$ start-master.shFind your server hostname from the dashboard by visiting http://ServerIPaddress:8080. Under the URL value. It might look like this:
URL: spark://my-server-development:7077Start the Apache Spark worker process. Change spark://ubuntu:7077 with your server hostname.
$ start-slave.sh spark://ubuntu:70773. Access Apache Spark Web Interface
Go to your browser address bar to access the web interface and type in http://ServerIPaddress:8080 to access the web install wizard. For example:
http://192.0.2.10:8080Conclusion
You have installed Apache Spark on your server. You can now access the main dashboard begin managing your clusters.
More Information
For more information about Apache Spark, please see the official documentation.