install java
apt install openjdk-11-jdk
java -version
install spark
download
go to https://spark.apache.org/downloads.html site and open download page getting download url such as https://dlcdn.apache.org/spark/spark-3.4.0/spark-3.4.0-bin-hadoop3.tgz
wget https://dlcdn.apache.org/spark/spark-3.4.0/spark-3.4.0-bin-hadoop3.tgz
tar -vxf spark-3.4.0-bin-hadoop3.tgz
config
nano ~/.bashrc
# Add below lines at the end of the .bashrc file.
export SPARK_HOME=~/spark-3.4.0-bin-hadoop3
export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbin
source ~/.bashrc
start master
start-master.sh
open http://127.0.0.1:8080 to get master address such as: spark://x-xx:7077
start slave
start-slave.sh spark://xxx:7077