这里创建两台虚拟机,使用的虚拟机软件是Multipass
下载安装:https://canonical.com/multipass/install
输入:multipass list
输出虚拟机信息:
$ multipass list
Name State IPv4 Image
host0 Running 192.168.69.5 Ubuntu 20.04 LTS
host1 Running 192.168.69.6 Ubuntu 20.04 LTS
登录虚拟机后配置好SSH免密登陆
执行:
wget https://dlcdn.apache.org/spark/spark-3.5.4/spark-3.5.4-bin-hadoop3.tgz # 下载spark
mv spark-3.5.4-bin-hadoop3.tgz /usr/local
tar -zxvf spark-3.5.4-bin-hadoop3.tgz
编辑~/.bashrc
,在结尾加上:
export SPARK_HOME=/usr/local/spark-3.5.4-bin-hadoop3
export PATH=$PATH:$SPARK_HOME/bin
执行source ~/.bashrc
在终端输入spark-shell
即可运行