Installing Spark 4.x

Installing Spark 4.x on the WSL2 Host

Spark 4.2 129 needs Java 17, 21 or 25 (sudo apt install openjdk-21-jdk-headless) and, for PySpark 129 , Python 3.10 or later. The official build carries the JARs, shells, spark-submit and sbin service scripts; verify it against the published checksum.

Downloading, verifying and unpacking Spark 4.2.0Shell
java -version 2>&1 | head -1                      # Spark 4.2 needs Java 17, 21 or 25
cd ~ && V=spark-4.2.0 && PKG=$V-bin-hadoop3.tgz
curl -sSLO -C - --retry 9 --retry-all-errors https://downloads.apache.org/spark/$V/$PKG
curl -sSL https://downloads.apache.org/spark/$V/$PKG.sha512 | sha512sum -c
tar xzf $PKG && mv $V-bin-hadoop3 spark && rm $PKG
export SPARK_HOME=~/spark PATH=~/spark/bin:$PATH
spark-submit --version 2>&1 | grep -E "version|Using Scala"
Output
openjdk version "21.0.12.1" 2026-08-18
curl: (56) OpenSSL SSL_read: OpenSSL/3.5.5: error:0A000119:SSL routines::decryption failed or
  ...
...
spark-4.2.0-bin-hadoop3.tgz: OK
   /___/ .__/\_,_/_/ /_/\_\   version 4.2.0
Using Scala version 2.13.18, OpenJDK 64-Bit Server VM, 21.0.12.1

On this WSL2 6 host the 555 MB download kept dying with curl 3,008 : (56) ... bad record mac; -C - with --retry-all-errors makes curl resume instead of restarting. For Python-only work, pip 21,050 install pyspark==4.2.0 installs the same engine (485 MB, JARs included) without the sbin scripts and conf templates.