This guide installs Apache Spark 3.5.9 with Java 11 on Debian 11 and runs a small Scala RDD example in local mode. It retains the Debian 11 scope of the original tutorial and pins the Spark release instead of calling an old download the latest version.
Debian 11 lifecycle and prerequisites
Debian 11’s standard Long Term Support ended on 31 August 2026. The steps below are for reproducing an existing Debian 11 setup in an isolated lab. Prefer a supported Debian release for a new deployment, or arrange appropriate extended support for a legacy system. Archive repositories make old packages available; they do not restore standard security support.
Use a fresh Debian 11 environment, Bash, internet access and a normal account with sudo privileges. Allow at least 2 GB of available memory and about 2 GB of disk space for Java, the download and extracted files. The test used a Debian 11 ARM64 container with OpenJDK 11. The Spark binary distribution includes the Scala libraries needed by spark-shell, so a separate Debian Scala package is unnecessary.
Install Java from the Debian 11 archives
The original Debian mirror returned a package 404 during verification. On a fresh lab installation, back up sources.list and use the Debian archive entries below. Do not replace an organization’s configured extended-support or third-party repositories with this lab configuration. Existing files in sources.list.d may also need review if they still reference retired mirrors. Package signature checks remain enabled.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.before-spark-lab
sudo tee /etc/apt/sources.list > /dev/null <<'APT'
deb http://archive.debian.org/debian bullseye main
deb http://archive.debian.org/debian-security bullseye-security main
APT
sudo apt-get update
sudo apt-get install -y openjdk-11-jdk-headless curl ca-certificates
java -version
Download and verify Spark
Create a new spark-lab directory. Download the named binary archive and its SHA-512 checksum from Apache. Continue only when sha512sum reports OK; a missing file or checksum mismatch must be resolved before extraction. This installs Spark under your own account without replacing an existing /opt/spark installation.
mkdir spark-lab
cd spark-lab
curl -fLO https://archive.apache.org/dist/spark/spark-3.5.9/spark-3.5.9-bin-hadoop3.tgz
curl -fLO https://archive.apache.org/dist/spark/spark-3.5.9/spark-3.5.9-bin-hadoop3.tgz.sha512
sha512sum -c spark-3.5.9-bin-hadoop3.tgz.sha512
tar -xzf spark-3.5.9-bin-hadoop3.tgz
export SPARK_HOME="$PWD/spark-3.5.9-bin-hadoop3"
export PATH="$SPARK_HOME/bin:$PATH"
export SPARK_LOCAL_IP=127.0.0.1
SPARK_HOME and PATH apply to the current shell. In a new terminal, set them again to the same extracted directory before using spark-shell. SPARK_LOCAL_IP is restricted to loopback for this local exercise; it is not a cluster networking configuration.
Run the Scala shell and verify an RDD
The local[2] setting uses two worker threads on this machine. The example creates the integers 1 through 10, doubles them and checks the collected result. The web UI is disabled for this test. Paste the complete block into Bash; the commands between SCALA markers are interpreted by spark-shell.
spark-shell --master 'local[2]' --conf spark.ui.enabled=false <<'SCALA'
val rdd = sc.parallelize(1 to 10)
val doubled = rdd.map(_ * 2)
val result = doubled.collect()
assert(result.sameElements(Array(2,4,6,8,10,12,14,16,18,20)))
println("Doubled values: " + result.mkString(", "))
println("RDD verification passed")
:quit
SCALA
The expected values are 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, followed by RDD verification passed. A shell banner alone does not prove that a Spark job completed: check the assertion and output. collect brings every result to the driver, so use it only for small datasets like this example.
Troubleshooting and next steps
If Java is not found, confirm java -version works in the same terminal. If spark-shell is not found, check SPARK_HOME and PATH. For memory errors, make enough RAM available before retrying. This exercise validates a single-machine installation and an RDD transformation; it does not configure a distributed cluster, authentication or production scheduling.
References: Spark 3.5.9 documentation, Apache Spark downloads and verification and Debian 11 lifecycle.