Centos 7.4 install stand-alone Spark

Foreword###

Due to personal learning needs, I will study how to install Spark. However, due to my limited financial resources, I have not yet joined the cluster. Let’s try the stand-alone version of Spark first. If there is an expansion later, update the cluster installation tutorial synchronously.

All the following operations are based on the root user.

0. Install Scala

0.1 Before installation

You need to install Scala before installing Spark, because Spark depends on Scala. So let's install Scala first, and download the compressed package of Scala from Scala official website.

Then we upload the compressed package to the Centos server, how to upload it will not be detailed here.
We put the compressed package in the /opt/scala directory, and then unzip it.

Unzip command

tar -xvf scala-2.12.2.tgz

0.2 Configure environment variables

Add environment variables in /etc/profile, add export SCALA_HOME=/opt/scala/scala-2.12.2 and add ${SCALA_HOME}/bin: in path.

Below are my environment variables.

export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export SCALA_HOME=/opt/scala/scala-2.12.2export PATH=${JAVA_HOME}/bin:${SCALA_HOME}/bin:$PATH

Then we can verify scala:

At this point, the installation of scala is complete, and the next step is the installation of Spark~~~

1. Install Spark

1.1 Download and unzip####

Same as Scala, let’s go shopping and download the package first, and then upload it to the server.

In the same way, we put the compressed package in the /opt/spark directory, and then unzip it.

Unzip command

tar -xvf spark-2.4.3-bin-hadoop2.7.tgz

1.2 Configure environment variables

Similar to the small differences, add environment variables in /etc/profile, add export SPARK_HOME=/opt/spark/spark-2.4.3-bin-hadoop2.7 and add ${SPARK_HOME}/bin in path :.

Below are my environment variables.

export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export SCALA_HOME=/opt/scala/scala-2.12.2export SPARK_HOME=/opt/spark/spark-2.4.3-bin-hadoop2.7export PATH=${JAVA_HOME}/bin:${SPARK_HOME}/bin:${SCALA_HOME}/bin:$PATH

1.3 Configure Spark

First enter the conf directory of the decompressed file, which is /opt/spark/spark-2.4.3-bin-hadoop2.7/conf/, we can see that there is a template file, we copy One serving.

cp spark-env.sh.template spark-env.sh

We edit the copied file and add the following content:

export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export SCALA_HOME=/opt/scala/scala-2.12.2export SPARK_HOME=/opt/spark/spark-2.4.3-bin-hadoop2.7export SPARK_MASTER_IP=learn
export SPARK_EXECUTOR_MEMORY=1G

Similarly, we make a copy of slaves

cp slaves.template slaves

Edit slaves, the content is localhost:

localhost

Then we can test, /opt/spark/spark-2.4.3-bin-hadoop2.7 execute in this directory:

. /bin/run-example SparkPi 10

Here we can see that the execution has been successful.

1.4 Start Spark Shell

The same as above is also in the /opt/spark/spark-2.4.3-bin-hadoop2.7 directory, execute:

. /bin/spark-shell

We can see the following results:

So far, the stand-alone version of Spark is installed~~~

Recommended Posts

Centos 7.4 install stand-alone Spark
1.5 Install Centos7
Install Spark stand-alone environment on Spark Ubuntu18
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8
CentOS 7 install Java 1.8
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual
CentOS7 install Kubernetes 1.16.3
VirtualBox install centos7
centos7 install lamp
Install centos7 and connect